diff --git a/mailnews/imap/src/nsImapProtocol.cpp b/mailnews/imap/src/nsImapProtocol.cpp index caa90c986a6..44e9a337cc8 100644 --- a/mailnews/imap/src/nsImapProtocol.cpp +++ b/mailnews/imap/src/nsImapProtocol.cpp @@ -2898,14 +2898,7 @@ nsImapProtocol::FetchMessage(const char * messageIds, headersToDL = PR_smprintf("%s %s",dbHeaders, arbitraryHeaders.get()); if (aolImapServer) - { - // we're not going to use the envelope command on Sent Items because it - // replaces sender with recipient. - if (strcmp(GetServerStateParser().GetSelectedMailboxName(), "Sent Items")) - what = strdup(" XAOL-ENVELOPE INTERNALDATE)"); - else - what = strdup(" BODY.PEEK[HEADER.FIELDS (From To Subject)] INTERNALDATE)"); - } + what = strdup(" XAOL-ENVELOPE INTERNALDATE)"); else if (gUseEnvelopeCmd) what = PR_smprintf(" ENVELOPE BODY.PEEK[HEADER.FIELDS (%s)])", headersToDL); else diff --git a/mailnews/imap/src/nsImapServerResponseParser.cpp b/mailnews/imap/src/nsImapServerResponseParser.cpp index d2f8e1dca5e..04daee492d4 100644 --- a/mailnews/imap/src/nsImapServerResponseParser.cpp +++ b/mailnews/imap/src/nsImapServerResponseParser.cpp @@ -1251,18 +1251,18 @@ void nsImapServerResponseParser::msg_fetch() envelope_data(); } else if (!PL_strcasecmp(fNextToken, "INTERNALDATE")) - { - fDownloadingHeaders = PR_TRUE; // we only request internal date while downloading headers - if (!bNeedEndMessageDownload) - BeginMessageDownload(MESSAGE_RFC822); - bNeedEndMessageDownload = PR_TRUE; + { + fDownloadingHeaders = PR_TRUE; // we only request internal date while downloading headers + if (!bNeedEndMessageDownload) + BeginMessageDownload(MESSAGE_RFC822); + bNeedEndMessageDownload = PR_TRUE; internal_date(); - } + } else if (!PL_strcasecmp(fNextToken, "XAOL-ENVELOPE")) { fDownloadingHeaders = PR_TRUE; - if (!bNeedEndMessageDownload) - BeginMessageDownload(MESSAGE_RFC822); + if (!bNeedEndMessageDownload) + BeginMessageDownload(MESSAGE_RFC822); bNeedEndMessageDownload = PR_TRUE; xaolenvelope_data(); } @@ -1415,7 +1415,19 @@ void nsImapServerResponseParser::xaolenvelope_data() fNextToken = GetNextToken(); if (ContinueParse()) { - nsCAutoString fromLine("From: "); + nsCAutoString fromLine; + if (!strcmp(GetSelectedMailboxName(), "Sent Items")) + { + // xaol envelope switches the From with the To, so we switch them back and + // create a fake from line From: user@aol.com + fromLine.Append("To: "); + nsCAutoString fakeFromLine(NS_LITERAL_CSTRING("From: ") + nsDependentCString(fServerConnection.GetImapUserName()) + NS_LITERAL_CSTRING("@aol.com")); + fServerConnection.HandleMessageDownLoadLine(fakeFromLine.get(), PR_FALSE); + } + else + { + fromLine.Append("From: "); + } parse_address(fromLine); fServerConnection.HandleMessageDownLoadLine(fromLine.get(), PR_FALSE); if (ContinueParse()) diff --git a/mailnews/imap/src/nsImapUtils.cpp b/mailnews/imap/src/nsImapUtils.cpp index 57c01b5a1e2..e7c9486ef13 100644 --- a/mailnews/imap/src/nsImapUtils.cpp +++ b/mailnews/imap/src/nsImapUtils.cpp @@ -292,12 +292,9 @@ nsImapMailboxSpec::nsImapMailboxSpec() nsImapMailboxSpec::~nsImapMailboxSpec() { - if (allocatedPathName) - nsCRT::free(allocatedPathName); - if (unicharPathName) - nsCRT::free(unicharPathName); - if (hostName) - nsCRT::free(hostName); + nsCRT::free(allocatedPathName); + nsCRT::free(unicharPathName); + nsCRT::free(hostName); } NS_IMPL_GETSET(nsImapMailboxSpec, Folder_UIDVALIDITY, PRInt32, folder_UIDVALIDITY);