summaryrefslogtreecommitdiff
path: root/src/leap/bitmask
diff options
context:
space:
mode:
Diffstat (limited to 'src/leap/bitmask')
-rw-r--r--src/leap/bitmask/cli/mail.py8
-rw-r--r--src/leap/bitmask/core/dispatcher.py3
-rw-r--r--src/leap/bitmask/core/mail_services.py8
3 files changed, 10 insertions, 9 deletions
diff --git a/src/leap/bitmask/cli/mail.py b/src/leap/bitmask/cli/mail.py
index 9bb5581d..f0fa9722 100644
--- a/src/leap/bitmask/cli/mail.py
+++ b/src/leap/bitmask/cli/mail.py
@@ -31,10 +31,10 @@ SUBCOMMANDS:
enable Start service
disable Stop service
status Display status about service
- get-token Returns token for the mail service
- get-smtp-certificate Downloads a new smtp certificate
+ get_token Returns token for the mail service
+ get_smtp_certificate Downloads a new smtp certificate
'''.format(name=command.appname)
- commands = ['enable', 'disable', 'status', 'get-token',
- 'get-smtp-certificate']
+ commands = ['enable', 'disable', 'status', 'get_token',
+ 'get_smtp_certificate']
diff --git a/src/leap/bitmask/core/dispatcher.py b/src/leap/bitmask/core/dispatcher.py
index f57790e2..e81cad62 100644
--- a/src/leap/bitmask/core/dispatcher.py
+++ b/src/leap/bitmask/core/dispatcher.py
@@ -35,7 +35,7 @@ class SubCommand(object):
_method = getattr(self, 'do_' + subcmd.upper(), None)
if not _method:
raise RuntimeError('No such subcommand')
- return _method(service, *parts, **kw)
+ return defer.maybeDeferred(_method, service, *parts, **kw)
class UserCmd(SubCommand):
@@ -105,6 +105,7 @@ class MailCmd(SubCommand):
@register_method('dict')
def do_ENABLE(self, service, *parts, **kw):
+ # FIXME -- service doesn't have this method
d = service.do_enable_service(self.label)
return d
diff --git a/src/leap/bitmask/core/mail_services.py b/src/leap/bitmask/core/mail_services.py
index 799ff3c6..68cb444a 100644
--- a/src/leap/bitmask/core/mail_services.py
+++ b/src/leap/bitmask/core/mail_services.py
@@ -459,15 +459,15 @@ class StandardMailService(service.MultiService, HookableService):
# commands
def do_status(self):
- return 'mail: %s' % 'running' if self.running else 'disabled'
+ status = 'running' if self.running else 'disabled'
+ return {'mail': status}
def get_token(self):
active_user = self._active_user
if not active_user:
- return defer.succeed('NO ACTIVE USER')
+ return defer.succeed({'user': None})
token = self._service_tokens.get(active_user)
- # TODO return just the tuple, no format.
- return defer.succeed("MAIL TOKEN (%s): %s" % (active_user, token))
+ return defer.succeed({'user': active_user, 'token': token})
def do_get_smtp_cert_path(self, userid):
username, provider = userid.split('@')