diff --git a/offlineimap/head/offlineimap/folder/IMAP.py b/offlineimap/head/offlineimap/folder/IMAP.py index 9456f1d..ed0dfdd 100644 --- a/offlineimap/head/offlineimap/folder/IMAP.py +++ b/offlineimap/head/offlineimap/folder/IMAP.py @@ -18,7 +18,7 @@ from Base import BaseFolder from offlineimap import imaputil, imaplib -import rfc822, time +import rfc822, time, string from StringIO import StringIO from copy import copy @@ -75,7 +75,7 @@ class IMAPFolder(BaseFolder): self.imapserver.releaseconnection(imapobj) for messagestr in response: # Discard the message number. - messagestr = imaputil.imapsplit(messagestr)[1] + messagestr = string.split(messagestr, maxsplit = 1)[1] options = imaputil.flags2hash(messagestr) uid = long(options['UID']) flags = imaputil.flagsimap2maildir(options['FLAGS']) diff --git a/offlineimap/head/offlineimap/folder/Maildir.py b/offlineimap/head/offlineimap/folder/Maildir.py index b028859..3450fd2 100644 --- a/offlineimap/head/offlineimap/folder/Maildir.py +++ b/offlineimap/head/offlineimap/folder/Maildir.py @@ -130,7 +130,7 @@ class MaildirFolder(BaseFolder): return self.messagelist def getmessage(self, uid): - filename = self.getmessagelist()[uid]['filename'] + filename = self.messagelist[uid]['filename'] file = open(filename, 'rt') retval = file.read() file.close() @@ -140,7 +140,7 @@ class MaildirFolder(BaseFolder): if uid < 0: # We cannot assign a new uid. return uid - if uid in self.getmessagelist(): + if uid in self.messagelist: # We already have it. self.savemessageflags(uid, flags) return uid @@ -180,10 +180,10 @@ class MaildirFolder(BaseFolder): return uid def getmessageflags(self, uid): - return self.getmessagelist()[uid]['flags'] + return self.messagelist[uid]['flags'] def savemessageflags(self, uid, flags): - oldfilename = self.getmessagelist()[uid]['filename'] + oldfilename = self.messagelist[uid]['filename'] newpath, newname = os.path.split(oldfilename) infostr = ':' infomatch = re.search('(:.*)$', newname) @@ -198,16 +198,13 @@ class MaildirFolder(BaseFolder): newfilename = os.path.join(newpath, newname) if (newfilename != oldfilename): os.rename(oldfilename, newfilename) - self.getmessagelist()[uid]['flags'] = flags - self.getmessagelist()[uid]['filename'] = newfilename - - def getmessageflags(self, uid): - return self.getmessagelist()[uid]['flags'] + self.messagelist[uid]['flags'] = flags + self.messagelist[uid]['filename'] = newfilename def deletemessage(self, uid): if not uid in self.messagelist: return - filename = self.getmessagelist()[uid]['filename'] + filename = self.messagelist[uid]['filename'] try: os.unlink(filename) except IOError: diff --git a/offlineimap/head/offlineimap/imaputil.py b/offlineimap/head/offlineimap/imaputil.py index 3dbf148..eca38c3 100644 --- a/offlineimap/head/offlineimap/imaputil.py +++ b/offlineimap/head/offlineimap/imaputil.py @@ -89,14 +89,14 @@ def imapsplit(imapstring): break return retval -def flagsimap2maildir(string): +def flagsimap2maildir(flagstring): flagmap = {'\\seen': 'S', '\\answered': 'R', '\\flagged': 'F', '\\deleted': 'T', '\\draft': 'D'} retval = [] - imapflaglist = [x.lower() for x in flagsplit(string)] + imapflaglist = [x.lower() for x in flagstring[1:-1].split()] for imapflag in imapflaglist: if flagmap.has_key(imapflag): retval.append(flagmap[imapflag])