From kmail-devel Wed Feb 04 08:26:11 2004 From: Till Adam Date: Wed, 04 Feb 2004 08:26:11 +0000 To: kmail-devel Subject: [Bug 74017] grave imap bug : All messages of inbox lost Message-Id: <20040204082611.31045.qmail () ktown ! kde ! org> X-MARC-Message: https://marc.info/?l=kmail-devel&m=107588324105748 ------- You are receiving this mail because: ------- You are the assignee for the bug, or are watching the assignee. http://bugs.kde.org/show_bug.cgi?id=74017 ------- Additional Comments From adam@kde.org 2004-02-04 09:26 ------- Subject: kdepim/kmail CVS commit by tilladam: 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 M +15 -2 kmfolderimap.cpp 1.170 --- kdepim/kmail/kmfolderimap.cpp #1.169:1.170 @@ -1213,5 +1213,14 @@ void KMFolderImap::deleteMessage(KMMessa KURL url = mAccount->getUrl(); KMFolderImap *msg_parent = static_cast(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; @@ -1234,5 +1243,9 @@ void KMFolderImap::deleteMessage(QPtrLis 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; _______________________________________________ KMail developers mailing list KMail-devel@kde.org https://mail.kde.org/mailman/listinfo/kmail-devel