зеркало из https://github.com/mozilla/pjs.git
set has attachment flag at hdr download time by looking for content type multipart mixed, 241203
This commit is contained in:
Родитель
b88c2777ed
Коммит
4323cb699f
|
@ -395,10 +395,13 @@ var messageHeaderSink = {
|
||||||
|
|
||||||
if (contentType == "text/x-vcard")
|
if (contentType == "text/x-vcard")
|
||||||
{
|
{
|
||||||
var inlineAttachments = pref.getBoolPref("mail.inline_attachments");
|
var inlineAttachments = pref.getBoolPref("mail.inline_attachments");
|
||||||
var displayHtmlAs = pref.getIntPref("mailnews.display.html_as");
|
var displayHtmlAs = pref.getIntPref("mailnews.display.html_as");
|
||||||
if (inlineAttachments && !displayHtmlAs)
|
if (inlineAttachments && !displayHtmlAs)
|
||||||
return;
|
{
|
||||||
|
mSaveHdr = messenger.messageServiceFromURI(uri).messageURIToMsgHdr(uri);
|
||||||
|
return;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
currentAttachments.push (new createNewAttachmentInfo(contentType, url, displayName, uri, notDownloaded));
|
currentAttachments.push (new createNewAttachmentInfo(contentType, url, displayName, uri, notDownloaded));
|
||||||
|
@ -426,6 +429,10 @@ var messageHeaderSink = {
|
||||||
|
|
||||||
onEndAllAttachments: function()
|
onEndAllAttachments: function()
|
||||||
{
|
{
|
||||||
|
// if we only got a v-card, turn off the attachments flag
|
||||||
|
if (!currentAttachments.length && mSaveHdr)
|
||||||
|
mSaveHdr.markHasAttachments(false);
|
||||||
|
mSaveHdr = null;
|
||||||
displayAttachmentsForExpandedView();
|
displayAttachmentsForExpandedView();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -445,6 +452,7 @@ var messageHeaderSink = {
|
||||||
},
|
},
|
||||||
|
|
||||||
mSecurityInfo : null,
|
mSecurityInfo : null,
|
||||||
|
mSaveHdr: null,
|
||||||
getSecurityInfo: function()
|
getSecurityInfo: function()
|
||||||
{
|
{
|
||||||
return this.mSecurityInfo;
|
return this.mSecurityInfo;
|
||||||
|
|
|
@ -640,27 +640,6 @@ NS_IMETHODIMP TokenStreamListener::ProcessHeaders(nsIUTF8StringEnumerator *aHead
|
||||||
|
|
||||||
NS_IMETHODIMP TokenStreamListener::HandleAttachment(const char *contentType, const char *url, const PRUnichar *displayName, const char *uri, PRBool aNotDownloaded)
|
NS_IMETHODIMP TokenStreamListener::HandleAttachment(const char *contentType, const char *url, const PRUnichar *displayName, const char *uri, PRBool aNotDownloaded)
|
||||||
{
|
{
|
||||||
// UE Improvement, if we are downloading the message for the junk filter, and the junk filter is told the msg has attachments
|
|
||||||
// then go ahead and mark the message as having attachments instead of waiting for the user to display the message
|
|
||||||
// before making such a notation.
|
|
||||||
// XXX Unfortunately this code causes us to be over agressive in marking messages as having attachments
|
|
||||||
#if 0
|
|
||||||
if (!mSetAttachmentFlag)
|
|
||||||
{
|
|
||||||
nsCOMPtr <nsIMsgMessageService> messageService;
|
|
||||||
nsresult rv = GetMessageServiceFromURI(uri, getter_AddRefs(messageService));
|
|
||||||
if (messageService)
|
|
||||||
{
|
|
||||||
nsCOMPtr <nsIMsgDBHdr> msgHdr;
|
|
||||||
rv = messageService->MessageURIToMsgHdr(uri, getter_AddRefs(msgHdr));
|
|
||||||
if (msgHdr)
|
|
||||||
msgHdr->MarkHasAttachments(PR_TRUE);
|
|
||||||
}
|
|
||||||
|
|
||||||
mSetAttachmentFlag = PR_TRUE;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
mTokenizer.tokenizeAttachment(contentType, NS_ConvertUCS2toUTF8(displayName).get());
|
mTokenizer.tokenizeAttachment(contentType, NS_ConvertUCS2toUTF8(displayName).get());
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
}
|
}
|
||||||
|
|
|
@ -1402,6 +1402,12 @@ int nsParseMailMessageState::FinalizeHeaders()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
substring = PL_strstr(content_type->value, "multipart/mixed");
|
||||||
|
if (substring)
|
||||||
|
{
|
||||||
|
PRUint32 newFlags;
|
||||||
|
m_newMsgHdr->OrFlags(MSG_FLAG_ATTACHMENT, &newFlags);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Загрузка…
Ссылка в новой задаче