/head: changeset 27

Updated.
This commit is contained in:
jgoerzen 2002-06-21 03:02:36 +01:00
parent 6e5817986b
commit d2ac4a0984

View File

@ -113,7 +113,9 @@ class BaseFolder:
"""Syncs messages in this folder to the destination. """Syncs messages in this folder to the destination.
If applyto is specified, it should be a list of folders (don't forget If applyto is specified, it should be a list of folders (don't forget
to include dest!) to which all write actions should be applied. to include dest!) to which all write actions should be applied.
It defaults to [dest] if not specified.""" It defaults to [dest] if not specified. It is important that
the UID generator be listed first in applyto; that is, the other
applyto ones should be the ones that "copy" the main action."""
if applyto == None: if applyto == None:
applyto = [dest] applyto = [dest]
@ -145,7 +147,7 @@ class BaseFolder:
self.savemessage(successuid, message, flags) self.savemessage(successuid, message, flags)
self.deletemessage(uid) self.deletemessage(uid)
else: else:
# Did not find any server to take this message. Delete # Did not find any server to take this message. Ignore.
pass pass
# Pass 2 -- Look for messages present in self but not in dest. # Pass 2 -- Look for messages present in self but not in dest.
@ -158,13 +160,19 @@ class BaseFolder:
message = self.getmessage(uid) message = self.getmessage(uid)
flags = self.getmessageflags(uid) flags = self.getmessageflags(uid)
for object in applyto: for object in applyto:
object.savemessage(uid, message) newuid = object.savemessage(uid, message, flags)
object.savemessageflags(uid, flags) if newuid != uid:
# Change the local uid.
self.savemessage(newuid, message, flags)
self.deletemessage(uid)
uid = newuid
# Pass 3 -- Look for message present in dest but not in self. # Pass 3 -- Look for message present in dest but not in self.
# If any, delete them. # If any, delete them.
for uid in dest.getmessagelist().keys(): for uid in dest.getmessagelist().keys():
if uid < 0:
continue
if not uid in self.getmessagelist(): if not uid in self.getmessagelist():
for object in applyto: for object in applyto:
object.deletemessage(uid) object.deletemessage(uid)