/head: changeset 13

Checkpointing
This commit is contained in:
jgoerzen 2002-06-20 05:14:54 +01:00
parent 2701b3f054
commit e760d9facb
2 changed files with 19 additions and 7 deletions

View File

@ -84,16 +84,22 @@ class BaseFolder:
for uid in self.getmessagelist().keys():
if not uid in dest.getmessagelist():
dest.savemessage(uid, self.getmessage(uid))
dest.savemessageflags(uid, self.getmessageflags(uid))
message = self.getmessage(uid)
flags = self.getmessageflags(uid)
for object in applyto:
object.savemessage(uid, message)
object.savemessageflags(uid, flags)
# Pass 2 -- Look for message present in dest but not in self.
# If any, delete them.
for uid in dest.getmessagelist().keys():
if not uid in self.getmessagelist():
dest.deletemessage(uid)
for object in applyto:
object.deletemessage(uid)
# Now, the message lists should be identical wrt the uids present.
# Pass 3 -- Look for any
# Pass 3 -- Look for any flag identity issues.

View File

@ -58,13 +58,21 @@ class MaildirFolder(BaseFolder):
and must occur in ASCII order."""
self.messagelist = {}
files = []
nouidcounter = -1 # Messages without UIDs get
# negative UID numbers.
for dirannex in ['new', 'cur']:
fulldirname = os.path.join(self.getfullname(), dirannex)
files.append([os.path.join(fulldirname, filename) for
filename in os.listdir(fulldirname)])
for file in files:
messagename = os.path.basename(file)
uid = int(re.search(',U=(\d+)', messagename).group(1))
uidmatch = re.search(',U=(\d+)', messagename)
uid = None
if not uidmatch:
uid = nouidcounter
nouidcounter -= 1
else:
uid = int(uidmatch.group(1))
flagmatch = re.search(':.*2,([A-Z]+)')
flags = []
if flagmatch:
@ -74,8 +82,6 @@ class MaildirFolder(BaseFolder):
'filename': messagename}
def getmessagelist(self):
if self.messagelist == None:
self.cachemessagelist()
return self.messagelist