implemented forward messages as attachments & inline; a=mcafee

This commit is contained in:
jefft%netscape.com 1999-09-29 20:43:50 +00:00
Родитель 05b59149b9
Коммит 0d7587bd28
19 изменённых файлов: 378 добавлений и 126 удалений

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

@ -264,19 +264,28 @@ function MsgReplyToAllMessage()
function MsgForwardMessage()
{
dump("\nMsgForwardMessage from XUL\n");
MsgForwardAsInline();
var tree = GetThreadTree();
//get the selected elements
var messageList = tree.selectedItems;
messenger.forwardMessages(messageList, -1);
}
function MsgForwardAsAttachment()
{
dump("\nMsgForwardAsAttachment from XUL\n");
ComposeMessage(4, 0);
var tree = GetThreadTree();
//get the selected elements
var messageList = tree.selectedItems;
messenger.forwardMessages(messageList, 0);
}
function MsgForwardAsInline()
{
dump("\nMsgForwardAsInline from XUL\n");
ComposeMessage(3, 0);
var tree = GetThreadTree();
//get the selected elements
var messageList = tree.selectedItems;
messenger.forwardMessages(messageList, 1);
}
function MsgCopyMessage(destFolder)

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

@ -92,6 +92,10 @@
#include "nsEscape.h"
#include "nsIStreamListener.h"
#include "nsIStreamConverterService.h"
#include "nsIMsgCompose.h"
#include "nsIMsgCompFields.h"
#include "nsIMsgComposeService.h"
#include "nsMsgCompFieldsFact.h"
static NS_DEFINE_CID(kIStreamConverterServiceCID, NS_STREAMCONVERTERSERVICE_CID);
static NS_DEFINE_CID(kIOServiceCID, NS_IOSERVICE_CID);
@ -109,6 +113,9 @@ static NS_DEFINE_CID(kPrintPreviewContextCID, NS_PRINT_PREVIEW_CONTEXT_CID);
static NS_DEFINE_IID(kIPresContextIID, NS_IPRESCONTEXT_IID);
static NS_DEFINE_CID(kPrefServiceCID, NS_PREF_CID);
static NS_DEFINE_CID(kMsgCopyServiceCID, NS_MSGCOPYSERVICE_CID);
static NS_DEFINE_CID(kMsgComposeServiceCID, NS_MSGCOMPOSESERVICE_CID);
static NS_DEFINE_CID(kMsgComposeCID, NS_MSGCOMPOSE_CID);
static NS_DEFINE_CID(kMsgCompFieldsCID, NS_MSGCOMPFIELDS_CID);
#if defined(DEBUG_seth_) || defined(DEBUG_sspitzer_) || defined(DEBUG_jefft)
#define DEBUG_MESSENGER
@ -794,7 +801,6 @@ NS_IMETHODIMP
nsMessenger::CopyMessages(nsIRDFCompositeDataSource *database, nsIDOMXULElement *srcFolderElement,
nsIDOMXULElement *dstFolderElement, nsIDOMNodeList *messages, PRBool isMove)
{
#if 1
nsresult rv;
if(!srcFolderElement || !dstFolderElement || !messages)
@ -836,76 +842,6 @@ nsMessenger::CopyMessages(nsIRDFCompositeDataSource *database, nsIDOMXULElement
rv = DoCommand(database, isMove ? (char *)NC_RDF_MOVE : (char *)NC_RDF_COPY, folderArray, argumentArray);
return rv;
#else
nsresult rv;
if(!srcFolderElement || !dstFolderElement || !messages)
return NS_ERROR_NULL_POINTER;
nsCOMPtr<nsIRDFResource> srcResource, dstResource;
nsCOMPtr<nsICopyMessageListener> dstFolder;
nsCOMPtr<nsIMsgFolder> srcFolder;
nsCOMPtr<nsISupportsArray> resourceArray;
rv = dstFolderElement->GetResource(getter_AddRefs(dstResource));
if(NS_FAILED(rv))
return rv;
dstFolder = do_QueryInterface(dstResource);
if(!dstFolder)
return NS_ERROR_NO_INTERFACE;
rv = srcFolderElement->GetResource(getter_AddRefs(srcResource));
if(NS_FAILED(rv))
return rv;
srcFolder = do_QueryInterface(srcResource);
if(!srcFolder)
return NS_ERROR_NO_INTERFACE;
rv =ConvertDOMListToResourceArray(messages, getter_AddRefs(resourceArray));
if(NS_FAILED(rv))
return rv;
//Call the mailbox service to copy first message. In the future we should call CopyMessages.
//And even more in the future we need to distinguish between the different types of URI's, i.e.
//local, imap, and news, and call the appropriate copy function.
PRUint32 cnt;
rv = resourceArray->Count(&cnt);
if (NS_SUCCEEDED(rv) && cnt > 0)
{
nsCOMPtr<nsISupports> msgSupports = getter_AddRefs(resourceArray->ElementAt(0));
nsCOMPtr<nsIRDFResource> firstMessage(do_QueryInterface(msgSupports));
char *uri;
firstMessage->GetValue(&uri);
nsCOMPtr<nsICopyMessageStreamListener> copyStreamListener;
rv = nsComponentManager::CreateInstance(kCopyMessageStreamListenerCID, NULL,
nsCOMTypeInfo<nsICopyMessageStreamListener>::GetIID(),
getter_AddRefs(copyStreamListener));
if(NS_FAILED(rv))
return rv;
rv = copyStreamListener->Init(srcFolder, dstFolder, nsnull);
if(NS_FAILED(rv))
return rv;
nsIMsgMessageService * messageService = nsnull;
rv = GetMessageServiceFromURI(uri, &messageService);
if (NS_SUCCEEDED(rv) && messageService)
{
nsIURI * url = nsnull;
nsCOMPtr<nsIStreamListener> streamListener(do_QueryInterface(copyStreamListener));
if(!streamListener)
return NS_ERROR_NO_INTERFACE;
messageService->CopyMessage(uri, streamListener, isMove, nsnull, &url);
ReleaseMessageServiceFromURI(uri, messageService);
}
}
return rv;
#endif
}
NS_IMETHODIMP
@ -1441,7 +1377,7 @@ nsMessenger::LoadFirstDraft()
// This should really pass in a URI, but for now, just to test, we can pass in nsnull
rv = pMsgDraft->OpenDraftMsg(nsnull, nsnull);
rv = pMsgDraft->OpenDraftMsg(nsnull, nsnull, PR_FALSE);
}
return rv;
@ -1646,3 +1582,141 @@ nsSaveAsListener::OnDataAvailable(nsIChannel* aChannel,
}
return rv;
}
// **** ForwardMessages ****
// type: -1: base on prefs 0: as attachment 1: as quoted 2: as inline
NS_IMETHODIMP
nsMessenger::ForwardMessages(nsIDOMNodeList *domNodeList,
PRInt32 type)
{
nsresult rv = NS_ERROR_NULL_POINTER;
nsCOMPtr<nsISupportsArray> messageArray;
if (!domNodeList) return rv;
rv = ConvertDOMListToResourceArray(domNodeList,
getter_AddRefs(messageArray));
if (NS_FAILED(rv)) return rv;
PRUint32 cnt = 0, i;
rv = messageArray->Count(&cnt);
if (NS_FAILED(rv)) return rv;
if (!cnt) return NS_ERROR_NULL_POINTER;
if (type < 0 || type > 2)
{
NS_WITH_SERVICE(nsIPref, prefs, kPrefServiceCID, &rv);
if (NS_FAILED(rv)) return rv;
rv = prefs->GetIntPref("mail.forward_message_mode", &type);
if (NS_FAILED(rv)) return rv;
}
NS_WITH_SERVICE(nsIMsgMailSession, mailSession, kCMsgMailSessionCID, &rv);
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIMsgIdentity> identity;
rv = mailSession->GetCurrentIdentity(getter_AddRefs(identity));
if (NS_FAILED(rv)) return rv;
NS_WITH_SERVICE (nsIMsgComposeService, composeService,
kMsgComposeServiceCID, &rv);
if (NS_FAILED(rv)) return rv;
NS_WITH_SERVICE (nsIComponentManager, compMgr, kComponentManagerCID, &rv);
if (NS_FAILED(rv)) return rv;
nsCOMPtr<nsIMsgCompFields> compFields;
nsCOMPtr<nsIRDFResource> rdfResource;
nsCOMPtr<nsISupports> msgSupport;
char *msgUri = nsnull;
switch (type)
{
case 0: // forward as attachments
{
if (NS_SUCCEEDED(rv))
{
rv = compMgr->CreateInstance(kMsgCompFieldsCID, nsnull,
nsCOMTypeInfo<nsIMsgCompFields>::GetIID(),
getter_AddRefs(compFields));
if (NS_FAILED(rv)) return rv;
}
nsString attachments;
for (i=0; i<cnt; i++)
{
msgSupport = getter_AddRefs(messageArray->ElementAt(i));
if (msgSupport)
{
rdfResource = do_QueryInterface(msgSupport, &rv);
if (NS_SUCCEEDED(rv))
{
rv = rdfResource->GetValue(&msgUri);
if (msgUri)
{
if (attachments.Length())
attachments += ',';
attachments += msgUri;
nsCRT::free(msgUri);
}
}
}
}
nsString subject;
nsString fwdSubject;
msgSupport = getter_AddRefs(messageArray->ElementAt(0));
nsCOMPtr<nsIDBMessage> aMessage = do_QueryInterface(msgSupport);
if (aMessage)
{
nsCOMPtr<nsIMsgDBHdr> aMsgHdr;
aMessage->GetMsgDBHdr(getter_AddRefs(aMsgHdr));
if (aMsgHdr)
{
aMsgHdr->GetSubject(&subject);
fwdSubject = "[Fwd: ";
fwdSubject += subject;
fwdSubject += "]";
}
}
if (fwdSubject.Length())
compFields->SetSubject(fwdSubject.ToNewUnicode());
compFields->SetAttachments(attachments.ToNewUnicode());
rv = composeService->OpenComposeWindowWithCompFields(nsnull,
MSGCOMP_FORMAT_Default, compFields);
break;
}
case 1: // forward as inline
{
for (i=0; i<cnt; i++)
{
msgSupport = getter_AddRefs(messageArray->ElementAt(i));
if (msgSupport)
{
rdfResource = do_QueryInterface(msgSupport, &rv);
if(NS_SUCCEEDED(rv))
{
rv = rdfResource->GetValue(&msgUri);
if (NS_SUCCEEDED(rv) && msgUri)
{
nsAutoString str (msgUri);
nsCOMPtr<nsIMsgDraft> pMsgDraft;
rv = compMgr->CreateInstance(kMsgDraftCID,
nsnull,
nsCOMTypeInfo<nsIMsgDraft>::GetIID(),
getter_AddRefs(pMsgDraft));
if (NS_SUCCEEDED(rv) && pMsgDraft)
pMsgDraft->OpenDraftMsg(str.ToNewUnicode(),
nsnull, PR_TRUE);
}
}
}
}
break;
}
default:
{
rv = NS_ERROR_FAILURE;
break;
}
}
return rv;
}

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

