Bug 798663 - Use the presence of X-GM-EXT-1 capability to identify Gmail IMAP server. r=bienvenu,a=Standard8
authorAtul Jangra <atuljangra66@gmail.com>
Sun, 23 Dec 2012 22:03:16 -0500
changeset 12922 32e809bfb6691d9be4a7e98d7afbb50c2b2c1f09
parent 12921 563ed3a4f3de30553fef273646c125dbb870a010
child 12923 d6dc67951e638e611c3eea7d3184b26eae9efdff
push id830
push userbugzilla@standard8.plus.com
push dateSun, 30 Dec 2012 19:41:38 +0000
treeherdercomm-aurora@32e809bfb669 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbienvenu, Standard8
bugs798663
Bug 798663 - Use the presence of X-GM-EXT-1 capability to identify Gmail IMAP server. r=bienvenu,a=Standard8
mailnews/imap/src/nsImapCore.h
mailnews/imap/src/nsImapIncomingServer.cpp
mailnews/imap/src/nsImapServerResponseParser.cpp
--- a/mailnews/imap/src/nsImapCore.h
+++ b/mailnews/imap/src/nsImapCore.h
@@ -140,16 +140,17 @@ const eIMAPCapabilityFlag kHasEnableCapa
 const eIMAPCapabilityFlag kHasXListCapability = 0x08000000;  /* XLIST extension */
 const eIMAPCapabilityFlag kHasCompressDeflateCapability = 0x10000000;  /* RFC 4978 COMPRESS extension */
 const eIMAPCapabilityFlag kHasAuthExternalCapability = 0x20000000;  /* RFC 2222 SASL AUTH EXTERNAL */
 const eIMAPCapabilityFlag kHasMoveCapability = 0x40000000;  /* Proposed MOVE RFC */
 const eIMAPCapabilityFlag kHasHighestModSeqCapability = 0x80000000;  /* Subset of RFC 3551 */
 // above are 32bit; below start the uint64_t bits 33-64
 const eIMAPCapabilityFlag kHasListExtendedCapability = 0x100000000LL;  /* RFC 5258 */
 const eIMAPCapabilityFlag kHasSpecialUseCapability = 0x200000000LL;  /* RFC 6154: Sent, Draft etc. folders */
+const eIMAPCapabilityFlag kGmailImapCapability = 0x400000000LL;  /* X-GM-EXT-1 capability extension for gmail */
 
 
 // this used to be part of the connection object class - maybe we should move it into 
 // something similar
 typedef enum {
     kEveryThingRFC822,
     kEveryThingRFC822Peek,
     kHeadersRFC822andUid,
--- a/mailnews/imap/src/nsImapIncomingServer.cpp
+++ b/mailnews/imap/src/nsImapIncomingServer.cpp
@@ -1179,19 +1179,16 @@ NS_IMETHODIMP nsImapIncomingServer::Poss
       imapFolder->SetHierarchyDelimiter(hierarchyDelimiter);
       if (boxFlags & kImapTrash)
       {
         int32_t deleteModel;
         GetDeleteModel(&deleteModel);
         if (deleteModel == nsMsgImapDeleteModels::MoveToTrash)
           child->SetFlag(nsMsgFolderFlags::Trash);
       }
-      // only GMail will have an AllMail folder.
-      if (boxFlags & kImapAllMail)
-        SetIsGMailServer(true);
 
       imapFolder->SetBoxFlags(boxFlags);
       imapFolder->SetExplicitlyVerify(explicitlyVerify);
       imapFolder->GetOnlineName(onlineName);
 
       // online name needs to use the correct hierarchy delimiter (I think...)
       // or the canonical path - one or the other, but be consistent.
       MsgReplaceChar(dupFolderPath, '/', hierarchyDelimiter);
@@ -2167,16 +2164,17 @@ nsImapIncomingServer::PromptPassword(nsI
     m_password = aPassword;
   return rv;
 }
 
 // for the nsIImapServerSink interface
 NS_IMETHODIMP nsImapIncomingServer::SetCapability(eIMAPCapabilityFlags capability)
 {
   m_capability = capability;
+  SetIsGMailServer((capability & kGmailImapCapability) != 0);
   SetCapabilityACL(capability & kACLCapability);
   SetCapabilityQuota(capability & kQuotaCapability);
   return NS_OK;
 }
 
 NS_IMETHODIMP nsImapIncomingServer::SetServerID(const nsACString &aServerID)
 {
   return SetServerIDPref(aServerID);
--- a/mailnews/imap/src/nsImapServerResponseParser.cpp
+++ b/mailnews/imap/src/nsImapServerResponseParser.cpp
@@ -2278,16 +2278,18 @@ void nsImapServerResponseParser::capabil
       else if (token.Equals("XSERVERINFO", nsCaseInsensitiveCStringComparator()))
         fCapabilityFlag |= kXServerInfoCapability;
       else if (token.Equals("UIDPLUS", nsCaseInsensitiveCStringComparator()))
         fCapabilityFlag |= kUidplusCapability;
       else if (token.Equals("LITERAL+", nsCaseInsensitiveCStringComparator()))
         fCapabilityFlag |= kLiteralPlusCapability;
       else if (token.Equals("XAOL-OPTION", nsCaseInsensitiveCStringComparator()))
         fCapabilityFlag |= kAOLImapCapability;
+      else if (token.Equals("X-GM-EXT-1", nsCaseInsensitiveCStringComparator()))
+        fCapabilityFlag |= kGmailImapCapability;
       else if (token.Equals("QUOTA", nsCaseInsensitiveCStringComparator()))
         fCapabilityFlag |= kQuotaCapability;
       else if (token.Equals("LANGUAGE", nsCaseInsensitiveCStringComparator()))
         fCapabilityFlag |= kHasLanguageCapability;
       else if (token.Equals("IDLE", nsCaseInsensitiveCStringComparator()))
         fCapabilityFlag |= kHasIdleCapability;
       else if (token.Equals("CONDSTORE", nsCaseInsensitiveCStringComparator()))
         fCapabilityFlag |= kHasCondStoreCapability;