[Nym3-commit] r299 - trunk/nym3/Client
jr at conuropsis.org
jr at conuropsis.org
Tue Jun 14 20:25:59 CEST 2005
Author: jr
Date: 2005-06-14 20:25:58 +0200 (Tue, 14 Jun 2005)
New Revision: 299
Modified:
trunk/nym3/Client/Account.py
trunk/nym3/Client/Main.py
Log:
add the "delete a message in the local mbox" function
Modified: trunk/nym3/Client/Account.py
===================================================================
--- trunk/nym3/Client/Account.py 2005-06-14 16:50:00 UTC (rev 298)
+++ trunk/nym3/Client/Account.py 2005-06-14 18:25:58 UTC (rev 299)
@@ -465,9 +465,20 @@
def add_msg(self, mid, msg):
self._load_mbox()
+ #this ensures there is no more than one occurence of a mid in
+ #the list
+ if self.mbox[0].has_key(mid):
+ self.mbox[1].remove(mid)
self.mbox[0][mid] = msg
self.mbox[1].append(mid)
self.mbox_status = "dirty"
+ def delete_msg(self, mid):
+ self._load_mbox()
+ if self.mbox[0].has_key(mid):
+ del(self.mbox[0][mid])
+ self.mbox[1].remove(mid)
+ self.mbox_status = "dirty"
+
def add_enckey(self, key):
self['encKeys'].insert(0, key)
Modified: trunk/nym3/Client/Main.py
===================================================================
--- trunk/nym3/Client/Main.py 2005-06-14 16:50:00 UTC (rev 298)
+++ trunk/nym3/Client/Main.py 2005-06-14 18:25:58 UTC (rev 299)
@@ -60,8 +60,9 @@
\tsend-surb\tSend SURBs
\texport\t\tExport already fetched emails to a file
\tresend-command\tResend a command that has been sent but not acknowledged
- \t\t\tyet"""
-
+ \t\t\tyet
+ \tldelete\tDelete a message from the local mbox"""
+
class CLI:
def __init__(self):
pass
@@ -609,6 +610,14 @@
else:
sys.stdout.flush()
+def ldelete(ui, config, nickname, args = []):
+ account = get_account_from_nickname(ui, config, nickname,
+ "No nickname given, abort\nUse -n <nickname>")
+ args = decode_message_references(args, ['mbox'],
+ {'mbox': (build_mbox_index, (account,))})
+ for mid in args:
+ account.delete_msg(mid)
+
def main(args):
if len(args) < 2:
print usage_string
@@ -795,7 +804,6 @@
resend_command(ui, config, options.nickname, args)
sys.exit(0)
-
if args[1] == "export":
parser = OptionParser()
parser.add_option("-n", "--nickname", action = "store",
@@ -810,6 +818,19 @@
export(ui, config, options.nickname, options.output, args)
sys.exit(0)
+ if args[1] == "ldelete":
+ parser = OptionParser()
+ parser.add_option("-n", "--nickname", action = "store",
+ dest = "nickname", help = "The nickname "
+ "of the account whose emails to request")
+ (options, args) = parser.parse_args(args[2:])
+ ui = CLI()
+ config = Config.Config()
+ ldelete(ui, config, options.nickname, args)
+ sys.exit(0)
+
+
+
if __name__ == '__main__':
main(sys.argv)
sys.exit(0)
More information about the Nym3-commit
mailing list