@ -35,8 +35,8 @@ enum
MSGCOMP_TYPE_New = 0,
MSGCOMP_TYPE_Reply,
MSGCOMP_TYPE_ReplyAll,
MSGCOMP_TYPE_ForwardInline,
MSGCOMP_TYPE_ForwardAsAttachment
MSGCOMP_TYPE_ForwardAsAttachment,
MSGCOMP_TYPE_ForwardInline
};
%}

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

@ -34,7 +34,8 @@ interface nsIMsgDraft : nsISupports
* This is the primary interface for drafts and templates, loaded by
* a URI
*/
void OpenDraftMsg(in wstring msgURI, out nsIMessage aMsgToReplace);
void OpenDraftMsg(in wstring msgURI, out nsIMessage aMsgToReplace,
in PRBool addInlineHeaders);
void OpenEditorTemplate(in wstring msgURI, out nsIMessage aMsgReplace);
};

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

@ -220,6 +220,14 @@ function ComposeStartup()
if (subjectValue != "") {
document.getElementById("msgSubject").value = subjectValue;
}
var attachmentValue = msgCompFields.GetAttachments();
if (attachmentValue != "") {
var atts = attachmentValue.split(",");
for (var i=0; i < atts.length; i++)
{
AddAttachment(atts[i]);
}
}
}
// Now that we have an Editor AppCore, we can finish to initialize the Compose AppCore

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

@ -27,6 +27,8 @@
#include "nsMimeTypes.h"
#include "nsMsgComposeStringBundle.h"
#include "nsXPIDLString.h"
#include "nsIMsgMessageService.h"
#include "nsMsgUtils.h"
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
@ -110,10 +112,12 @@ nsMsgAttachmentHandler::nsMsgAttachmentHandler()
#endif
mDeleteFile = PR_FALSE;
m_uri = nsnull;
}
nsMsgAttachmentHandler::~nsMsgAttachmentHandler()
{
PR_FREEIF(m_uri);
}
void
@ -413,6 +417,60 @@ FetcherURLDoneCallback(nsIURI* aURL, nsresult aStatus,
else
return NS_OK;
}
nsresult
nsMsgAttachmentHandler::SnarfMsgAttachment(nsMsgCompFields *compFields)
{
nsresult rv = NS_ERROR_INVALID_ARG;
nsIMsgMessageService *messageService = nsnull;
if (PL_strcasestr(m_uri, "_message:"))
{
mFileSpec = nsMsgCreateTempFileSpec("nsmail.tmp");
mCompFields = compFields;
PR_FREEIF(m_real_name);
m_real_name = PL_strdup("forward.msg");
PR_FREEIF(m_type);
m_type = PL_strdup("message/rfc822");
PR_FREEIF(m_override_type);
m_override_type = PL_strdup("message/rfc822");
if (!mFileSpec)
{
rv = NS_ERROR_FAILURE;
goto done;
}
mOutFile = new nsOutputFileStream(*mFileSpec, PR_WRONLY | PR_CREATE_FILE);
if (!mOutFile)
{
rv = NS_MSG_UNABLE_TO_OPEN_TMP_FILE;
goto done;
}
mFetcher = new nsURLFetcher();
if (!mFetcher)
{
rv = NS_ERROR_OUT_OF_MEMORY;
goto done;
}
NS_ADDREF(mFetcher); // to keep us around; very awkward way
rv = mFetcher->Initialize(mOutFile, FetcherURLDoneCallback, this);
rv = GetMessageServiceFromURI(m_uri, &messageService);
if (NS_SUCCEEDED(rv) && messageService)
rv = messageService->DisplayMessage(m_uri, mFetcher, nsnull, nsnull);
}
done:
if (NS_FAILED(rv))
{
mOutFile->close();
delete mOutFile;
mOutFile = nsnull;
mFileSpec->Delete(PR_FALSE);
delete mFileSpec;
mFileSpec = nsnull;
}
if (messageService)
ReleaseMessageServiceFromURI(m_uri, messageService);
return rv;
}
nsresult
nsMsgAttachmentHandler::SnarfAttachment(nsMsgCompFields *compFields)
@ -424,7 +482,7 @@ nsMsgAttachmentHandler::SnarfAttachment(nsMsgCompFields *compFields)
NS_ASSERTION (! m_done, "Already done");
if (!mURL)
return NS_ERROR_INVALID_ARG;
return SnarfMsgAttachment(compFields);
tempName = GenerateFileNameFromURI(mURL); // Make it a sane name

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

