diff --git a/mailnews/imap/public/nsIImapUrl.idl b/mailnews/imap/public/nsIImapUrl.idl index 727e99d0378c..807e34ed8f02 100644 --- a/mailnews/imap/public/nsIImapUrl.idl +++ b/mailnews/imap/public/nsIImapUrl.idl @@ -188,6 +188,7 @@ interface nsIImapUrl : nsISupports const long nsImapDeleteFolderAndMsgs = 0x10000033; const long nsImapUserDefinedMsgCommand = 0x10000034; const long nsImapUserDefinedFetchAttribute = 0x10000035; + const long nsImapMsgFetchPeek = 0x10000036; }; %{C++ diff --git a/mailnews/imap/src/nsImapUrl.cpp b/mailnews/imap/src/nsImapUrl.cpp index feeee5f46d20..abdcf284bed1 100644 --- a/mailnews/imap/src/nsImapUrl.cpp +++ b/mailnews/imap/src/nsImapUrl.cpp @@ -516,7 +516,8 @@ void nsImapUrl::ParseImapPart(char *imapPartOfUrl) ParseUidChoice(); PR_FREEIF(m_sourceCanonicalFolderPathSubString); ParseFolderPath(&m_sourceCanonicalFolderPathSubString); - ParseListOfMessageIds(); + ParseListOfMessageIds(); + // if fetched by spam filter, the action will be changed to nsImapMsgFetchPeek } else /* if (fInternal) no concept of internal - not sure there will be one */ { @@ -1524,20 +1525,23 @@ void nsImapUrl::ParseMsgFlags() void nsImapUrl::ParseListOfMessageIds() { - m_listOfMessageIds = m_tokenPlaceHolder ? nsIMAPGenericParser::Imapstrtok_r(nsnull, IMAP_URL_TOKEN_SEPARATOR, &m_tokenPlaceHolder) : (char *)NULL; - if (!m_listOfMessageIds) - m_validUrl = PR_FALSE; - else - { + m_listOfMessageIds = m_tokenPlaceHolder ? nsIMAPGenericParser::Imapstrtok_r(nsnull, IMAP_URL_TOKEN_SEPARATOR, &m_tokenPlaceHolder) : (char *)NULL; + if (!m_listOfMessageIds) + m_validUrl = PR_FALSE; + else + { m_listOfMessageIds = nsCRT::strdup(m_listOfMessageIds); - m_mimePartSelectorDetected = PL_strstr(m_listOfMessageIds, "&part=") != 0 || PL_strstr(m_listOfMessageIds, "?part=") != 0; - + m_mimePartSelectorDetected = PL_strstr(m_listOfMessageIds, "&part=") != 0 || PL_strstr(m_listOfMessageIds, "?part=") != 0; + // if we're asking for just the body, don't download the whole message. see // nsMsgQuote::QuoteMessage() for the "header=" settings when replying to msgs. if (!m_fetchPartsOnDemand) m_fetchPartsOnDemand = (PL_strstr(m_listOfMessageIds, "?header=quotebody") != 0 || - PL_strstr(m_listOfMessageIds, "?header=only") != 0); - } + PL_strstr(m_listOfMessageIds, "?header=only") != 0); + // if it's a spam filter trying to fetch the msg, don't let it get marked read. + if (PL_strstr(m_listOfMessageIds,"?header=filter") != 0) + m_imapAction = nsImapMsgFetchPeek; + } } void nsImapUrl::ParseCustomMsgFetchAttribute()