Bug 60882 - Mark (All) Message(s) as Read etc. doesn't flag messages as on the IMAP server
Summary: Mark (All) Message(s) as Read etc. doesn't flag messages as on the IMAP server
Status: RESOLVED FIXED
Alias: None
Product: kmail
Classification: Applications
Component: general (show other bugs)
Version: unspecified
Platform: unspecified Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2003-07-07 16:58 UTC by Malte Starostik
Modified: 2007-09-14 12:17 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Malte Starostik 2003-07-07 16:58:30 UTC
Version:           1.5.9 (using KDE 3.1.9)
Compiler:          gcc version 3.2 (Mandrake Linux 9.0 3.2-1mdk)
OS:          Linux (i686) release 2.4.19-16mdk

In an IMAP folder with some unread messages, marking some or all messages flags them locally, but doesn't tell the server to do so as well.
In case of "Mark All Messages as Read" this results in a non-zero unread count in the folder list (or manual STATUS "..." (UNSEEN)) while all messages appear as read in the message list.
I haven't found a way to fix this desynced unread count except by manually executing a UID STORE 1:* +FLAGS (\Seen) in the affected mailbox.
Here's an example capture:

46603 SELECT "INBOX.kde.kmail"
* FLAGS (\Answered \Flagged \Deleted \Seen \Recent)
* OK [PERMANENTFLAGS (\Answered \Flagged \Deleted \Seen)] Limited
* 16 EXISTS
* 1 RECENT
* OK [UIDVALIDITY 1044165059] Ok
46603 OK [READ-WRITE] Ok
46604 UID FETCH 4400 (UID RFC822)
* 15 FETCH (UID 4400 RFC822 {3043}
Return-Path: <kmail-bounces-+malte=kde.org@mail.kde.org>
[snip]
46604 OK FETCH completed.
46605 NOOP
46605 OK NOOP completed
46606 NOOP
46606 OK NOOP completed
46607 NOOP
46607 OK NOOP completed
46608 UID FETCH 4401:* (UID ENVELOPE BODY.PEEK[HEADER.FIELDS (REFERENCES)] RFC822.SIZE INTERNALDATE FLAGS)
* 16 FETCH (UID 4401 ENVELOPE ("7 Jul 2003 14:42:21 -0000" "[Bug 50034] Message not marked as read if it's the only on in a	folder" (("Malte Starostik" NIL "malte" "kde.org")) (("kmail-bounces-+malte=kde.org@mail.kde.org" NIL "kmail-bounces-+malte=kde.org" "mail.kde.org")) (("kmail@kde.org" NIL "kmail" "kde.org")("50034@bugs.kde.org" NIL "50034" "bugs.kde.org")) (("kmail@kde.org" NIL "kmail" "kde.org")) NIL NIL NIL "<20030707144221.25120.qmail@ktown.kde.org>") BODY[HEADER.FIELDS ("REFERENCES")] {2}

 RFC822.SIZE 2743 INTERNALDATE "07-Jul-2003 16:44:18 +0200" FLAGS (\Recent))
46608 OK FETCH completed.
[now I clicked Mark All Messages as read so the above mail was marked read locally. nothing sent to the server]
46609 LIST "" "INBOX"
* LIST (\Unmarked \HasChildren) "." "INBOX"
46609 OK LIST completed
46610 SELECT "INBOX"
* FLAGS (\Answered \Flagged \Deleted \Seen \Recent)
* OK [PERMANENTFLAGS (\Answered \Flagged \Deleted \Seen)] Limited
* 2050 EXISTS
* 0 RECENT
* OK [UIDVALIDITY 1018735726] Ok
46610 OK [READ-WRITE] Ok

Regards,
-Malte
Comment 1 Malte Starostik 2003-07-07 17:02:47 UTC
Well, of course there is a workaround to "fix" such a mailbox. Had to write this report to 
think of it: Once those messages are actually fetched, the server marks them as such. 
Comment 2 Till Adam 2003-07-07 23:22:06 UTC
Subject: kdepim/kmail

CVS commit by tilladam: 

Make sure setStatus has the same signature in kmfolderimap as in kmfolder.
That way overloading actually works. :) Thanks Malte, for noticing this
one.

CCMAIL: 60882-done@bugs.kde.org


  M +4 -5      kmfolderimap.cpp   1.116
  M +2 -2      kmfolderimap.h   1.48


--- kdepim/kmail/kmfolderimap.cpp  #1.115:1.116
@@ -1143,13 +1143,13 @@ void KMFolderImap::deleteMessage(QPtrLis
 
 //-----------------------------------------------------------------------------
-void KMFolderImap::setStatus(int idx, KMMsgStatus status)
+void KMFolderImap::setStatus(int idx, KMMsgStatus status, bool toggle)
 {
   QValueList<int> ids; ids.append(idx);
-  setStatus(ids, status);
+  setStatus(ids, status, toggle);
 }
 
-void KMFolderImap::setStatus(QValueList<int>& ids, KMMsgStatus status)
+void KMFolderImap::setStatus(QValueList<int>& ids, KMMsgStatus status, bool toggle)
 {
-  KMFolder::setStatus(ids, status);
+  KMFolder::setStatus(ids, status, toggle);
   if (mReadOnly) return;
 

--- kdepim/kmail/kmfolderimap.h  #1.47:1.48
@@ -156,10 +156,10 @@ public:
    * Overloaded function for the following one
    */
-  virtual void setStatus(int idx, KMMsgStatus status);
+  virtual void setStatus(int idx, KMMsgStatus status, bool toggle);
 
   /**
    * Change the status of several messages indicated by @p ids
    */
-  virtual void setStatus(QValueList<int>& ids, KMMsgStatus status);
+  virtual void setStatus(QValueList<int>& ids, KMMsgStatus status, bool toggle);
 
   /** Helper method to set the status on the server */