As mentioned in a previous post, I found that if you POPed a mailbox and
kept messages on server, any subsequent imap sessions showed the message
state as unread. 

Here's a quick fix (sorry not a patchfile):

In dbmysql, function db_update_pop replace:

      snprintf (query,DEF_QUERYSIZE,
            "UPDATE messages set status=%llu WHERE message_idnr=%llu AND
status<002",
           ((struct message *)tmpelement->data)->virtual_messagestatus,
           ((struct message *)tmpelement->data)->realmessageid);
 
With

      snprintf (query,DEF_QUERYSIZE,
            "UPDATE messages set seen_flag=if(%llu=1, 1, seen_flag),
status=%llu WHERE message_idnr=%llu AND status<002",
           ((struct message *)tmpelement->data)->virtual_messagestatus,
           ((struct message *)tmpelement->data)->virtual_messagestatus,
           ((struct message *)tmpelement->data)->realmessageid);


Works for me and should keep the imap state intact if POP doesn't change it,
but I don't think that really should be an issue anyway. The 'better' way to
do it is probably to just use the state column to determine read/unread in
the Imap client, but I didn't want do go and hack away at that if the rfc
called for something else...

/Mark

Reply via email to