Skip to content
This repository has been archived by the owner on Nov 3, 2021. It is now read-only.

Commit

Permalink
Merge pull request #27562 from asutherland/email-coremail-sent
Browse files Browse the repository at this point in the history
Bug 1055445 - CoreMail servers auto-file in sent, like gmail. r=asuth
  • Loading branch information
asutherland committed Jan 22, 2015
2 parents b2ea22f + 030915d commit 8df71ff
Showing 1 changed file with 33 additions and 3 deletions.
36 changes: 33 additions & 3 deletions apps/email/js/ext/imap/account.js
Expand Up @@ -130,10 +130,42 @@ var properties = {
return '[ImapAccount: ' + this.id + ']';
},

//////////////////////////////////////////////////////////////////////////////
// Server type indicators for quirks and heuristics like sent mail

/**
* Is this server gmail? Not something that just looks like gmail, but IS
* gmail.
*
* Gmail self-identifies via the nonstandard but documented X-GM-EXT-1
* capability. Documentation is at
* https://developers.google.com/gmail/imap_extensions
*/
get isGmail() {
return this.meta.capability.indexOf('X-GM-EXT-1') !== -1;
},

/**
* Is this a CoreMail server, as used by 126.com/163.com/others?
*
* CoreMail servers self-identify via the apparently cargo-culted
* X-CM-EXT-1 capability.
*/
get isCoreMailServer() {
return this.meta.capability.indexOf('X-CM-EXT-1') !== -1;
},

/**
* Do messages sent via the corresponding SMTP account automatically show up
* in the sent folder? Both Gmail and CoreMail do this. (It's a good thing
* to do, it just sucks that there's no explicit IMAP capability, etc. to
* indicate this without us having to infer from the server type. Although
* we could probe this if we wanted...)
*/
get sentMessagesAutomaticallyAppearInSentFolder() {
return this.isGmail || this.isCoreMailServer;
},

//////////////////////////////////////////////////////////////////////////////
// Connection Pool-ish stuff

Expand Down Expand Up @@ -803,9 +835,7 @@ var properties = {
* could generate an I/O storm, cause temporary double-storage use, etc.)
*/
saveSentMessage: function(composer) {
// (gmail automatically copies the message into the sent folder; we don't
// have to do anything)
if (this.isGmail) {
if (this.sentMessagesAutomaticallyAppearInSentFolder) {
return;
}

Expand Down

0 comments on commit 8df71ff

Please sign in to comment.