New option to only work with subscribed folders

Patch from Sean Finney, slightly modified by John Goerzen to change
name of config file option

fixes deb#499588
This commit is contained in:
John Goerzen 2008-10-01 00:33:57 -05:00
parent 936fe1f43e
commit d69176090c
2 changed files with 10 additions and 1 deletions

View File

@ -212,6 +212,10 @@ type = Maildir
localfolders = ~/Test
# Specify whether to process all mail folders on the server, or only
# those listed as "subscribed".
subscribedonly = no
# You can specify the "path separator character" used for your Maildir
# folders. This is inserted in-between the components of the tree.
# It defaults to ".". If you want your Maildir folders to be nested,

View File

@ -192,8 +192,13 @@ class IMAPRepository(BaseRepository):
return self.folders
retval = []
imapobj = self.imapserver.acquireconnection()
# check whether to list all folders, or subscribed only
listfunction = imapobj.list
if self.config.has_option(self.getsection(), 'subscribedonly'):
if self.getconf('subscribedonly') == "yes":
listfunction = imapobj.lsub
try:
listresult = imapobj.list(directory = self.imapserver.reference)[1]
listresult = listfunction(directory = self.imapserver.reference)[1]
finally:
self.imapserver.releaseconnection(imapobj)
for string in listresult: