Don't do an expunge Folder, thereby removing all mails in an imap folder,

when the deleteMessage method is called on a message that does not have
a UID, for whatever reason.

Ouch.

Now we need to find out why the message has no uid.

Ingo, backport, I assume?

CCMAIL: 74017@bugs.kde.org

svn path=/trunk/kdepim/; revision=284955
wilder-work
Till Adam 22 years ago
parent 0b45dbe675
commit eaf9f57298
  1. 17
      kmfolderimap.cpp

@ -1212,7 +1212,16 @@ void KMFolderImap::deleteMessage(KMMessage * msg)
{
KURL url = mAccount->getUrl();
KMFolderImap *msg_parent = static_cast<KMFolderImap*>(msg->storage());
url.setPath(msg_parent->imapPath() + ";UID=" + msg->headerField("X-UID"));
QString uid = msg->headerField("X-UID");
/* If the uid is empty the delete job below will nuke all mail in the
folder, so we better safeguard against that. See ::expungeFolder, as
to why. :( */
if ( uid.isEmpty() ) {
kdDebug( 5006 ) << "KMFolderImap::deleteMessage: Attempt to delete "
"an empty UID. Aborting." << endl;
return;
}
url.setPath(msg_parent->imapPath() + ";UID=" + uid );
if ( mAccount->makeConnection() != ImapAccountBase::Connected )
return;
KIO::SimpleJob *job = KIO::file_delete(url, FALSE);
@ -1233,7 +1242,11 @@ void KMFolderImap::deleteMessage(QPtrList<KMMessage> msgList)
KMFolderImap *msg_parent = static_cast<KMFolderImap*>(msgList.first()->storage());
for ( QStringList::Iterator it = sets.begin(); it != sets.end(); ++it )
{
url.setPath(msg_parent->imapPath() + ";UID=" + *it);
QString uid = *it;
// Don't delete with no uid, that nukes the folder. Should not happen, but
// better safe than sorry.
if ( uid.isEmpty() ) continue;
url.setPath(msg_parent->imapPath() + ";UID=" + uid);
if ( mAccount->makeConnection() != ImapAccountBase::Connected )
return;
KIO::SimpleJob *job = KIO::file_delete(url, FALSE);

Loading…
Cancel
Save