@ -42,6 +42,7 @@ public:
//////////////////////////////////////////////////////////////////////
//
nsresult SnarfAttachment(nsMsgCompFields *compFields);
nsresult SnarfMsgAttachment(nsMsgCompFields *compFields);
nsresult UrlExit(nsresult status, const PRUnichar* aMsg);
PRBool UseUUEncode_p(void);
@ -116,6 +117,7 @@ public:
PRBool m_file_analyzed;
MimeEncoderData *m_encoder_data; /* Opaque state for base64/qp encoder. */
char * m_uri; // original uri string
};

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

@ -67,6 +67,7 @@ nsMsgDraft::nsMsgDraft()
mURI = nsnull;
mMessageService = nsnull;
mOutType = nsMimeOutput::nsMimeMessageDraftOrTemplate;
mAddInlineHeaders = PR_FALSE;
}
nsMsgDraft::~nsMsgDraft()
@ -257,7 +258,11 @@ SaveDraftMessageCompleteCallback(nsIURI *aURL, nsresult aExitCode, void *tagData
// Set us as the output stream for HTML data from libmime...
nsCOMPtr<nsIMimeStreamConverter> mimeConverter = do_QueryInterface(mimeParser);
if (mimeConverter)
mimeConverter->SetMimeOutputType(ptr->mOutType); // Set the type of output for libmime
{
mimeConverter->SetMimeOutputType(ptr->mOutType); // Set the type of
// output for libmime
mimeConverter->SetForwardInline(ptr->mAddInlineHeaders);
}
nsCOMPtr<nsIChannel> dummyChannel;
NS_WITH_SERVICE(nsIIOService, netService, kIOServiceCID, &rv);
@ -359,7 +364,8 @@ nsresult rv;
}
nsresult
nsMsgDraft::OpenDraftMsg(const PRUnichar *msgURI, nsIMessage **aMsgToReplace)
nsMsgDraft::OpenDraftMsg(const PRUnichar *msgURI, nsIMessage **aMsgToReplace,
PRBool addInlineHeaders)
{
PRUnichar *HackUpAURIToPlayWith(void); // RICHIE - forward declare for now
@ -369,6 +375,7 @@ PRUnichar *HackUpAURIToPlayWith(void); // RICHIE - forward declare for
msgURI = HackUpAURIToPlayWith();
}
mAddInlineHeaders = addInlineHeaders;
return ProcessDraftOrTemplateOperation(msgURI, nsMimeOutput::nsMimeMessageDraftOrTemplate,
aMsgToReplace);
}

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

