File bko354056.diff of Package kdepim-runtime.openSUSE_Leap_42.1_Update

From: Daniel Vrátil <dvratil@kde.org>
Date: Mon, 21 Mar 2016 22:27:09 +0000
Subject: IMAP: handle deprecated Delete right when checking ACL before expunge
X-Git-Tag: v16.03.80
X-Git-Url: http://quickgit.kde.org/?p=kdepim-runtime.git&a=commitdiff&h=6f2026f657ba7b68b4022ca969b3b6ff052609d1
---
IMAP: handle deprecated Delete right when checking ACL before expunge

Due to ambiguity in RFC 2086 the new RFC 4314 introduced two virtual
rights, one of them being "d" (delete). When "d" right is present,
presence of "e", "t" and "x" rights must be assumed by the clients.

Courier IMAP server uses this virtual rights but does not explicitly list
the "e" (expunge) right like most other servers, which caused RetrieveItemsTask
to not trigger EXPUNGE before syncing the mailbox.

BUG: 354056
FIXED-IN: 16.04.0
---


--- a/resources/imap/retrieveitemstask.cpp
+++ b/resources/imap/retrieveitemstask.cpp
@@ -161,8 +161,9 @@
     m_time.start();
 
     // Now is the right time to expunge the messages marked \\Deleted from this mailbox.
-    // We assume that we can only expunge if we can delete items (correct would be to check for "e" ACL right).
-    if (isAutomaticExpungeEnabled() && (!serverCapabilities().contains(QStringLiteral("ACL")) || (myRights(collection()) & KIMAP::Acl::Expunge))) {
+    const bool hasACL = serverCapabilities().contains(QStringLiteral("ACL"));
+    const KIMAP::Acl::Rights rights = myRights(collection());
+    if (isAutomaticExpungeEnabled() && (!hasACL || (rights & KIMAP::Acl::Expunge) || (rights & KIMAP::Acl::Delete))) {
         if (m_session->selectedMailBox() != mailBox) {
             triggerPreExpungeSelect(mailBox);
         } else {

openSUSE Build Service is sponsored by