set has attachment flag at hdr download time by looking for content type multipart mixed, 241203

This commit is contained in:
bienvenu%nventure.com 2004-10-25 18:48:22 +00:00
Родитель b88c2777ed
Коммит 4323cb699f
3 изменённых файлов: 16 добавлений и 23 удалений

Просмотреть файл

@ -398,8 +398,11 @@ var messageHeaderSink = {
var inlineAttachments = pref.getBoolPref("mail.inline_attachments");
var displayHtmlAs = pref.getIntPref("mailnews.display.html_as");
if (inlineAttachments && !displayHtmlAs)
{
mSaveHdr = messenger.messageServiceFromURI(uri).messageURIToMsgHdr(uri);
return;
}
}
currentAttachments.push (new createNewAttachmentInfo(contentType, url, displayName, uri, notDownloaded));
// if we have an attachment, set the MSG_FLAG_ATTACH flag on the hdr
@ -426,6 +429,10 @@ var messageHeaderSink = {
onEndAllAttachments: function()
{
// if we only got a v-card, turn off the attachments flag
if (!currentAttachments.length && mSaveHdr)
mSaveHdr.markHasAttachments(false);
mSaveHdr = null;
displayAttachmentsForExpandedView();
},
@ -445,6 +452,7 @@ var messageHeaderSink = {
},
mSecurityInfo : null,
mSaveHdr: null,
getSecurityInfo: function()
{
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)
{
// 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());
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);
}
}
}
}