@ -34,7 +34,9 @@ public:
NS_DECL_ISUPPORTS
/* long QuoteMessage (in wstring msgURI, in nsIOutputStream outStream, nsIMessage **aMsgToReplace); */
NS_IMETHOD OpenDraftMsg(const PRUnichar *msgURI, nsIMessage **aMsgToReplace);
NS_IMETHOD OpenDraftMsg(const PRUnichar *msgURI,
nsIMessage **aMsgToReplace,
PRBool addInlineHeaders);
/* long QuoteMessage (in wstring msgURI, in nsIOutputStream outStream, nsIMessage **aMsgToReplace); */
NS_IMETHOD OpenEditorTemplate(const PRUnichar *msgURI, nsIMessage **aMsgToReplace);
@ -50,6 +52,7 @@ public:
char *mURI;
nsIMsgMessageService *mMessageService;
nsMimeOutputType mOutType;
PRBool mAddInlineHeaders;
};
// Will be used by factory to generate a nsMsgQuote class...

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

@ -1138,18 +1138,24 @@ nsMsgComposeAndSend::PreProcessPart(nsMsgAttachmentHandler *ma,
part->SetPartSeparator(aSeparator);
nsXPIDLCString turl;
ma->mURL->GetSpec(getter_Copies(turl));
hdrs = mime_generate_attachment_headers (ma->m_type, ma->m_encoding,
ma->m_description,
ma->m_x_mac_type,
ma->m_x_mac_creator,
ma->m_real_name,
turl,
m_digest_p,
ma,
ma->m_charset, // rhp - this needs to be the charset we determine from
// the file or none at all!
ma->m_content_id);
if (!ma->mURL)
turl.Copy(ma->m_uri);
else
ma->mURL->GetSpec(getter_Copies(turl));
hdrs = mime_generate_attachment_headers (ma->m_type, ma->m_encoding,
ma->m_description,
ma->m_x_mac_type,
ma->m_x_mac_creator,
ma->m_real_name,
turl,
m_digest_p,
ma,
ma->m_charset, // rhp - this needs
// to be the charset
// we determine from
// the file or none
// at all!
ma->m_content_id);
if (!hdrs)
return 0;
@ -1657,6 +1663,9 @@ nsMsgComposeAndSend::AddCompFieldLocalAttachments()
{
#ifdef NS_DEBUG
printf("Adding LOCAL attachment %d: %s\n", newLoc, str.GetBuffer());
#endif
#ifdef XP_WIN
str.ReplaceChar('|', ':');
#endif
//
// Now we have to setup the m_attachments entry for the file://
@ -1771,28 +1780,31 @@ nsMsgComposeAndSend::AddCompFieldRemoteAttachments(PRUint32 aStartLocation,
nsMsgNewURL(&(m_attachments[newLoc].mURL), str);
PR_FREEIF(m_attachments[newLoc].m_charset);
m_attachments[newLoc].m_charset = PL_strdup (mCompFields->GetCharacterSet());
PR_FREEIF(m_attachments[newLoc].m_encoding);
m_attachments[newLoc].m_encoding = PL_strdup ("7bit");
PR_FREEIF(m_attachments[newLoc].m_charset);
m_attachments[newLoc].m_charset = PL_strdup(mCompFields->GetCharacterSet());
PR_FREEIF(m_attachments[newLoc].m_encoding);
m_attachments[newLoc].m_encoding = PL_strdup ("7bit");
/* Count up attachments which are going to come from mail folders
and from NNTP servers. */
/* Count up attachments which are going to come from mail folders
and from NNTP servers. */
nsXPIDLCString turl;
if (m_attachments[newLoc].mURL)
{
m_attachments[newLoc].mURL->GetSpec(getter_Copies(turl));
if (PL_strncasecmp(turl, "mailbox:",8) ||
PL_strncasecmp(turl, "IMAP:",5))
(*aMailboxCount)++;
else
if (PL_strncasecmp(turl, "news:",5) ||
PL_strncasecmp(turl, "snews:",6))
(*aNewsCount)++;
msg_pick_real_name(&m_attachments[newLoc],
mCompFields->GetCharacterSet());
++newLoc;
}
else if (str.Find("_message:") != -1)
{
if (str.Find("mailbox_message:") != -1 ||
str.Find("imap_message:") != -1)
(*aMailboxCount)++;
else if (str.Find("news_message:") != -1 ||
str.Find("snews_message:") != -1)
(*aNewsCount)++;
msg_pick_real_name(&m_attachments[newLoc], mCompFields->GetCharacterSet());
++newLoc;
m_attachments[newLoc].m_uri = str.ToNewCString();
++newLoc;
}
}

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

@ -163,6 +163,23 @@ nsURLFetcher::OnStopRequest(nsIChannel *aChannel, nsISupports * /* ctxt */, nsre
return NS_OK;
}
nsresult
nsURLFetcher::Initialize(nsOutputFileStream *fOut,
nsAttachSaveCompletionCallback cb,
void *tagData)
{
if (!fOut)
return NS_ERROR_INVALID_ARG;
if (!fOut->is_open())
return NS_ERROR_FAILURE;
mOutStream = fOut;
mCallback = cb;
mTagData = tagData;
return NS_OK;
}
nsresult
nsURLFetcher::FireURLRequest(nsIURI *aURL, nsOutputFileStream *fOut,
nsAttachSaveCompletionCallback cb, void *tagData)

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

@ -1,4 +1,4 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
@ -49,6 +49,9 @@ public:
NS_IMETHOD FireURLRequest(nsIURI *aURL, nsOutputFileStream *fOut,
nsAttachSaveCompletionCallback cb, void *tagData);
NS_IMETHOD Initialize(nsOutputFileStream *fOut,
nsAttachSaveCompletionCallback cb,
void *tagData);
// Methods for nsIStreamListener
NS_DECL_NSISTREAMLISTENER

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

@ -340,6 +340,7 @@ nsImapMoveCopyMsgTxn::UndoMailboxDelete()
}
}
}
srcDB->SetSummaryValid(PR_TRUE);
srcDB->Commit(nsMsgDBCommitType::kLargeCommit);
return NS_OK; // always return NS_OK
}
@ -362,6 +363,7 @@ nsImapMoveCopyMsgTxn::RedoMailboxDelete()
if (NS_SUCCEEDED(rv))
{
srcDB->DeleteMessages(&m_srcKeyArray, nsnull);
srcDB->SetSummaryValid(PR_TRUE);
srcDB->Commit(nsMsgDBCommitType::kLargeCommit);
}
return NS_OK; // always return NS_OK

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

@ -1705,6 +1705,7 @@ NS_IMETHODIMP nsMsgLocalMailFolder::EndCopy(PRBool copySucceeded)
rv = mDatabase->CopyHdrFromExistingHdr(mCopyState->m_curDstKey,
msgDBHdr,
getter_AddRefs(newHdr));
mDatabase->SetSummaryValid(PR_TRUE);
mDatabase->Commit(nsMsgDBCommitType::kLargeCommit);
}
}
@ -1750,6 +1751,7 @@ NS_IMETHODIMP nsMsgLocalMailFolder::EndCopy(PRBool copySucceeded)
newHdr->GetMessageSize(&msgSize);
localUndoTxn->AddDstMsgSize(msgSize);
}
msgDb->SetSummaryValid(PR_TRUE);
msgDb->Commit(nsMsgDBCommitType::kLargeCommit);
}
}

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

@ -267,10 +267,12 @@ nsLocalMoveCopyMsgTxn::Undo()
}
}
}
srcDB->SetSummaryValid(PR_TRUE);
srcDB->Commit(nsMsgDBCommitType::kLargeCommit);
}
dstDB->DeleteMessages(&m_dstKeyArray, nsnull);
dstDB->SetSummaryValid(PR_TRUE);
dstDB->Commit(nsMsgDBCommitType::kLargeCommit);
return rv;
@ -314,6 +316,7 @@ nsLocalMoveCopyMsgTxn::Redo()
}
}
}
dstDB->SetSummaryValid(PR_TRUE);
dstDB->Commit(nsMsgDBCommitType::kLargeCommit);
if (m_isMove)
@ -325,6 +328,7 @@ nsLocalMoveCopyMsgTxn::Redo()
else
{
rv = srcDB->DeleteMessages(&m_srcKeyArray, nsnull);
srcDB->SetSummaryValid(PR_TRUE);
srcDB->Commit(nsMsgDBCommitType::kLargeCommit);
}
}

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

