accounts: minor refactoring

Signed-off-by: Nicolas Sebrecht <nicolas.s-dev@laposte.net>
This commit is contained in:
Nicolas Sebrecht 2016-11-08 07:07:11 +01:00
parent 01a744a0f8
commit 5eb131ef2b

View File

@ -433,7 +433,7 @@ def syncfolder(account, remotefolder, quick):
Filtered folders on the remote side will not invoke this function. However, Filtered folders on the remote side will not invoke this function. However,
this might be called in a concurrently.""" this might be called in a concurrently."""
def check_uid_validity(localfolder, remotefolder, statusfolder): def check_uid_validity():
# If either the local or the status folder has messages and # If either the local or the status folder has messages and
# there is a UID validity problem, warn and abort. If there are # there is a UID validity problem, warn and abort. If there are
# no messages, UW IMAPd loses UIDVALIDITY. But we don't really # no messages, UW IMAPd loses UIDVALIDITY. But we don't really
@ -558,14 +558,15 @@ def syncfolder(account, remotefolder, quick):
"with maxage or startdate; ignoring -q.") "with maxage or startdate; ignoring -q.")
if maxage != None: if maxage != None:
cachemessagelists_upto_date(maxage) cachemessagelists_upto_date(maxage)
check_uid_validity()
elif localstart != None: elif localstart != None:
cachemessagelists_startdate(remotefolder, localfolder, cachemessagelists_startdate(remotefolder, localfolder,
localstart) localstart)
check_uid_validity(localfolder, remotefolder, statusfolder) check_uid_validity()
elif remotestart != None: elif remotestart != None:
cachemessagelists_startdate(localfolder, remotefolder, cachemessagelists_startdate(localfolder, remotefolder,
remotestart) remotestart)
check_uid_validity(localfolder, remotefolder, statusfolder) check_uid_validity()
else: else:
localfolder.cachemessagelist() localfolder.cachemessagelist()
if quick: if quick:
@ -574,7 +575,7 @@ def syncfolder(account, remotefolder, quick):
ui.skippingfolder(remotefolder) ui.skippingfolder(remotefolder)
localrepos.restore_atime() localrepos.restore_atime()
return return
check_uid_validity(localfolder, remotefolder, statusfolder) check_uid_validity()
remotefolder.cachemessagelist() remotefolder.cachemessagelist()
# Synchronize remote changes. # Synchronize remote changes.