зеркало из https://github.com/mozilla/gecko-dev.git
Bug 301084 Option to file replies in folder of original message (backend part)
patch by Emil Hesslow <hesslow@gmail.com> r=dmose sr=bienvenu
This commit is contained in:
Родитель
d2869d5eed
Коммит
4fd4322ac4
|
@ -49,7 +49,7 @@
|
|||
*/
|
||||
|
||||
|
||||
[scriptable, uuid(2b165a14-1ac1-4c32-8cc5-72e2937d5be9)]
|
||||
[scriptable, uuid(e823535a-66b8-4bd4-99cd-cb1cafbfedb6)]
|
||||
interface nsIMsgIdentity : nsISupports {
|
||||
/* internal preferences ID */
|
||||
attribute string key;
|
||||
|
@ -102,6 +102,7 @@ interface nsIMsgIdentity : nsISupports {
|
|||
attribute string fccFolder;
|
||||
|
||||
attribute string fccFolderPickerMode;
|
||||
attribute boolean fccReplyFollowsParent;
|
||||
attribute string draftsFolderPickerMode;
|
||||
attribute string tmplFolderPickerMode;
|
||||
|
||||
|
|
|
@ -474,6 +474,7 @@ NS_IMPL_IDPREF_BOOL(DoFcc, "fcc")
|
|||
|
||||
NS_IMPL_FOLDERPREF_STR(FccFolder, "fcc_folder")
|
||||
NS_IMPL_IDPREF_STR(FccFolderPickerMode, "fcc_folder_picker_mode")
|
||||
NS_IMPL_IDPREF_BOOL(FccReplyFollowsParent, "fcc_reply_follows_parent")
|
||||
NS_IMPL_IDPREF_STR(DraftsFolderPickerMode, "drafts_folder_picker_mode")
|
||||
NS_IMPL_IDPREF_STR(TmplFolderPickerMode, "tmpl_folder_picker_mode")
|
||||
|
||||
|
@ -798,6 +799,8 @@ nsMsgIdentity::Copy(nsIMsgIdentity *identity)
|
|||
COPY_IDENTITY_WSTR_VALUE(identity,GetOrganization,SetOrganization)
|
||||
COPY_IDENTITY_STR_VALUE(identity,GetDraftFolder,SetDraftFolder)
|
||||
COPY_IDENTITY_STR_VALUE(identity,GetFccFolder,SetFccFolder)
|
||||
COPY_IDENTITY_BOOL_VALUE(identity,GetFccReplyFollowsParent,
|
||||
SetFccReplyFollowsParent)
|
||||
COPY_IDENTITY_STR_VALUE(identity,GetStationeryFolder,SetStationeryFolder)
|
||||
COPY_IDENTITY_BOOL_VALUE(identity,GetAttachSignature,SetAttachSignature)
|
||||
COPY_IDENTITY_FILE_VALUE(identity,GetSignature,SetSignature)
|
||||
|
|
|
@ -53,6 +53,7 @@
|
|||
#include "domstubs.idl"
|
||||
#include "nsIPrompt.idl"
|
||||
#include "MailNewsTypes2.idl"
|
||||
#include "nsIMsgComposeParams.idl"
|
||||
|
||||
%{C++
|
||||
#include "nsIURL.h"
|
||||
|
@ -164,7 +165,7 @@ typedef struct nsMsgAttachedFile
|
|||
[ptr] native nsOutputFileStream(nsOutputFileStream);
|
||||
[ptr] native nsCString(nsCString);
|
||||
|
||||
[scriptable, uuid(9E9BD970-C5D6-11d2-8297-000000000000)]
|
||||
[scriptable, uuid(39876de6-207f-43f4-99a7-d60f1c49ea48)]
|
||||
interface nsIMsgSend : nsISupports
|
||||
{
|
||||
//
|
||||
|
@ -203,7 +204,9 @@ interface nsIMsgSend : nsISupports
|
|||
in nsIDOMWindowInternal parentWindow,
|
||||
in nsIMsgProgress progress,
|
||||
in nsIMsgSendListener aListener,
|
||||
in string password
|
||||
in string password,
|
||||
in AUTF8String aOriginalMsgURI,
|
||||
in MSG_ComposeType aType
|
||||
);
|
||||
|
||||
|
||||
|
|
|
@ -926,7 +926,9 @@ nsresult nsMsgCompose::_SendMsg(MSG_DeliverMode deliverMode, nsIMsgIdentity *ide
|
|||
m_window, // nsIDOMWindowInternal *parentWindow;
|
||||
mProgress, // nsIMsgProgress *progress,
|
||||
sendListener, // listener
|
||||
mSmtpPassword.get());
|
||||
mSmtpPassword.get(),
|
||||
mOriginalMsgURI,
|
||||
mType);
|
||||
|
||||
// Cleanup converted body...
|
||||
if (newBody)
|
||||
|
|
|
@ -108,6 +108,9 @@
|
|||
#include "nsNativeCharsetUtils.h"
|
||||
#include "nsIAbCard.h"
|
||||
#include "nsIMsgProgress.h"
|
||||
#include "nsIMsgMessageService.h"
|
||||
#include "nsIMsgHdr.h"
|
||||
#include "nsIMsgFolder.h"
|
||||
|
||||
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
|
||||
|
||||
|
@ -2832,7 +2835,9 @@ int nsMsgComposeAndSend::SetMimeHeader(nsMsgCompFields::MsgHeaderID header, cons
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsMsgComposeAndSend::InitCompositionFields(nsMsgCompFields *fields)
|
||||
nsMsgComposeAndSend::InitCompositionFields(nsMsgCompFields *fields,
|
||||
const nsACString &aOriginalMsgURI,
|
||||
MSG_ComposeType aType)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
const char *pStr = nsnull;
|
||||
|
@ -2915,17 +2920,77 @@ nsMsgComposeAndSend::InitCompositionFields(nsMsgCompFields *fields)
|
|||
// We use default FCC setting if it's not set or was set to an invalid folder.
|
||||
if (useDefaultFCC)
|
||||
{
|
||||
char *uri = GetFolderURIFromUserPrefs(nsMsgDeliverNow, mUserIdentity);
|
||||
if ( (uri) && (*uri) )
|
||||
// Only check whether the user wants the message in the original message
|
||||
// folder if the msgcomptype is some kind of a reply.
|
||||
if (!aOriginalMsgURI.IsEmpty() && (
|
||||
aType == nsIMsgCompType::Reply ||
|
||||
aType == nsIMsgCompType::ReplyAll ||
|
||||
aType == nsIMsgCompType::ReplyToGroup ||
|
||||
aType == nsIMsgCompType::ReplyToSender ||
|
||||
aType == nsIMsgCompType::ReplyToSenderAndGroup ||
|
||||
aType == nsIMsgCompType::ReplyWithTemplate )
|
||||
)
|
||||
{
|
||||
if (PL_strcasecmp(uri, "nocopy://") == 0)
|
||||
mCompFields->SetFcc("");
|
||||
else
|
||||
mCompFields->SetFcc(uri);
|
||||
PL_strfree(uri);
|
||||
nsCOMPtr <nsIMsgAccountManager> accountManager =
|
||||
do_GetService(NS_MSGACCOUNTMANAGER_CONTRACTID, &rv);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsCOMPtr <nsIMsgDBHdr> msgHdr;
|
||||
rv = GetMsgDBHdrFromURI(PromiseFlatCString(aOriginalMsgURI).get(),
|
||||
getter_AddRefs(msgHdr));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsCOMPtr <nsIMsgFolder> folder;
|
||||
msgHdr->GetFolder(getter_AddRefs(folder));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
PRBool canFileMessages;
|
||||
rv = folder->GetCanFileMessages(&canFileMessages);
|
||||
if (NS_SUCCEEDED(rv) && canFileMessages)
|
||||
{
|
||||
nsCOMPtr <nsIMsgIncomingServer> incomingServer;
|
||||
rv = folder->GetServer(getter_AddRefs(incomingServer));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
nsXPIDLCString incomingServerType;
|
||||
rv = incomingServer->GetCharValue("type",
|
||||
getter_Copies(incomingServerType));
|
||||
// Exclude RSS accounts, as they falsely report
|
||||
// 'canFileMessages' = true
|
||||
if (NS_SUCCEEDED(rv) && !incomingServerType.Equals("rss"))
|
||||
{
|
||||
PRBool fccReplyFollowsParent;
|
||||
rv = mUserIdentity->GetFccReplyFollowsParent(
|
||||
&fccReplyFollowsParent);
|
||||
if (NS_SUCCEEDED(rv) && fccReplyFollowsParent)
|
||||
{
|
||||
nsXPIDLCString folderURI;
|
||||
rv = folder->GetURI(getter_Copies(folderURI));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
mCompFields->SetFcc(folderURI.get());
|
||||
useDefaultFCC = PR_FALSE;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (useDefaultFCC)
|
||||
{
|
||||
char *uri = GetFolderURIFromUserPrefs(nsMsgDeliverNow, mUserIdentity);
|
||||
if ( (uri) && (*uri) )
|
||||
{
|
||||
mCompFields->SetFcc(PL_strcasecmp(uri, "nocopy://") ? uri : "");
|
||||
PL_strfree(uri);
|
||||
}
|
||||
else
|
||||
mCompFields->SetFcc("");
|
||||
}
|
||||
else
|
||||
mCompFields->SetFcc("");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -3138,7 +3203,9 @@ nsMsgComposeAndSend::Init(
|
|||
PRUint32 attachment1_body_length,
|
||||
const nsMsgAttachmentData *attachments,
|
||||
const nsMsgAttachedFile *preloaded_attachments,
|
||||
const char *password)
|
||||
const char *password,
|
||||
const nsACString &aOriginalMsgURI,
|
||||
MSG_ComposeType aType)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
|
@ -3181,7 +3248,7 @@ nsMsgComposeAndSend::Init(
|
|||
if (!fields)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
rv = InitCompositionFields(fields);
|
||||
rv = InitCompositionFields(fields, aOriginalMsgURI, aType);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
|
||||
|
@ -4055,7 +4122,9 @@ nsMsgComposeAndSend::CreateAndSendMessage(
|
|||
nsIDOMWindowInternal *parentWindow,
|
||||
nsIMsgProgress *progress,
|
||||
nsIMsgSendListener *aListener,
|
||||
const char *password
|
||||
const char *password,
|
||||
const nsACString &aOriginalMsgURI,
|
||||
MSG_ComposeType aType
|
||||
)
|
||||
{
|
||||
nsresult rv;
|
||||
|
@ -4084,7 +4153,7 @@ nsMsgComposeAndSend::CreateAndSendMessage(
|
|||
attachment1_type, attachment1_body,
|
||||
attachment1_body_length,
|
||||
attachments, preloaded_attachments,
|
||||
password);
|
||||
password, aOriginalMsgURI, aType);
|
||||
|
||||
if (NS_FAILED(rv) && mSendReport)
|
||||
mSendReport->SetError(nsIMsgSendReport::process_Current, rv, PR_FALSE);
|
||||
|
@ -4155,7 +4224,7 @@ nsMsgComposeAndSend::SendMessageFile(
|
|||
digest_p, PR_FALSE, mode, msgToReplace,
|
||||
nsnull, nsnull, nsnull,
|
||||
nsnull, nsnull,
|
||||
password);
|
||||
password, EmptyCString(), nsnull);
|
||||
|
||||
if (NS_SUCCEEDED(rv))
|
||||
rv = DeliverMessage();
|
||||
|
|
|
@ -256,12 +256,17 @@ public:
|
|||
PRUint32 attachment1_body_length,
|
||||
const nsMsgAttachmentData *attachments,
|
||||
const nsMsgAttachedFile *preloaded_attachments,
|
||||
const char *password);
|
||||
const char *password,
|
||||
const nsACString &aOriginalMsgURI,
|
||||
MSG_ComposeType aType);
|
||||
|
||||
//
|
||||
// Setup the composition fields
|
||||
//
|
||||
nsresult InitCompositionFields(nsMsgCompFields *fields);
|
||||
nsresult InitCompositionFields(nsMsgCompFields *fields,
|
||||
const nsACString &aOriginalMsgURI,
|
||||
MSG_ComposeType aType);
|
||||
|
||||
int SetMimeHeader(nsMsgCompFields::MsgHeaderID header, const char *value);
|
||||
NS_IMETHOD GetBodyFromEditor();
|
||||
|
||||
|
|
|
@ -717,7 +717,9 @@ nsresult nsEudoraCompose::SendTheMessage( nsIFileSpec *pMsg)
|
|||
nsnull, // parent window
|
||||
nsnull, // progress listener
|
||||
m_pListener, // listener
|
||||
nsnull); // password
|
||||
nsnull, // password
|
||||
EmptyCString(), // originalMsgURI
|
||||
nsnull); // message compose type
|
||||
|
||||
}
|
||||
else {
|
||||
|
@ -739,7 +741,9 @@ nsresult nsEudoraCompose::SendTheMessage( nsIFileSpec *pMsg)
|
|||
nsnull, // parent window
|
||||
nsnull, // progress listener
|
||||
m_pListener, // listener
|
||||
nsnull); // password
|
||||
nsnull, // password
|
||||
EmptyCString(), // originalMsgURI
|
||||
nsnull); // message compose type
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -685,7 +685,9 @@ nsresult nsOutlookCompose::SendTheMessage( nsIFileSpec *pMsg, nsMsgDeliverMode m
|
|||
nsnull, // parent window
|
||||
nsnull, // progress listener
|
||||
m_pListener, // listener
|
||||
nsnull); // password
|
||||
nsnull, // password
|
||||
EmptyCString(), // originalMsgURI
|
||||
nsnull); // message compose type
|
||||
|
||||
|
||||
// IMPORT_LOG0( "Returned from CreateAndSendMessage\n");
|
||||
|
|
|
@ -365,6 +365,7 @@ pref("mail.identity.default.compose_html", true);
|
|||
pref("mail.identity.default.valid", true);
|
||||
pref("mail.identity.default.fcc",true);
|
||||
pref("mail.identity.default.fcc_folder","mailbox://nobody@Local%20Folders/Sent");
|
||||
pref("mail.identity.default.fcc_reply_follows_parent", false);
|
||||
pref("mail.identity.default.autocompleteToMyDomain", false);
|
||||
|
||||
// keep these defaults for backwards compatibility and migration
|
||||
|
|
Загрузка…
Ссылка в новой задаче