summaryrefslogtreecommitdiff
path: root/src/leap/bitmask/cli
diff options
context:
space:
mode:
authorRuben Pollan <meskio@sindominio.net>2017-12-08 18:10:13 +0100
committerKali Kaneko <kali@leap.se>2017-12-20 15:27:06 +0100
commitd2e5f8406b6101971c196f40e39322e36d6bdb33 (patch)
treecfe3fb852f80effd52b7a75688cd2a5118fe9a1f /src/leap/bitmask/cli
parentd5bd7394344afd2c6466f368a0de7566094a0d0d (diff)
[feat] Add msg_status call to the mail API
To get the status of a single message providing it's mailbox and message-id. For now it only returns encryption/signature status. - Resolves: #6914
Diffstat (limited to 'src/leap/bitmask/cli')
-rw-r--r--src/leap/bitmask/cli/mail.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/src/leap/bitmask/cli/mail.py b/src/leap/bitmask/cli/mail.py
index bb880e7b..25f3df52 100644
--- a/src/leap/bitmask/cli/mail.py
+++ b/src/leap/bitmask/cli/mail.py
@@ -35,6 +35,7 @@ SUBCOMMANDS:
disable Stop service
status Display status about service
get_token Returns token for the mail service
+ msg_status Get message status
msg_add Add a msg file to a mailbox
'''.format(name=command.appname)
@@ -75,6 +76,27 @@ SUBCOMMANDS:
return self._send(command.default_printer)
+ def msg_status(self, raw_args):
+ parser = argparse.ArgumentParser(
+ description='Bitmask email status',
+ prog='%s %s %s' % tuple(sys.argv[:3]))
+ parser.add_argument('-u', '--userid', default='',
+ help='Select the userid of the mail')
+ parser.add_argument('-m', '--mbox', default='INBOX',
+ help='the mailbox whre the message is stored')
+ parser.add_argument('msgid', nargs=1,
+ help='message id to get the status from')
+ subargs = parser.parse_args(raw_args)
+
+ if subargs.userid:
+ userid = subargs.userid
+ else:
+ userid = self.cfg.get('bonafide', 'active', default=None)
+
+ self.data += ['msg_status', userid, subargs.mbox, subargs.msgid[0]]
+
+ return self._send(command.default_printer)
+
def msg_add(self, raw_args):
parser = argparse.ArgumentParser(
description='Bitmask email status',