From d2dbe2c54410579cfc55640b697f5331002f45b1 Mon Sep 17 00:00:00 2001 From: Nicolas Sebrecht Date: Fri, 8 Jul 2016 16:30:50 +0200 Subject: [PATCH] mbnames: enable action at correct time Signed-off-by: Nicolas Sebrecht --- offlineimap/init.py | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/offlineimap/init.py b/offlineimap/init.py index 5723c8e..d39b867 100644 --- a/offlineimap/init.py +++ b/offlineimap/init.py @@ -73,6 +73,10 @@ class OfflineImap(object): self.__serverdiagnostics(options) elif options.migrate_fmd5: self.__migratefmd5(options) + elif options.mbnames_prune: + mbnames.init(self.config, self.ui, options.dryrun) + mbnames.prune(self.config.get("general", "accounts")) + mbnames.write() else: return self.__sync(options) @@ -237,8 +241,8 @@ class OfflineImap(object): # Create the ui class. self.ui = UI_LIST[ui_type.lower()](config) except KeyError: - logging.error("UI '%s' does not exist, choose one of: %s"% \ - (ui_type, ', '.join(UI_LIST.keys()))) + logging.error("UI '%s' does not exist, choose one of: %s"% + (ui_type, ', '.join(UI_LIST.keys()))) sys.exit(1) setglobalui(self.ui) @@ -270,12 +274,6 @@ class OfflineImap(object): if dtype.lower() == u'imap': imaplib.Debug = 5 - if options.mbnames_prune: - mbnames.init(config, self.ui, options.dryrun) - mbnames.prune(config.get("general", "accounts")) - mbnames.write() - sys.exit(0) - if options.runonce: # Must kill the possible default option. if config.has_option('DEFAULT', 'autorefresh'): @@ -314,10 +312,8 @@ class OfflineImap(object): ) for reposname in config.getsectionlist('Repository'): - # XXX: We are likely lying around. If we must use at most n - # connections for a remote IMAP server, why do we allow twice this - # number? The max connections number is used by both the FOLDER_ and - # the MSGCOPY_ prefixes! + # Limit the number of threads. Limitation on usage is handled at the + # imapserver level. for namespace in [accounts.FOLDER_NAMESPACE + reposname, MSGCOPY_NAMESPACE + reposname]: if options.singlethreading: