CVS commit by kloecker: Fix bug 78794 (kmail deletes my email and does not download from pop3). This bug is caused by the non-uniqueness of the UIDs on hotpop.com (this broken POP server obviously re-uses UIDs) in combination with wrong handling of the UIDs of seen messages in KMail. So the following fixes the wrong handling of the UIDs of seen messages and thus makes KMail work even with broken POP servers that re-use UIDs. The general idea is to only remember the UIDs of messages which actually remain on the server. Changes in kmacctexppop.h: - processRemainingQueuedMessagesAndSaveUidList() is split into processRemainingQueuedMessages() and saveUidList(). - QStringList mUidsOfSeenMsgs is removed because it's no longer necessary. - QStringList uidsOfNextSeenMsgs is replaced by QDict mUidsOfNextSeenMsgsDict because we need to remove elements from this list/set in random order. Changes in kmacctexppop.cpp (hunk by hunk): - mUidsOfNextSeenMsgsDict must not auto-delete the fake pointers we use as values - call processRemainingQueuedMessages() and saveUidList() instead of processRemainingQueuedMessagesAndSaveUidList() - instead of the member variable mUidsOfSeenMsgs we use a temporary variable to initialize mUidsOfSeenMsgsDict (the set of old seen messages) - clear mUidsOfNextSeenMsgsDict - call processRemainingQueuedMessages() and saveUidList() instead of processRemainingQueuedMessagesAndSaveUidList() - mUidsOfNextSeenMsgsDict.insert UID instead of uidsOfNextSeenMsgs.append - less debug - resize mUidsOfNextSeenMsgsDict to a reasonable size (number of messages on the server + 10% since it's a hash) - only apply the workaround for servers which don't support the UIDL command; otherwise UIDs of messages which are no longer on the server might be added to the set of unseen messages for the next check and this will result in not downloading messages with re-used UIDs - don't remove anything from the mUidForIdMap (id -> uid map) because we'll also need this map for messages which are not downloaded - mUidsOfNextSeenMsgsDict.insert UID instead of uidsOfNextSeenMsgs.append - call only processRemainingQueuedMessages() instead of processRemainingQueuedMessagesAndSaveUidList(); the uid list will be saved after the Quit stage has finished (because it has to be saved after the deletion of messages from the server) - explicitely set stage to Quit (not really necessary because it's already set in processRemainingQueuedMessages() but it's better readable) - don't clear the list of ids of deleted messages now - after deletion is finished remove the UIDs of all messages which have been deleted from the set of UIDs of seen messages; this is important to make KMail work with broken POP servers, but it anyway doesn't made sense to remember the UIDs of messages which have been deleted; so this is correct behavior in any case - now we can clear the list of ids of deleted messages - now we can call saveUidList() to save the list of UIDs of seen messages - split processRemainingQueuedMessagesAndSaveUidList() into processRemainingQueuedMessages() and saveUidList(); saving is now a bit more complicated because we have to create a comma separated list from the set of UIDs of seen messages (Why is there no QStringList QDict::keys()?) - mUidsOfNextSeenMsgsDict.insert UID instead of uidsOfNextSeenMsgs.append and insert all (id,uid) pairs into mUidForIdMap instead of only some of them (because we'll need all of them) M +47 -26 kmacctexppop.cpp 1.164 M +8 -5 kmacctexppop.h 1.46