/head: changeset 23

Fixed savemessage uid support
This commit is contained in:
jgoerzen 2002-06-21 02:03:30 +01:00
parent e12b9771ea
commit 3aa11b5aec

View File

@ -96,9 +96,12 @@ class MaildirFolder(BaseFolder):
return retval return retval
def savemessage(self, uid, content): def savemessage(self, uid, content):
if uid < 0:
# We cannot assign a new uid.
return uid
if uid in self.getmessagelist(): if uid in self.getmessagelist():
# We already have it. # We already have it.
return return uid
newdir = os.path.join(self.getfullname(), 'new') newdir = os.path.join(self.getfullname(), 'new')
tmpdir = os.path.join(self.getfullname(), 'tmp') tmpdir = os.path.join(self.getfullname(), 'tmp')
messagename = None messagename = None
@ -124,7 +127,7 @@ class MaildirFolder(BaseFolder):
os.unlink(os.path.join(tmpdir, messagename)) os.unlink(os.path.join(tmpdir, messagename))
self.messagelist[uid] = {'uid': uid, 'flags': [], self.messagelist[uid] = {'uid': uid, 'flags': [],
'filename': os.path.join(newdir, messagename)} 'filename': os.path.join(newdir, messagename)}
return uid
def getmessageflags(self, uid): def getmessageflags(self, uid):
return self.getmessagelist()[uid]['flags'] return self.getmessagelist()[uid]['flags']