aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Bremner <david@tethera.net>2021-07-31 16:02:14 -0400
committerDavid Bremner <david@tethera.net>2021-07-31 16:02:14 -0400
commit2819c5ee160fa48d9f83604be556fb2530c0a9dd (patch)
tree9145d5a9410aafda2a4845371c92ee2fe85bf18a
parente416fe6ae6a6b3cf71acd79f7f3575351d39dcf8 (diff)
implement accept command
untested because I need some non spam messages.
-rw-r--r--mm3mod/__init__.py26
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':