Last Comment Bug 156347 - Mozilla does not set or recognize the \Draft flag on IMAP messages
: Mozilla does not set or recognize the \Draft flag on IMAP messages
Status: RESOLVED FIXED
: fixed1.8.1, imap-interop, polish
Product: MailNews Core
Classification: Components
Component: Networking: IMAP (show other bugs)
: Trunk
: x86 Windows 2000
: -- normal with 31 votes (vote)
: ---
Assigned To: David :Bienvenu
: grylchan
Mentors:
: 253255 (view as bug list)
Depends on: 81340
Blocks: 360390
  Show dependency treegraph
 
Reported: 2002-07-08 14:38 PDT by Michael Dewberry
Modified: 2009-01-22 10:17 PST (History)
7 users (show)
See Also:
Crash Signature:
(edit)
QA Whiteboard:
Iteration: ---
Points: ---


Attachments
Unified diff for propose solution to but 156347 (726 bytes, patch)
2006-10-23 22:16 PDT, Greg Haverkamp
no flags Details | Diff | Splinter Review
Greg's patch (1.16 KB, patch)
2006-10-25 15:57 PDT, David :Bienvenu
mozilla: superreview+
Details | Diff | Splinter Review

Description Michael Dewberry 2002-07-08 14:38:49 PDT
MailNews does not appear to set the "Draft" IMAP flag (defined in section 2.3.2 
of RFC 2060 - IMAP v4r1) on drafts saved to a folder on the IMAP server (or to 
a local folder.)

What I did:
1) Logged into my IMAP account with Mozilla Mail.
2) Composed a new message in Mozilla.  Saved it but did not send it.  Mozilla 
is configured to save drafts to INBOX\Drafts on the IMAP server.  Message 
successfully saved.
3) Logged into my IMAP account with Outlook Express.
4) Composed a new message in OE.  Saved it but did not send it.  OE saved draft 
to local folder, dragged it to INBOX\Drafts on server.
5) Logged into my IMAP account using Horde/IMP-based webmail client.
6) Composed a new message using IMP.  Saved it but did not send it.  IMP saved 
draft to INBOX\webmail-drafts.  Dragged it to INBOX\Drafts.

There are now three drafts in INBOX\Drafts.  The two drafts created by OE and 
IMP show the "draft" icon when the folder is viewed in IMP or OE.  Clicking on 
either message in IMP or OE will bring the message up in "compose" mode.

The draft created by Mozilla does not show the "draft" icon, and clicking on 
the message brings up the standard message display rather than the compose 
window.

Mozilla does not appear to respect the "draft" flag when it is set by other 
clients -- clicking any of the three messages in Mozilla brings up the message 
in the standard rather than the compose window.  You have to choose "Edit as 
New..." instead.

It would be nice if Mozilla went directly to the compose window when clicking 
messages flagged as drafts, but that's probably a separate bug.
Comment 1 Michael Dewberry 2002-07-08 14:43:23 PDT
This is probably dependent on 81340.  I don't think it's a duplicate because 
Mozilla isn't creating the Draft flag locally, either.
Comment 2 Matthew Elvey 2003-11-30 11:02:48 PST
Marking New; confirmed here:
http://www.emailaddresses.com/forum/showthread.php?postid=153654#post153654
I don't think this depends on Bug 81340: I see this bug but not that one.
Reassigning to defaults, as Scott's gone. :(
Comment 3 kael 2004-11-06 22:01:03 PST
Any chance that Thunderbird dislpays the IMAP \Draft flag soon ? This is a kind
of major oversight.
Comment 4 David Rolfe 2005-04-12 12:23:53 PDT
IMHO, keywords on this bug be changed to:
interop mail1 mail6 mailtrack polish

Comment 5 Wayne Mery (:wsmwk, NI for questions) 2005-10-13 13:21:39 PDT
*** Bug 253255 has been marked as a duplicate of this bug. ***
Comment 6 Matthew Elvey 2006-01-09 10:57:52 PST
Duplicate Bug 253255 links to trace logs and pinpoints around where in the code the problem appears to be. I see calls to Store; ProcessStoreFlags and SetupMessageFlagsString will flagString.Append("\\Draft ") if told to.

Rolfe: Adding keywords: mail6, polish; mailtrack is only to be added by the "Mail Team", whomever that is.  mail1 doesn't seem to apply; this isn't about speed/performance optimization.
Comment 7 Greg Haverkamp 2006-10-23 22:16:22 PDT
Created attachment 243289 [details] [diff] [review]
Unified diff for propose solution to but 156347

This patch checks to see if the ImapUrl currently being run was appending a draft from a file.  If so, it sets the kImapMsgDraftFlag, such that the \Draft IMAP flag is set on the message.
Comment 8 Greg Haverkamp 2006-10-23 22:19:31 PDT
Comment on attachment 243289 [details] [diff] [review]
Unified diff for propose solution to but 156347

--- ../../../../new/mozilla/mailnews/imap/src/nsImapProtocol.cpp        2006-08-10 13:24:08.000000000 -0700
+++ nsImapProtocol.cpp  2006-10-23 21:51:15.000000000 -0700
@@ -5276,6 +5276,11 @@
       // convert msg flag label (0xE000000) to imap flag label (0x0E00)
       if (msgFlags & MSG_FLAG_LABELS)
         flagsToSet |= (msgFlags & MSG_FLAG_LABELS) >> 16;
+      // If the message copied was a draft, flag it as such
+      nsImapAction imapAction;
+      rv = m_runningUrl->GetImapAction(&imapAction);
+      if (NS_SUCCEEDED(rv) && (imapAction == nsIImapUrl::nsImapAppendDraftFromFile))
+               flagsToSet |= kImapMsgDraftFlag;
       UploadMessageFromFile(fileSpec, mailboxName, flagsToSet);
       PR_Free( mailboxName );
     }
Comment 9 David :Bienvenu 2006-10-24 08:07:13 PDT
very nice, Greg, thx for the patch. I'll try it out.
Comment 10 David :Bienvenu 2006-10-25 15:57:27 PDT
Created attachment 243535 [details] [diff] [review]
Greg's patch
Comment 11 David :Bienvenu 2006-10-25 16:03:47 PDT
I checked the patch in on the trunk - marking fixed. As the reporter says, we can open a new bug for recognizing the drafts flags. Thx again, Greg.
Comment 12 David :Bienvenu 2006-10-26 11:14:02 PDT
fixed on 2.0 branch

Note You need to log in before you can comment on or make changes to this bug.