[PATCH 2/2] Replace calls to getmessagelist() to alternatives
Sebastian Spaeth
Sebastian at SSpaeth.de
Mon Mar 28 15:19:20 BST 2011
getmessagelist() is slow for the mapped UID case, so replace some of its
occurences with calls that are optimized for this case, ie
getmessagecount() and uidexists().
Signed-off-by: Sebastian Spaeth <Sebastian at SSpaeth.de>
---
offlineimap/folder/Base.py | 2 +-
offlineimap/folder/IMAP.py | 6 +++---
2 files changed, 4 insertions(+), 4 deletions(-)
diff --git a/offlineimap/folder/Base.py b/offlineimap/folder/Base.py
index fd8496e..ad11158 100644
--- a/offlineimap/folder/Base.py
+++ b/offlineimap/folder/Base.py
@@ -318,7 +318,7 @@ class BaseFolder:
flags = self.getmessageflags(uid)
rtime = self.getmessagetime(uid)
- if uid in dstfolder.getmessagelist():
+ if dstfolder.uidexists(uid):
# dst has message with that UID already, only update status
statusfolder.savemessage(uid, None, flags, rtime)
return
diff --git a/offlineimap/folder/IMAP.py b/offlineimap/folder/IMAP.py
index 828070c..ec8eb79 100644
--- a/offlineimap/folder/IMAP.py
+++ b/offlineimap/folder/IMAP.py
@@ -94,7 +94,7 @@ class IMAPFolder(BaseFolder):
maxmsgid = max(long(msgid), maxmsgid)
# Different number of messages than last time?
- if maxmsgid != len(statusfolder.getmessagelist()):
+ if maxmsgid != statusfolder.getmessagecount():
return True
if maxmsgid < 1:
@@ -112,7 +112,7 @@ class IMAPFolder(BaseFolder):
if not options.has_key('UID'):
return True
uid = long(options['UID'])
- saveduids = statusfolder.getmessagelist().keys()
+ saveduids = statusfolder.getmessageuidlist()
saveduids.sort()
if uid != saveduids[-1]:
return True
@@ -395,7 +395,7 @@ class IMAPFolder(BaseFolder):
self.ui.debug('imap', 'savemessage: called')
# already have it, just save modified flags
- if uid > 0 and uid in self.messagelist:
+ if uid > 0 and self.uidexists(uid):
self.savemessageflags(uid, flags)
return uid
--
1.7.1
More information about the OfflineIMAP-project
mailing list