Browse IMAP folders in service discovery

darcs-hash:20071022182523-86b55-444ef63ae52e5a0f274a1ab3bea89d9fc91ae1fb.gz
This commit is contained in:
David Rousselie
2007-10-22 20:25:23 +02:00
parent 95564d826e
commit 98510aa128
4 changed files with 108 additions and 21 deletions

View File

@@ -110,20 +110,17 @@ class IMAPAccountDiscoGetItemsHandler(DiscoHandler):
if account_class is not None and _account is not None:
disco_items = DiscoItems()
if imap_dir is None:
# TODO : test if INBOX really exist, is it possible to retrieve default dir from IMAP ?
imap_dir = ""
subdirs = _account.ls_dir(imap_dir)
if imap_dir != "":
imap_dir += "/"
for subdir in subdirs:
DiscoItem(disco_items,
JID(unicode(_account.jid) + "/" + account_type
+ "/INBOX"),
account_type + "/" + account_name + "/INBOX",
"INBOX")
else:
for subdir in _account.ls_dir(imap_dir):
DiscoItem(disco_items,
JID(unicode(_account.jid) + "/" + account_type + \
"/" + imap_dir + "/" + subdir),
account_type + "/" + account_name + "/" + imap_dir
+ "/" + subdir,
subdir)
JID(unicode(_account.jid) + "/" + account_type + \
"/" + imap_dir + subdir),
account_type + "/" + account_name + "/" + imap_dir
+ subdir,
subdir)
return [disco_items]
return []
# TODO : implement get_info on imap_Dir