[Nym3-commit] r312 - in trunk/nymbaron: . Client
jr at conuropsis.org
jr at conuropsis.org
Mon Sep 26 23:28:51 CEST 2005
Author: jr
Date: 2005-09-26 23:28:50 +0200 (Mon, 26 Sep 2005)
New Revision: 312
Modified:
trunk/nymbaron/Client/Account.py
trunk/nymbaron/Client/Main.py
trunk/nymbaron/TODO
Log:
-add a method to get the account nicknames in a TagMap
-add a command list-accounts to the client
-reindentation in Account
Modified: trunk/nymbaron/Client/Account.py
===================================================================
--- trunk/nymbaron/Client/Account.py 2005-09-26 20:12:25 UTC (rev 311)
+++ trunk/nymbaron/Client/Account.py 2005-09-26 21:28:50 UTC (rev 312)
@@ -117,7 +117,7 @@
raise NoSuchAccount()
def getnewId(self, nick):
- self._lock()
+ self._lock()
self._load()
if self.nick2id.has_key(nick):
self._release()
@@ -132,6 +132,10 @@
self._release()
return rtag
+ def getNicks(self):
+ self._loadifneeded()
+ return self.nick2id.keys()
+
class Account:
"""Hold account data. Specifically, this means:
Modified: trunk/nymbaron/Client/Main.py
===================================================================
--- trunk/nymbaron/Client/Main.py 2005-09-26 20:12:25 UTC (rev 311)
+++ trunk/nymbaron/Client/Main.py 2005-09-26 21:28:50 UTC (rev 312)
@@ -65,7 +65,8 @@
\tresend-command\tResend a command that has been sent but not acknowledged
\t\t\tyet
\tldelete\t\tDelete messages from the local mbox
- \tldelete-syn\tDelete synopses from the local synbox"""
+ \tldelete-syn\tDelete synopses from the local synbox
+ \tlist-accounts\tList the accounts of the user"""
class CLI:
def __init__(self):
@@ -588,6 +589,21 @@
#TODO display the content of the command
#ui.display()
+def list_accounts(ui, config):
+ """returns a list of strings, each element describing one account if
+ accounts could be found, or a message of error otherwise"""
+ # If home directory does not exist, warn and exit:
+ try:
+ os.stat(config.path)
+ except OSError:
+ ui.display("%s does not exist" % config.path)
+ return
+ tagmap = Account.TagMap(config.path + os.sep + 'tagmap')
+ for nickname in tagmap.getNicks():
+ a = Account.Account(config, nickname)
+ #TODO be more verbose?
+ ui.display("%s@%s" % (nickname, a['servername']))
+
def export(ui, config, nickname, output = None, args = []):
account = get_account_from_nickname(ui, config, nickname,
"No nickname given, abort\nUse -n <nickname>")
@@ -883,6 +899,18 @@
processMessage(nameo, config, ui, nick)
sys.exit(0)
+ if args[1] == "list-accounts":
+ #TODO give a verbosity option to this command?
+ #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()
+ list_accounts(ui, config)
+ sys.exit(0)
+
def minion_decode(input, output, passphrase):
(outr, outw) = os.pipe()
(passr, passw) = os.pipe()
Modified: trunk/nymbaron/TODO
===================================================================
--- trunk/nymbaron/TODO 2005-09-26 20:12:25 UTC (rev 311)
+++ trunk/nymbaron/TODO 2005-09-26 21:28:50 UTC (rev 312)
@@ -8,12 +8,12 @@
D Deferred
X Abandoned
- - add command to list accounts [client]
- add command to change keyring passphrase [client]
- use clean_surbs once in a while [server]
- periodically scan for emails that need to be relayed [server]
- periodically scan for synopses that have stayed that need to be encrypted
[server]
+ o add command to list accounts [client]
o use `email' lib to fiddle with an email to relay [server]
o provide a `list-journal' command and a way to resend commands [client]
More information about the Nym3-commit
mailing list