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) self.__serverdiagnostics(options)
elif options.migrate_fmd5: elif options.migrate_fmd5:
self.__migratefmd5(options) 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: else:
return self.__sync(options) return self.__sync(options)
@ -237,7 +241,7 @@ class OfflineImap(object):
# Create the ui class. # Create the ui class.
self.ui = UI_LIST[ui_type.lower()](config) self.ui = UI_LIST[ui_type.lower()](config)
except KeyError: 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()))) (ui_type, ', '.join(UI_LIST.keys())))
sys.exit(1) sys.exit(1)
setglobalui(self.ui) setglobalui(self.ui)
@ -270,12 +274,6 @@ class OfflineImap(object):
if dtype.lower() == u'imap': if dtype.lower() == u'imap':
imaplib.Debug = 5 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: if options.runonce:
# Must kill the possible default option. # Must kill the possible default option.
if config.has_option('DEFAULT', 'autorefresh'): if config.has_option('DEFAULT', 'autorefresh'):
@ -314,10 +312,8 @@ class OfflineImap(object):
) )
for reposname in config.getsectionlist('Repository'): for reposname in config.getsectionlist('Repository'):
# XXX: We are likely lying around. If we must use at most n # Limit the number of threads. Limitation on usage is handled at the
# connections for a remote IMAP server, why do we allow twice this # imapserver level.
# number? The max connections number is used by both the FOLDER_ and
# the MSGCOPY_ prefixes!
for namespace in [accounts.FOLDER_NAMESPACE + reposname, for namespace in [accounts.FOLDER_NAMESPACE + reposname,
MSGCOPY_NAMESPACE + reposname]: MSGCOPY_NAMESPACE + reposname]:
if options.singlethreading: if options.singlethreading: