Message duplication
Sebastian Spaeth
Sebastian at SSpaeth.de
Fri Jun 24 10:26:57 BST 2011
On Fri, 24 Jun 2011 01:42:25 +0200, Vincent Beffara <vbeffara at ens-lyon.fr> wrote:
> f408198 Prettify and use new uidexists() helper function
I looked a bit deeper at this, and the MappedIMAPFOlder class is really
weird and interacts in delicate ways that could perhaps indeed
break. This is what we do:
class MappedIMAPFolder initializes itself using the IMAPFolder.__init__
method and sets self._mb to the IMAPFolder *class*.
Whenever it accesses local UIDs it then calls eg:
self._mb.cachemessages(self), so it invokes the IMAPFolder method
cachemessages, but passes it an instance of type MappedIMAPFolder as
"self".
ALready got head ache? So when the IMAPFolder method cachemessages (or
deletemessage as in the "Prettify" commit happens) invokes
"self.uidexists()", 'self' is an instance MappedIMAPFOlder and uidexists
will invoke the MappedIMAPFolder.uidexists() method which takes the
REMOTE UID as uid, (but self.messagelist was referring to local UIDs).
So I can see how this seemingless innocent change could indeed lead to a
different behavior. To be honest, and code that requires such intensive
studying and care is broken by design, and that I know that the
MappedIMAP case needs love anyway (I've always procrastinated this task
as I don't use it myself and found the code scary). Perhaps now is the
time to start doing something about it. I will be sending a first patch
that logically splits the MappedIMAPFolder and IMAPFolder into 2
distinct objects by making self._mb an actual instance of type
IMAPFolder and not invoking IMAPFolder methods and passing in
MappedIMAPFolder instances as 'self'.
Vincent, perhaps you would like to try this patch to see if it changes
behavior already. In any case the MappedIMAP use needs a lot more love
and if there are champions for it, I wouldn't mind. Did I mention already
that I am NOT using it myself? :-)
Sebastian
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: not available
URL: <http://alioth-lists.debian.net/pipermail/offlineimap-project/attachments/20110624/d367741f/attachment-0001.sig>
More information about the OfflineIMAP-project
mailing list