Merge branch 'ss/maildir-quickchanged-cleanup' into next

This commit is contained in:
Nicolas Sebrecht 2011-04-15 19:52:35 +02:00
commit bf1c9e3233

View File

@ -162,16 +162,17 @@ class MaildirFolder(BaseFolder):
return retval return retval
def quickchanged(self, statusfolder): def quickchanged(self, statusfolder):
"""Returns True if the Maildir has changed"""
self.cachemessagelist() self.cachemessagelist()
savedmessages = statusfolder.getmessagelist() # Folder has different uids than statusfolder => TRUE
if len(self.messagelist) != len(savedmessages): if sorted(self.getmessageuidlist()) != \
sorted(statusfolder.getmessageuidlist()):
return True return True
for uid in self.messagelist.keys(): # Also check for flag changes, it's quick on a Maildir
if uid not in savedmessages: for (uid, message) in self.getmessagelist().iteritems():
if message['flags'] != statusfolder.getmessageflags(uid):
return True return True
if self.messagelist[uid]['flags'] != savedmessages[uid]['flags']: return False #Nope, nothing changed
return True
return False
def cachemessagelist(self): def cachemessagelist(self):
if self.messagelist is None: if self.messagelist is None: