diff options
Diffstat (limited to 'mm3mod')
-rw-r--r-- | mm3mod/__init__.py | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/mm3mod/__init__.py b/mm3mod/__init__.py index 83577ae..3d18a91 100644 --- a/mm3mod/__init__.py +++ b/mm3mod/__init__.py @@ -26,8 +26,6 @@ class ModShell(cmd.Cmd): def matching_request_ids(self,text): candidates = [] prefix_len = len(text) - if text == "page"[0:prefix_len]: - candidates.append('page') for msg in self.held_messages: string = str(msg.request_id) @@ -35,12 +33,34 @@ class ModShell(cmd.Cmd): candidates.append(string) return candidates - def complete_discard(self, text, line, begidx, endidx): + def complete_accept(self, text, line, begidx, endidx): return self.matching_request_ids(text) + def do_accept(self, arg): + ''' + accept <number> + + Forward held message(s) to mailing list. + ''' + try: + n = int(arg) + self.mlist.get_held_message (n).accept() + except ValueError: + print('Illegal request_id: {:s}'.format(arg)) + + return False + + def complete_discard(self, text, line, begidx, endidx): + candidates = self.matching_request_ids(text) + if text == "page"[0:prefix_len]: + candidates.append('page') + return candidates + def do_discard(self, arg): ''' discard <number> | page + + Discard held message(s) as spam. ''' try: if arg == 'page': |