@ -71,4 +71,9 @@ interface nsIMimeStreamConverter : nsISupports {
* This is used to extract headers while parsing a message
*/
void SetMimeHeadersListener(in nsIMimeStreamConverterListener listener);
/*
* This is used for forward inline
*/
attribute PRBool forwardInline;
};

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

@ -181,7 +181,9 @@ struct mime_draft_data
nsOutputFileStream *tmpFileStream; // output file handle
MimeDecoderData *decoder_data;
char *mailcharset; // get it from CHARSET of Content-Type
char *mailcharset; // get it from CHARSET of
// Content-Type
PRBool forwardInline;
};
// RICHIE - PROBABLY BELONGS IN A HEADER SOMEWHERE!!!
@ -245,7 +247,31 @@ printf("RICHIE: Need to do something with the attachment data!!!!\n");
mime_dump_attachments ( attachmentList );
#endif
NS_WITH_SERVICE(nsIMsgComposeService, msgComposeService, kCMsgComposeServiceCID, &rv);
nsMsgAttachmentData *curAttachment = attachmentList;
if (curAttachment)
{
nsString attachments;
char* spec = nsnull;
while (curAttachment && curAttachment->real_name)
{
rv = curAttachment->url->GetSpec(&spec);
if (NS_SUCCEEDED(rv) && spec)
{
if (attachments.Length())
attachments += ',';
attachments += spec;
nsCRT::free(spec);
spec = nsnull;
}
curAttachment++;
}
if (attachments.Length())
compFields->SetAttachments(attachments.ToNewUnicode());
}
NS_WITH_SERVICE(nsIMsgComposeService, msgComposeService,
kCMsgComposeServiceCID, &rv);
if ((NS_FAILED(rv)) || (!msgComposeService))
return rv;
@ -1111,7 +1137,8 @@ mime_parse_stream_complete (nsMIMESession *stream)
// We need to figure out how to pass the forwarded flag along with this
// operation.
// forward_inline = (mdd->format_out != FO_CMDLINE_ATTACHMENTS);
//forward_inline = (mdd->format_out != FO_CMDLINE_ATTACHMENTS);
forward_inline = mdd->forwardInline;
if (forward_inline)
{
#ifdef MOZ_SECURITY
@ -1657,11 +1684,15 @@ mime_decompose_file_init_fn ( void *stream_closure, MimeHeaders *headers )
if (tmpSpecStr)
{
char *slashPtr = tmpSpecStr;
char *slashPtr = tmpSpecStr+7;
while (*slashPtr)
{
if (*slashPtr == '\\')
*slashPtr = '/';
#ifdef XP_WIN
if (*slashPtr == ':')
*slashPtr = '|';
#endif
slashPtr++;
}
@ -1810,6 +1841,7 @@ mime_bridge_create_draft_stream(
}
}
newPluginObj2->GetForwardInline(&mdd->forwardInline);
mdd->format_out = format_out;
mdd->options = PR_NEWZAP ( MimeDisplayOptions );
if ( !mdd->options )

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

@ -335,6 +335,7 @@ nsStreamConverter::nsStreamConverter()
mDoneParsing = PR_FALSE;
mAlreadyKnowOutputType = PR_FALSE;
mMimeStreamConverterListener = nsnull;
mForwardInline = PR_FALSE;
}
nsStreamConverter::~nsStreamConverter()
@ -559,6 +560,21 @@ nsStreamConverter::SetMimeHeadersListener(nsIMimeStreamConverterListener *listen
return NS_OK;
}
NS_IMETHODIMP
nsStreamConverter::SetForwardInline(PRBool forwardInline)
{
mForwardInline = forwardInline;
return NS_OK;
}
NS_IMETHODIMP
nsStreamConverter::GetForwardInline(PRBool *result)
{
if (!result) return NS_ERROR_NULL_POINTER;
*result = mForwardInline;
return NS_OK;
}
/////////////////////////////////////////////////////////////////////////////
// Methods for nsIStreamListener...
/////////////////////////////////////////////////////////////////////////////

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

@ -1,4 +1,4 @@
/* -*- Mode: C; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
*
* The contents of this file are subject to the Netscape Public License
* Version 1.0 (the "NPL"); you may not use this file except in
@ -39,11 +39,7 @@ public:
NS_DECL_ISUPPORTS
// nsIMimeStreamConverter support
NS_IMETHOD SetMimeOutputType(nsMimeOutputType aType);
NS_IMETHOD GetMimeOutputType(nsMimeOutputType *aOutFormat);
NS_IMETHOD SetStreamURI(nsIURI *aURI);
NS_IMETHOD SetMimeHeadersListener(nsIMimeStreamConverterListener* listener);
NS_DECL_NSIMIMESTREAMCONVERTER
// nsIStreamConverter methods
NS_DECL_NSISTREAMCONVERTER
// nsIStreamListener methods
@ -85,6 +81,7 @@ private:
PRBool mDoneParsing; // If this is true, we've already been told by libmime to stop sending
// data so don't feed the parser any more!
nsIMimeStreamConverterListener* mMimeStreamConverterListener;
PRBool mForwardInline;
};
// factory method