mbnames: enable action at correct time

Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
Nicolas Sebrecht 2016-07-08 16:30:50 +02:00
parent 175479d919
commit d2dbe2c544

View File

@ -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,7 +241,7 @@ 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"% \
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: