Bug 160263

Summary: KMail does parse LIST responses where the INBOX is not first correctly
Product: [Frameworks and Libraries] kio Reporter: Ladar Levison <ladar>
Component: imapAssignee: kdepim bugs <kdepim-bugs>
Status: RESOLVED FIXED    
Severity: normal CC: bjoern
Priority: NOR    
Version: unspecified   
Target Milestone: ---   
Platform: Ubuntu   
OS: Linux   
Latest Commit: Version Fixed In:

Description Ladar Levison 2008-04-02 16:12:00 UTC
Version:            (using KDE 3.5.8)
Installed from:    Ubuntu Packages
OS:                Linux

When processing the response to the command:

10 LIST "" "%"

KMail requires that the Inbox be listed first. However technically speaking, the folders, including the Inbox can be listed in any order. This causes very weird behavior. Here is a sample response:

* LIST () "." "Cocoa"
* LIST () "." "Drafts"
* LIST (\Noinferiors) "." "Inbox"
* LIST () "." "One"
* LIST () "." "Sent"
* LIST () "." "Special"
* LIST () "." "Spoofed"
* LIST () "." "Trash"
10 OK LIST Complete.

If this is the response, KMail will store the name of the Drafts folder as INBOX. As a result, on a subsequent login the commands will look like:

3 STATUS "Cocoa" (UNSEEN)
4 STATUS "INBOX" (UNSEEN)
5 STATUS "INBOX" (UNSEEN)
6 STATUS "One" (UNSEEN)
7 STATUS "One.Two" (UNSEEN)
8 STATUS "One.Two.Three" (UNSEEN)
9 STATUS "Sent" (UNSEEN)
10 STATUS "Special" (UNSEEN)
11 STATUS "Spoofed" (UNSEEN)
12 STATUS "Trash" (UNSEEN)
13 LIST "" "%"
14 LIST "" "Cocoa.%"
15 LIST "" "Drafts.%"
16 LIST "" "One.%"
17 LIST "" "Sent.%"
18 LIST "" "Special.%"
19 LIST "" "Spoofed.%"
20 LIST "" "Trash.%"
21 LIST "" "One.Two.%"
22 LIST "" "One.Two.Three.%"

Note how the status for the folder INBOX is requested twice (commands 4 & 5). Furthermore, if the user were to select the Drafts folder, the inbox will actually be selected, resulting in all of the messages in the inbox folder appearing in the drafts folder. 

On a side note, KMail does not appear to parse the folder flags insensitive to case. So, for example, KMail will detect \Noinferiors, it will NOT detect \NoInferiors. If memory serves this causes a serious issue with LIST "" "", if the flag returned is \NoSelect.
Comment 1 Ladar Levison 2008-04-02 16:13:55 UTC
I should note this is with KMail version 1.9.6
Comment 2 Björn Ruberg 2010-01-16 23:25:37 UTC
Does this problem still occur in a recent kmail version?
Comment 3 Ladar Levison 2010-01-17 06:48:51 UTC
Appears to have been fixed, when testing with Fedora 12:

Qt: 4.5.3
KDE: 4.3.4 (KDE 4.3.4)
KMail: 1.12.4