Hi all,

I believe I found a problem in our POP3 patch to c-client. The problem
is that, under some circonstances, the body of a message is not
retrieved from the server although it was never retrieved previously.

One solution is to simply add
  if (n > 0)
    LOCAL->hasbody = NIL;
in pop3_expunge after the loop over all messages.

The problem is the following. Consider you have two messages in your
POP3 server. You open the corresponding POP folder. The headers of the
first message are downloaded. The filtering decides to move this message
to another folder. Thus, the body is fetched, the message is appended to
the other folder, then the message is deleted from the POP folder, and
the latter is expunged (which triggers the 'DELE' message to the POP3
server).

What is the current situation? The POP folder has fetched the headers
and the body of a message that has msgno == 1. But this message has been
deleted and expunged. Thus, the msgno of the *second* message is not
2 but also 1 (its uid is still 2).

The problem is that the code we use to detect whether we already fetched
the body of a message reads (first line of pop3_cache):

  if (LOCAL->msgno != elt->msgno || !LOCAL->hasbody) {

The meaning of this test is: "if the message we want (elt->msgno) is not
the one we just dealt with (LOCAL->msgno), or we don't have the body",
then we fetch the body.

But if we just expunged some messages, this code is not correct as
LOCAL->msgno refers to the numbering of the messages *before* the
expunge, while elt->msgno refers to the numbering *after* the expunge.

One solution could perhaps be to deal with uids instead of msgno, as
uids do not change when messages are expunged. But I guess this is not
easy to change. The solution I found was to reset the 'LOCAL->hasbody'
when some messages are expunged.

I will try to use this setup for a day or two, and commit if I do not
have further problems.

-- 
Xavier Nodet
"They that can give up essential liberty to obtain a little temporary
safety deserve neither liberty nor safety." - Benjamin Franklin, 1759.




-------------------------------------------------------
This sf.net email is sponsored by:ThinkGeek
Welcome to geek heaven.
http://thinkgeek.com/sf
_______________________________________________
Mahogany-Developers mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/mahogany-developers

Reply via email to