зеркало из https://github.com/mozilla/gecko-dev.git
Max message size warning feature and labeling forwarded messages by subject - Bugs: 26519 5647 - r: jefft
This commit is contained in:
Родитель
0970222b53
Коммит
8cc87b679d
|
@ -144,4 +144,7 @@
|
||||||
## @name NS_MSG_START_COPY_MESSAGE_FAILED
|
## @name NS_MSG_START_COPY_MESSAGE_FAILED
|
||||||
12540=Copy failed.
|
12540=Copy failed.
|
||||||
|
|
||||||
|
## @name NS_MSG_LARGE_MESSAGE_WARNING
|
||||||
|
12541=Warning! You are about to send a %d byte message. Are you sure that you want to do this?
|
||||||
|
|
||||||
noIdentities=You don't have any email identities yet. Create one with the Account Wizard.
|
noIdentities=You don't have any email identities yet. Create one with the Account Wizard.
|
||||||
|
|
|
@ -34,6 +34,7 @@
|
||||||
#include "nsIMsgMessageService.h"
|
#include "nsIMsgMessageService.h"
|
||||||
#include "nsMsgUtils.h"
|
#include "nsMsgUtils.h"
|
||||||
#include "nsMsgPrompts.h"
|
#include "nsMsgPrompts.h"
|
||||||
|
#include "nsTextFormatter.h"
|
||||||
|
|
||||||
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
|
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
|
||||||
|
|
||||||
|
@ -424,6 +425,18 @@ FetcherURLDoneCallback(nsIURI* aURL, nsresult aStatus,
|
||||||
ma->m_charset = PL_strdup(aCharset);
|
ma->m_charset = PL_strdup(aCharset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( (!PL_strcasecmp(ma->m_real_name, "ForwardedMessage.eml")) &&
|
||||||
|
(!PL_strcasecmp(ma->m_type, MESSAGE_RFC822))
|
||||||
|
)
|
||||||
|
{
|
||||||
|
char *subject = nsMsgParseSubjectFromFile(ma->mFileSpec);
|
||||||
|
if (subject)
|
||||||
|
{
|
||||||
|
PR_FREEIF(ma->m_real_name);
|
||||||
|
ma->m_real_name = subject;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return ma->UrlExit(aStatus, aMsg);
|
return ma->UrlExit(aStatus, aMsg);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -443,9 +456,9 @@ nsMsgAttachmentHandler::SnarfMsgAttachment(nsMsgCompFields *compFields)
|
||||||
PR_FREEIF(m_real_name);
|
PR_FREEIF(m_real_name);
|
||||||
m_real_name = PL_strdup("ForwardedMessage.eml");
|
m_real_name = PL_strdup("ForwardedMessage.eml");
|
||||||
PR_FREEIF(m_type);
|
PR_FREEIF(m_type);
|
||||||
m_type = PL_strdup("message/rfc822");
|
m_type = PL_strdup(MESSAGE_RFC822);
|
||||||
PR_FREEIF(m_override_type);
|
PR_FREEIF(m_override_type);
|
||||||
m_override_type = PL_strdup("message/rfc822");
|
m_override_type = PL_strdup(MESSAGE_RFC822);
|
||||||
if (!mFileSpec)
|
if (!mFileSpec)
|
||||||
{
|
{
|
||||||
rv = NS_ERROR_FAILURE;
|
rv = NS_ERROR_FAILURE;
|
||||||
|
@ -827,24 +840,17 @@ nsMsgAttachmentHandler::UrlExit(nsresult status, const PRUnichar* aMsg)
|
||||||
PRBool keepOnGoing = PR_TRUE;
|
PRBool keepOnGoing = PR_TRUE;
|
||||||
nsXPIDLCString turl;
|
nsXPIDLCString turl;
|
||||||
PRUnichar *msg = nsnull;
|
PRUnichar *msg = nsnull;
|
||||||
char *printfString = nsnull;
|
PRUnichar *printfString = nsnull;
|
||||||
char *tString = nsnull;
|
|
||||||
|
|
||||||
msg = ComposeGetStringByID(NS_MSG_FAILURE_ON_OBJ_EMBED);
|
msg = ComposeGetStringByID(NS_MSG_FAILURE_ON_OBJ_EMBED);
|
||||||
nsCAutoString cQuestionString(msg);
|
|
||||||
|
|
||||||
if (NS_SUCCEEDED(mURL->GetSpec(getter_Copies(turl))) && (turl))
|
if (NS_SUCCEEDED(mURL->GetSpec(getter_Copies(turl))) && (turl))
|
||||||
tString = nsString(turl).ToNewCString();
|
printfString = nsTextFormatter::smprintf(msg, turl);
|
||||||
|
|
||||||
if ( !tString )
|
|
||||||
printfString = PR_smprintf(cQuestionString, "?");
|
|
||||||
else
|
else
|
||||||
printfString = PR_smprintf(cQuestionString, tString);
|
printfString = nsTextFormatter::smprintf(msg, "?");
|
||||||
|
|
||||||
nsMsgAskBooleanQuestionByString(nsString(printfString).GetUnicode(), &keepOnGoing);
|
nsMsgAskBooleanQuestionByString(printfString, &keepOnGoing);
|
||||||
PR_smprintf_free(printfString);
|
PR_FREEIF(printfString);
|
||||||
PR_FREEIF(msg);
|
PR_FREEIF(msg);
|
||||||
PR_FREEIF(tString);
|
|
||||||
|
|
||||||
if (!keepOnGoing)
|
if (!keepOnGoing)
|
||||||
{
|
{
|
||||||
|
|
|
@ -810,7 +810,7 @@ mime_generate_attachment_headers (const char *type, const char *encoding,
|
||||||
PRBool sendFlowed = PR_TRUE; /* rhp - add this */
|
PRBool sendFlowed = PR_TRUE; /* rhp - add this */
|
||||||
if(type && !PL_strcasecmp(type, "text/plain") && prefs)
|
if(type && !PL_strcasecmp(type, "text/plain") && prefs)
|
||||||
{
|
{
|
||||||
prefs->GetBoolPref("mail.send_plaintext_flowed", &sendFlowed);
|
prefs->GetBoolPref("mailnews.send_plaintext_flowed", &sendFlowed);
|
||||||
if (sendFlowed)
|
if (sendFlowed)
|
||||||
PUSH_STRING ("; format=flowed");
|
PUSH_STRING ("; format=flowed");
|
||||||
// else
|
// else
|
||||||
|
@ -2070,3 +2070,46 @@ DoLineEndingConJobUnicode(PRUnichar *aBuf, PRUint32 aLen)
|
||||||
if (aBuf[i] == CR)
|
if (aBuf[i] == CR)
|
||||||
aBuf[i] = LF;
|
aBuf[i] = LF;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Simple parser to parse Subject.
|
||||||
|
// It only supports the case when the description is within one line.
|
||||||
|
char *
|
||||||
|
nsMsgParseSubjectFromFile(nsFileSpec* fileSpec)
|
||||||
|
{
|
||||||
|
nsIFileSpec *tmpFileSpec = nsnull;
|
||||||
|
char *subject = nsnull;
|
||||||
|
char buffer[1024];
|
||||||
|
char *ptr = &buffer[0];
|
||||||
|
|
||||||
|
NS_NewFileSpecWithSpec(*fileSpec, &tmpFileSpec);
|
||||||
|
if (!tmpFileSpec)
|
||||||
|
return nsnull;
|
||||||
|
|
||||||
|
if (NS_FAILED(tmpFileSpec->OpenStreamForReading()))
|
||||||
|
return nsnull;
|
||||||
|
|
||||||
|
PRBool eof = PR_FALSE;
|
||||||
|
|
||||||
|
while ( NS_SUCCEEDED(tmpFileSpec->Eof(&eof)) && (!eof) )
|
||||||
|
{
|
||||||
|
PRBool wasTruncated = PR_FALSE;
|
||||||
|
|
||||||
|
if (NS_FAILED(tmpFileSpec->ReadLine(&ptr, sizeof(buffer), &wasTruncated)))
|
||||||
|
break;
|
||||||
|
|
||||||
|
if (wasTruncated)
|
||||||
|
continue;
|
||||||
|
|
||||||
|
if (*buffer == CR || *buffer == LF || *buffer == 0)
|
||||||
|
break;
|
||||||
|
|
||||||
|
if ( !PL_strncasecmp(buffer, "Subject: ", 9) )
|
||||||
|
{
|
||||||
|
subject = nsCRT::strdup(buffer + 9);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
tmpFileSpec->CloseStream();
|
||||||
|
return subject;
|
||||||
|
}
|
||||||
|
|
|
@ -119,6 +119,7 @@ char *GenerateFileNameFromURI(nsIURI *aURL);
|
||||||
|
|
||||||
char *nsMsgGetExtensionFromFileURL(nsString aUrl);
|
char *nsMsgGetExtensionFromFileURL(nsString aUrl);
|
||||||
char *GetFolderNameFromURLString(char *aUrl);
|
char *GetFolderNameFromURLString(char *aUrl);
|
||||||
|
char *nsMsgParseSubjectFromFile(nsFileSpec* fileSpec);
|
||||||
|
|
||||||
//
|
//
|
||||||
// Folder calls...
|
// Folder calls...
|
||||||
|
|
|
@ -74,6 +74,7 @@
|
||||||
#define NS_MSG_START_COPY_MESSAGE NS_MSG_GENERATE_SUCCESS(12538)
|
#define NS_MSG_START_COPY_MESSAGE NS_MSG_GENERATE_SUCCESS(12538)
|
||||||
#define NS_MSG_START_COPY_MESSAGE_COMPLETE NS_MSG_GENERATE_SUCCESS(12539)
|
#define NS_MSG_START_COPY_MESSAGE_COMPLETE NS_MSG_GENERATE_SUCCESS(12539)
|
||||||
#define NS_MSG_START_COPY_MESSAGE_FAILED NS_MSG_GENERATE_FAILURE(12540)
|
#define NS_MSG_START_COPY_MESSAGE_FAILED NS_MSG_GENERATE_FAILURE(12540)
|
||||||
|
#define NS_MSG_LARGE_MESSAGE_WARNING NS_MSG_GENERATE_FAILURE(12541)
|
||||||
|
|
||||||
NS_BEGIN_EXTERN_C
|
NS_BEGIN_EXTERN_C
|
||||||
|
|
||||||
|
|
|
@ -198,7 +198,7 @@ nsMsgQuote::QuoteMessage(const PRUnichar *msgURI, PRBool quoteHeaders, nsIStream
|
||||||
NS_WITH_SERVICE(nsIStreamConverterService, streamConverterService, kIStreamConverterServiceCID, &rv);
|
NS_WITH_SERVICE(nsIStreamConverterService, streamConverterService, kIStreamConverterServiceCID, &rv);
|
||||||
if (NS_FAILED(rv)) return rv;
|
if (NS_FAILED(rv)) return rv;
|
||||||
nsAutoString from, to;
|
nsAutoString from, to;
|
||||||
from = "message/rfc822";
|
from = MESSAGE_RFC822;
|
||||||
to = "text/xul";
|
to = "text/xul";
|
||||||
nsCOMPtr<nsIStreamListener> convertedListener;
|
nsCOMPtr<nsIStreamListener> convertedListener;
|
||||||
rv = streamConverterService->AsyncConvertData(from.GetUnicode(),
|
rv = streamConverterService->AsyncConvertData(from.GetUnicode(),
|
||||||
|
|
|
@ -64,6 +64,7 @@
|
||||||
#include "mozITXTToHTMLConv.h"
|
#include "mozITXTToHTMLConv.h"
|
||||||
#include "nsIMsgStatusFeedback.h"
|
#include "nsIMsgStatusFeedback.h"
|
||||||
#include "nsIMsgMailSession.h"
|
#include "nsIMsgMailSession.h"
|
||||||
|
#include "nsTextFormatter.h"
|
||||||
|
|
||||||
// use these macros to define a class IID for our component. Our object currently
|
// use these macros to define a class IID for our component. Our object currently
|
||||||
// supports two interfaces (nsISupports and nsIMsgCompose) so we want to define constants
|
// supports two interfaces (nsISupports and nsIMsgCompose) so we want to define constants
|
||||||
|
@ -79,6 +80,7 @@ static NS_DEFINE_CID(kTXTToHTMLConvCID, MOZITXTTOHTMLCONV_CID);
|
||||||
|
|
||||||
#define PREF_MAIL_CONVERT_STRUCTS "mail.convert_structs"
|
#define PREF_MAIL_CONVERT_STRUCTS "mail.convert_structs"
|
||||||
#define PREF_MAIL_STRICTLY_MIME "mail.strictly_mime"
|
#define PREF_MAIL_STRICTLY_MIME "mail.strictly_mime"
|
||||||
|
#define PREF_MAIL_MESSAGE_WARNING_SIZE "mailnews.message_warning_size"
|
||||||
|
|
||||||
#ifdef XP_MAC
|
#ifdef XP_MAC
|
||||||
#include "xp.h" // mac only
|
#include "xp.h" // mac only
|
||||||
|
@ -190,7 +192,7 @@ nsMsgComposeAndSend::nsMsgComposeAndSend() :
|
||||||
mRemoteAttachmentCount = 0;
|
mRemoteAttachmentCount = 0;
|
||||||
mCompFieldLocalAttachments = 0;
|
mCompFieldLocalAttachments = 0;
|
||||||
mCompFieldRemoteAttachments = 0;
|
mCompFieldRemoteAttachments = 0;
|
||||||
|
mMessageWarningSize = 0;
|
||||||
|
|
||||||
// note: it is okay to return a null status feedback and not return an error
|
// note: it is okay to return a null status feedback and not return an error
|
||||||
// it's possible the url really doesn't have status feedback
|
// it's possible the url really doesn't have status feedback
|
||||||
|
@ -2153,25 +2155,24 @@ nsMsgComposeAndSend::HackAttachments(const nsMsgAttachmentData *attachments,
|
||||||
//
|
//
|
||||||
|
|
||||||
// Display some feedback to user...
|
// Display some feedback to user...
|
||||||
char *printfString = nsnull;
|
PRUnichar *printfString = nsnull;
|
||||||
PRUnichar *msg = nsnull;
|
PRUnichar *msg = nsnull;
|
||||||
|
|
||||||
msg = ComposeGetStringByID(NS_MSG_GATHERING_ATTACHMENT);
|
msg = ComposeGetStringByID(NS_MSG_GATHERING_ATTACHMENT);
|
||||||
nsCAutoString cProgressString(msg);
|
|
||||||
PR_FREEIF(msg);
|
|
||||||
|
|
||||||
if (m_attachments[i].m_real_name)
|
if (m_attachments[i].m_real_name)
|
||||||
printfString = PR_smprintf(cProgressString, m_attachments[i].m_real_name);
|
printfString = nsTextFormatter::smprintf(msg, m_attachments[i].m_real_name);
|
||||||
else
|
else
|
||||||
printfString = PR_smprintf(cProgressString, "");
|
printfString = nsTextFormatter::smprintf(msg, "");
|
||||||
|
|
||||||
if (printfString)
|
if (printfString)
|
||||||
{
|
{
|
||||||
nsString formattedString(printfString);
|
SetStatusMessage(printfString);
|
||||||
SetStatusMessage((PRUnichar *)formattedString.GetUnicode());
|
PR_FREEIF(printfString);
|
||||||
PR_smprintf_free(printfString);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PR_FREEIF(msg);
|
||||||
|
|
||||||
int status = m_attachments[i].SnarfAttachment(mCompFields);
|
int status = m_attachments[i].SnarfAttachment(mCompFields);
|
||||||
if (status < 0)
|
if (status < 0)
|
||||||
return status;
|
return status;
|
||||||
|
@ -2483,6 +2484,7 @@ nsMsgComposeAndSend::Init(
|
||||||
if (NS_SUCCEEDED(rv) && prefs)
|
if (NS_SUCCEEDED(rv) && prefs)
|
||||||
{
|
{
|
||||||
rv = prefs->GetBoolPref(PREF_MAIL_STRICTLY_MIME, &strictly_mime);
|
rv = prefs->GetBoolPref(PREF_MAIL_STRICTLY_MIME, &strictly_mime);
|
||||||
|
rv = prefs->GetIntPref(PREF_MAIL_MESSAGE_WARNING_SIZE, (PRInt32 *) &mMessageWarningSize);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsMsgMIMESetConformToStandard(strictly_mime);
|
nsMsgMIMESetConformToStandard(strictly_mime);
|
||||||
|
@ -2592,6 +2594,39 @@ nsMsgComposeAndSend::DeliverMessage()
|
||||||
return SaveAsTemplate();
|
return SaveAsTemplate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//
|
||||||
|
// Ok, we are about to send the file that we have built up...but what
|
||||||
|
// if this is a mongo email...we should have a way to warn the user that
|
||||||
|
// they are about to do something they may not want to do.
|
||||||
|
//
|
||||||
|
if ( (mMessageWarningSize > 0) && (mTempFileSpec->GetFileSize() > mMessageWarningSize) )
|
||||||
|
{
|
||||||
|
PRBool abortTheSend = PR_FALSE;
|
||||||
|
|
||||||
|
PRUnichar *msg = ComposeGetStringByID(NS_MSG_LARGE_MESSAGE_WARNING);
|
||||||
|
|
||||||
|
if (msg)
|
||||||
|
{
|
||||||
|
PRUnichar *printfString = nsTextFormatter::smprintf(msg, mTempFileSpec->GetFileSize());
|
||||||
|
PR_FREEIF(msg);
|
||||||
|
|
||||||
|
if (printfString)
|
||||||
|
{
|
||||||
|
nsMsgAskBooleanQuestionByString(printfString, &abortTheSend);
|
||||||
|
if (!abortTheSend)
|
||||||
|
{
|
||||||
|
Fail(NS_ERROR_BUT_DONT_SHOW_ALERT, printfString);
|
||||||
|
PR_FREEIF(printfString);
|
||||||
|
NotifyListenersOnStopCopy(NS_ERROR_FAILURE);
|
||||||
|
return NS_ERROR_FAILURE;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
PR_FREEIF(printfString);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (news_p) {
|
if (news_p) {
|
||||||
if (mail_p) {
|
if (mail_p) {
|
||||||
mSendMailAlso = PR_TRUE;
|
mSendMailAlso = PR_TRUE;
|
||||||
|
@ -3531,10 +3566,9 @@ nsMsgComposeAndSend::MimeDoFCC(nsFileSpec *input_file,
|
||||||
char *envelopeLine = nsMsgGetEnvelopeLine();
|
char *envelopeLine = nsMsgGetEnvelopeLine();
|
||||||
PRBool folderIsLocal = PR_TRUE;
|
PRBool folderIsLocal = PR_TRUE;
|
||||||
char *turi = nsnull;
|
char *turi = nsnull;
|
||||||
char *printfString = nsnull;
|
PRUnichar *printfString = nsnull;
|
||||||
PRUnichar *msg = nsnull;
|
PRUnichar *msg = nsnull;
|
||||||
char *folderName = nsnull;
|
char *folderName = nsnull;
|
||||||
char *cProgressString = nsnull;
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Ok, this is here to keep track of this for 2 copy operations...
|
// Ok, this is here to keep track of this for 2 copy operations...
|
||||||
|
@ -3623,25 +3657,23 @@ nsMsgComposeAndSend::MimeDoFCC(nsFileSpec *input_file,
|
||||||
|
|
||||||
// Tell the user we are copying the message...
|
// Tell the user we are copying the message...
|
||||||
msg = ComposeGetStringByID(NS_MSG_START_COPY_MESSAGE);
|
msg = ComposeGetStringByID(NS_MSG_START_COPY_MESSAGE);
|
||||||
cProgressString = nsString(msg).ToNewCString();
|
if (msg)
|
||||||
PR_FREEIF(msg);
|
|
||||||
folderName = GetFolderNameFromURLString(turi);
|
|
||||||
|
|
||||||
if (cProgressString)
|
|
||||||
{
|
{
|
||||||
|
folderName = GetFolderNameFromURLString(turi);
|
||||||
if (folderName)
|
if (folderName)
|
||||||
printfString = PR_smprintf(cProgressString, folderName);
|
printfString = nsTextFormatter::smprintf(msg, folderName);
|
||||||
else
|
else
|
||||||
printfString = PR_smprintf(cProgressString, "?");
|
printfString = nsTextFormatter::smprintf(msg, "?");
|
||||||
PR_FREEIF(cProgressString);
|
|
||||||
if (printfString)
|
if (printfString)
|
||||||
{
|
{
|
||||||
nsString formattedString(printfString);
|
SetStatusMessage(printfString);
|
||||||
SetStatusMessage((PRUnichar *)formattedString.GetUnicode());
|
PR_FREEIF(printfString);
|
||||||
PR_smprintf_free(printfString);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
PR_FREEIF(folderName);
|
||||||
|
PR_FREEIF(msg);
|
||||||
|
|
||||||
if ( (envelopeLine) && (folderIsLocal) )
|
if ( (envelopeLine) && (folderIsLocal) )
|
||||||
{
|
{
|
||||||
PRInt32 len = PL_strlen(envelopeLine);
|
PRInt32 len = PL_strlen(envelopeLine);
|
||||||
|
|
|
@ -336,6 +336,7 @@ public:
|
||||||
nsFileSpec *mTempFileSpec; // our temporary file
|
nsFileSpec *mTempFileSpec; // our temporary file
|
||||||
|
|
||||||
nsOutputFileStream *mOutputFile; // the actual output file stream
|
nsOutputFileStream *mOutputFile; // the actual output file stream
|
||||||
|
PRUint32 mMessageWarningSize; // Warn if a message is over this size!
|
||||||
|
|
||||||
PRBool m_dont_deliver_p; // If set, we just return the nsFileSpec of the file
|
PRBool m_dont_deliver_p; // If set, we just return the nsFileSpec of the file
|
||||||
// created, instead of actually delivering message.
|
// created, instead of actually delivering message.
|
||||||
|
|
|
@ -131,7 +131,7 @@ nsURLFetcher::CanHandleContent(const char * aContentType,
|
||||||
PRBool * aCanHandleContent)
|
PRBool * aCanHandleContent)
|
||||||
|
|
||||||
{
|
{
|
||||||
if (nsCRT::strcasecmp(aContentType, "message/rfc822") == 0)
|
if (nsCRT::strcasecmp(aContentType, MESSAGE_RFC822) == 0)
|
||||||
*aDesiredContentType = nsCRT::strdup("text/html");
|
*aDesiredContentType = nsCRT::strdup("text/html");
|
||||||
|
|
||||||
// since we explicilty loaded the url, we always want to handle it!
|
// since we explicilty loaded the url, we always want to handle it!
|
||||||
|
|
|
@ -199,7 +199,7 @@ CountTotalMimeAttachments(MimeContainer *aObj)
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
ValidateRealName(nsMsgAttachmentData *aAttach)
|
ValidateRealName(nsMsgAttachmentData *aAttach, MimeHeaders *aHdrs)
|
||||||
{
|
{
|
||||||
// Sanity.
|
// Sanity.
|
||||||
if (!aAttach)
|
if (!aAttach)
|
||||||
|
@ -219,6 +219,9 @@ ValidateRealName(nsMsgAttachmentData *aAttach)
|
||||||
if (aAttach->real_type && !nsCRT::strcasecmp(aAttach->real_type, MESSAGE_RFC822) &&
|
if (aAttach->real_type && !nsCRT::strcasecmp(aAttach->real_type, MESSAGE_RFC822) &&
|
||||||
(!aAttach->real_name || *aAttach->real_name == 0))
|
(!aAttach->real_name || *aAttach->real_name == 0))
|
||||||
{
|
{
|
||||||
|
if (aHdrs->munged_subject)
|
||||||
|
mime_SACopy(&(aAttach->real_name), aHdrs->munged_subject);
|
||||||
|
else
|
||||||
mime_SACopy(&(aAttach->real_name), "ForwardedMessage.eml");
|
mime_SACopy(&(aAttach->real_name), "ForwardedMessage.eml");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -360,7 +363,7 @@ BuildAttachmentList(MimeObject *aChild, nsMsgAttachmentData *aAttachData,
|
||||||
PR_FALSE, PR_FALSE);
|
PR_FALSE, PR_FALSE);
|
||||||
|
|
||||||
// Now, do the right thing with the name!
|
// Now, do the right thing with the name!
|
||||||
ValidateRealName(tmp);
|
ValidateRealName(tmp, child->headers);
|
||||||
}
|
}
|
||||||
|
|
||||||
return NS_OK;
|
return NS_OK;
|
||||||
|
|
|
@ -85,6 +85,9 @@ MimeMessageClassInitialize(MimeMessageClass *clazz)
|
||||||
static int
|
static int
|
||||||
MimeMessage_initialize (MimeObject *object)
|
MimeMessage_initialize (MimeObject *object)
|
||||||
{
|
{
|
||||||
|
MimeMessage *msg = (MimeMessage *)object;
|
||||||
|
msg->grabSubject = PR_FALSE;
|
||||||
|
|
||||||
return ((MimeObjectClass*)&MIME_SUPERCLASS)->initialize(object);
|
return ((MimeObjectClass*)&MIME_SUPERCLASS)->initialize(object);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -101,9 +104,16 @@ MimeMessage_finalize (MimeObject *object)
|
||||||
static int
|
static int
|
||||||
MimeMessage_parse_begin (MimeObject *obj)
|
MimeMessage_parse_begin (MimeObject *obj)
|
||||||
{
|
{
|
||||||
|
MimeMessage *msg = (MimeMessage *)obj;
|
||||||
|
|
||||||
int status = ((MimeObjectClass*)&MIME_SUPERCLASS)->parse_begin(obj);
|
int status = ((MimeObjectClass*)&MIME_SUPERCLASS)->parse_begin(obj);
|
||||||
if (status < 0) return status;
|
if (status < 0) return status;
|
||||||
|
|
||||||
|
if (obj->parent)
|
||||||
|
{
|
||||||
|
msg->grabSubject = PR_TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
/* Messages have separators before the headers, except for the outermost
|
/* Messages have separators before the headers, except for the outermost
|
||||||
message. */
|
message. */
|
||||||
return MimeObject_write_separator(obj);
|
return MimeObject_write_separator(obj);
|
||||||
|
@ -123,6 +133,27 @@ MimeMessage_parse_line (char *line, PRInt32 length, MimeObject *obj)
|
||||||
HG11013
|
HG11013
|
||||||
#endif /* MOZ_SECURITY */
|
#endif /* MOZ_SECURITY */
|
||||||
|
|
||||||
|
if (msg->grabSubject)
|
||||||
|
{
|
||||||
|
if ( (!PL_strncasecmp(line, "Subject: ", 9)) && (obj->parent) )
|
||||||
|
{
|
||||||
|
if ( (obj->headers) && (!obj->headers->munged_subject) )
|
||||||
|
{
|
||||||
|
obj->headers->munged_subject = (char *) PL_strndup(line + 9, length - 9);
|
||||||
|
char *tPtr = obj->headers->munged_subject;
|
||||||
|
while (*tPtr)
|
||||||
|
{
|
||||||
|
if ( (*tPtr == CR) || (*tPtr == LF) )
|
||||||
|
{
|
||||||
|
*tPtr = '\0';
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
tPtr++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/* If we already have a child object, then we're done parsing headers,
|
/* If we already have a child object, then we're done parsing headers,
|
||||||
and all subsequent lines get passed to the inferior object without
|
and all subsequent lines get passed to the inferior object without
|
||||||
further processing by us. (Our parent will stop feeding us lines
|
further processing by us. (Our parent will stop feeding us lines
|
||||||
|
|
|
@ -48,6 +48,7 @@ struct MimeMessage {
|
||||||
|
|
||||||
PRBool xlation_msg_signed_p; /* What the emitted xlation-stamp *says*. */
|
PRBool xlation_msg_signed_p; /* What the emitted xlation-stamp *says*. */
|
||||||
PRBool xlation_msg_xlated_p;
|
PRBool xlation_msg_xlated_p;
|
||||||
|
PRBool grabSubject; /* Should we try to grab the subject of this message */
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* _MIMEMSG_H_ */
|
#endif /* _MIMEMSG_H_ */
|
||||||
|
|
|
@ -68,7 +68,7 @@ typedef struct MimeHeaders
|
||||||
the subject header, after it's been
|
the subject header, after it's been
|
||||||
charset-ified and stuff. Remembered so that
|
charset-ified and stuff. Remembered so that
|
||||||
we can later use it to generate the
|
we can later use it to generate the
|
||||||
<TITLE> tag. */
|
<TITLE> tag. (Also works for giving names to RFC822 attachments) */
|
||||||
} MimeHeaders;
|
} MimeHeaders;
|
||||||
|
|
||||||
typedef struct MimeDisplayOptions MimeDisplayOptions;
|
typedef struct MimeDisplayOptions MimeDisplayOptions;
|
||||||
|
|
Загрузка…
Ссылка в новой задаче