remove more nsIFileSpec code, sr=mscott 33451
This commit is contained in:
Родитель
179742b379
Коммит
836543906e
|
@ -48,32 +48,32 @@ interface nsIMsgDBHdr;
|
|||
|
||||
interface nsITransactionManager;
|
||||
interface nsIMsgWindow;
|
||||
interface nsIFileSpec;
|
||||
interface nsIFile;
|
||||
|
||||
[scriptable, uuid(c9255b88-5e0f-4614-8fdc-ebb97a0f333e)]
|
||||
[scriptable, uuid(f0ee3821-e382-43de-9b71-bd9a4a594fcb)]
|
||||
interface nsIMsgCopyService : nsISupports {
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
void CopyMessages(in nsIMsgFolder srcFolder,
|
||||
in nsISupportsArray messages,
|
||||
in nsIMsgFolder dstFolder,
|
||||
in boolean isMove,
|
||||
in nsIMsgCopyServiceListener listener,
|
||||
in nsIMsgWindow msgWindow,
|
||||
in boolean allowUndo);
|
||||
void CopyMessages(in nsIMsgFolder srcFolder,
|
||||
in nsISupportsArray messages,
|
||||
in nsIMsgFolder dstFolder,
|
||||
in boolean isMove,
|
||||
in nsIMsgCopyServiceListener listener,
|
||||
in nsIMsgWindow msgWindow,
|
||||
in boolean allowUndo);
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
void CopyFolders( in nsISupportsArray folders,
|
||||
void CopyFolders( in nsISupportsArray folders,
|
||||
in nsIMsgFolder dstFolder,
|
||||
in boolean isMove,
|
||||
in nsIMsgCopyServiceListener listener,
|
||||
in nsIMsgWindow msgWindow);
|
||||
|
||||
void CopyFileMessage(in nsIFileSpec fileSpec,
|
||||
void CopyFileMessage(in nsIFile aFile,
|
||||
in nsIMsgFolder dstFolder,
|
||||
in nsIMsgDBHdr msgToReplace,
|
||||
in boolean isDraftOrTemplate,
|
||||
|
@ -88,12 +88,12 @@ interface nsIMsgCopyService : nsISupports {
|
|||
* aSupport and dstFolder uniquely identify a copy service request.
|
||||
*
|
||||
* aSupport -- the originator of CopyMessages or CopyFileMessage; it can
|
||||
* be either a nsIMsgFolder or a nsIFileSpec
|
||||
* be either a nsIMsgFolder or a nsIFile
|
||||
* dstFolder -- the destination folder which performs the copy operation
|
||||
* result -- the result of the copy operation
|
||||
*/
|
||||
void NotifyCompletion(in nsISupports aSupport,
|
||||
in nsIMsgFolder dstFolder,
|
||||
in nsresult result);
|
||||
in nsIMsgFolder dstFolder,
|
||||
in nsresult result);
|
||||
|
||||
};
|
||||
|
|
|
@ -61,17 +61,18 @@ interface nsIMsgFilterList;
|
|||
|
||||
interface nsIMsgFolderCacheElement;
|
||||
interface nsITransport;
|
||||
interface nsIFileSpec;
|
||||
interface nsIFile;
|
||||
interface nsIOutputStream;
|
||||
interface nsIInputStream;
|
||||
interface nsILocalFile;
|
||||
interface nsIMsgIdentity;
|
||||
interface nsIFileSpec;
|
||||
|
||||
typedef long nsMsgBiffState;
|
||||
// enumerated type for determining if a message has been replied to, forwarded, etc.
|
||||
typedef long nsMsgDispositionState;
|
||||
|
||||
[scriptable, uuid(83d2454c-632e-4d6e-900a-7236a6d2aa9a)]
|
||||
[scriptable, uuid(f636bca2-3feb-4113-9773-d8b15f98b509)]
|
||||
interface nsIMsgFolder : nsICollection {
|
||||
|
||||
const nsMsgBiffState nsMsgBiffState_NewMail = 0; // User has new mail waiting.
|
||||
|
@ -302,7 +303,7 @@ const nsMsgBiffState nsMsgBiffState_Unknown = 2; // We dunno whether there is ne
|
|||
void copyFolder(in nsIMsgFolder srcFolder, in boolean isMoveFolder,
|
||||
in nsIMsgWindow msgWindow, in nsIMsgCopyServiceListener listener );
|
||||
|
||||
void copyFileMessage(in nsIFileSpec fileSpec, in nsIMsgDBHdr msgToReplace,
|
||||
void copyFileMessage(in nsIFile file, in nsIMsgDBHdr msgToReplace,
|
||||
in boolean isDraft, in unsigned long newMsgFlags,
|
||||
in nsIMsgWindow msgWindow,
|
||||
in nsIMsgCopyServiceListener listener);
|
||||
|
|
|
@ -40,7 +40,6 @@
|
|||
|
||||
interface nsIMsgFolder;
|
||||
interface nsIMsgDatabase;
|
||||
interface nsIFileSpec;
|
||||
interface nsIMsgWindow;
|
||||
|
||||
[scriptable, uuid(2af7d7a2-e5b6-11d4-a5b7-0060b0fc04b7)]
|
||||
|
|
|
@ -39,7 +39,6 @@
|
|||
#include "nsISupports.idl"
|
||||
#include "MailNewsTypes2.idl"
|
||||
|
||||
interface nsIFileSpec;
|
||||
interface nsIMsgFolder;
|
||||
interface nsIMsgFolderCache;
|
||||
interface nsIMsgWindow;
|
||||
|
@ -482,17 +481,5 @@ _class::Set##_postfix(PRInt32 ivalue) \
|
|||
return SetIntValue(_prefname, ivalue); \
|
||||
}
|
||||
|
||||
#define NS_IMPL_SERVERPREF_FILE(_class, _postfix, _prefname)\
|
||||
NS_IMETHODIMP \
|
||||
_class::Get##_postfix(nsIFileSpec **retval) \
|
||||
{ \
|
||||
return GetFileValue(_prefname, retval); \
|
||||
} \
|
||||
NS_IMETHODIMP \
|
||||
_class::Set##_postfix(nsIFileSpec* ivalue) \
|
||||
{ \
|
||||
return SetFileValue(_prefname, ivalue); \
|
||||
}
|
||||
|
||||
|
||||
%}
|
||||
|
|
|
@ -38,7 +38,7 @@
|
|||
#include "nsISupports.idl"
|
||||
#include "nsIURL.idl"
|
||||
|
||||
interface nsIFileSpec;
|
||||
interface nsIFile;
|
||||
interface nsIUrlListener;
|
||||
interface nsIMsgStatusFeedback;
|
||||
interface nsIMsgIncomingServer;
|
||||
|
@ -53,7 +53,7 @@ interface nsIMsgFolder;
|
|||
interface nsIMsgHeaderSink;
|
||||
interface nsIMsgDBHdr;
|
||||
|
||||
[scriptable, uuid(6CFFCEB0-CB8C-11d2-8065-006008128C4E)]
|
||||
[scriptable, uuid(0f9fb55c-f9ac-4501-af93-d4a7f23f82fb)]
|
||||
interface nsIMsgMailNewsUrl : nsIURL {
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
// Eventually we'd like to push this type of functionality up into nsIURI.
|
||||
|
@ -108,7 +108,7 @@ interface nsIMsgMailNewsUrl : nsIURL {
|
|||
const unsigned long eMove = 1;
|
||||
const unsigned long eDisplay = 2;
|
||||
boolean IsUrlType(in unsigned long type);
|
||||
nsIStreamListener getSaveAsListener(in boolean addDummyEnvelope, in nsIFileSpec aFileSpec);
|
||||
nsIStreamListener getSaveAsListener(in boolean addDummyEnvelope, in nsIFile aFile);
|
||||
|
||||
// typically the header sink is tied to the nsIMsgWindow, but in certain circumstances, a consumer
|
||||
// may chose to provide its own header sink for this url
|
||||
|
@ -125,13 +125,13 @@ interface nsIMsgMailNewsUrl : nsIURL {
|
|||
// grouping it into a separate interface...
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
[scriptable, uuid(6BEED963-0424-44C5-A605-C01F6DCBAAC2)]
|
||||
[scriptable, uuid(1a7340d8-be3c-4fb6-919d-152fb3074da7)]
|
||||
interface nsIMsgMessageUrl : nsISupports {
|
||||
// get and set the RDF URI associated with the url. Note, not all urls have
|
||||
// had uri's set on them so be prepared to handle cases where this string is empty.
|
||||
attribute string uri;
|
||||
// used by imap, pop and nntp in order to implement save message to disk
|
||||
attribute nsIFileSpec messageFile;
|
||||
attribute nsIFile messageFile;
|
||||
attribute boolean AddDummyEnvelope;
|
||||
attribute boolean canonicalLineEnding;
|
||||
attribute string originalSpec;
|
||||
|
|
|
@ -41,7 +41,7 @@ interface nsIURI;
|
|||
interface nsIUrlListener;
|
||||
interface nsIStreamListener;
|
||||
interface nsIMsgWindow;
|
||||
interface nsIFileSpec;
|
||||
interface nsIFile;
|
||||
interface nsIMsgFolder;
|
||||
interface nsIMsgSearchSession;
|
||||
interface nsIMsgDBHdr;
|
||||
|
@ -54,7 +54,7 @@ interface nsIStreamConverter;
|
|||
[ptr] native nsMsgKeyArrayPtr(nsMsgKeyArray);
|
||||
|
||||
|
||||
[scriptable, uuid(F11009C1-F697-11d2-807F-006008128C4E)]
|
||||
[scriptable, uuid(e39c2eab-ad6c-4560-b642-7f98ba2c0c35)]
|
||||
interface nsIMsgMessageService : nsISupports {
|
||||
|
||||
/////////////////////////////////////////////////////////////////
|
||||
|
@ -126,7 +126,7 @@ interface nsIMsgMessageService : nsISupports {
|
|||
// appended at the end of the file.
|
||||
///////////////////////////////////////////////////////////////////
|
||||
|
||||
void SaveMessageToDisk(in string aMessageURI, in nsIFileSpec aFile,
|
||||
void SaveMessageToDisk(in string aMessageURI, in nsIFile aFile,
|
||||
in boolean aGenerateDummyEnvelope,
|
||||
in nsIUrlListener aUrlListener, out nsIURI aURL,
|
||||
in boolean canonicalLineEnding, in nsIMsgWindow aMsgWindow);
|
||||
|
|
|
@ -45,7 +45,7 @@ interface nsILocalFile;
|
|||
%}
|
||||
|
||||
|
||||
[scriptable, uuid(1e42b3a3-db00-4e16-912c-9e7881effdd6)]
|
||||
[scriptable, uuid(035fd631-e751-46af-9bbd-a660b930c288)]
|
||||
interface nsIMsgProtocolInfo : nsISupports
|
||||
{
|
||||
/**
|
||||
|
@ -123,14 +123,6 @@ interface nsIMsgProtocolInfo : nsISupports
|
|||
*/
|
||||
readonly attribute boolean showComposeMsgLink;
|
||||
|
||||
/**
|
||||
* do we need to build special folder URIs ? In case of IMAP, special folders
|
||||
* like 'Sent', 'Drafts' and 'Templates' are not created unless needed.
|
||||
* But, we do need to create folder URIs to reflect the choices in the UI in
|
||||
* copies and folders settings panel.
|
||||
*/
|
||||
readonly attribute boolean needToBuildSpecialFolderURIs;
|
||||
|
||||
/**
|
||||
* do we allow special folder deletion ?
|
||||
*/
|
||||
|
|
|
@ -50,7 +50,6 @@
|
|||
#include "nsEscape.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsReadableUtils.h"
|
||||
#include "nsIFileSpec.h"
|
||||
#include "nsILocalFile.h"
|
||||
#include "nsDirectoryServiceDefs.h"
|
||||
#include "nsISupportsObsolete.h"
|
||||
|
@ -242,7 +241,7 @@ class nsSaveMsgListener : public nsIUrlListener,
|
|||
public nsICancelable
|
||||
{
|
||||
public:
|
||||
nsSaveMsgListener(nsIFileSpec* fileSpec, nsMessenger* aMessenger);
|
||||
nsSaveMsgListener(nsIFile* file, nsMessenger* aMessenger);
|
||||
virtual ~nsSaveMsgListener();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
|
@ -253,7 +252,7 @@ public:
|
|||
NS_DECL_NSIREQUESTOBSERVER
|
||||
NS_DECL_NSICANCELABLE
|
||||
|
||||
nsCOMPtr<nsIFileSpec> m_fileSpec;
|
||||
nsCOMPtr<nsIFile> m_file;
|
||||
nsCOMPtr<nsIOutputStream> m_outputStream;
|
||||
char *m_dataBuffer;
|
||||
nsCOMPtr<nsIChannel> m_channel;
|
||||
|
@ -447,10 +446,12 @@ nsMessenger::Observe(nsISupports *aSubject, const char *aTopic, const PRUnichar
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsMessenger::PromptIfFileExists(nsFileSpec &fileSpec)
|
||||
nsMessenger::PromptIfFileExists(nsILocalFile *file)
|
||||
{
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
if (fileSpec.Exists())
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
PRBool exists;
|
||||
file->Exists(&exists);
|
||||
if (exists)
|
||||
{
|
||||
nsCOMPtr<nsIPrompt> dialog(do_GetInterface(mDocShell));
|
||||
if (!dialog) return rv;
|
||||
|
@ -458,8 +459,7 @@ nsMessenger::PromptIfFileExists(nsFileSpec &fileSpec)
|
|||
PRBool dialogResult = PR_FALSE;
|
||||
nsXPIDLString errorMessage;
|
||||
|
||||
NS_CopyNativeToUnicode(
|
||||
nsDependentCString(fileSpec.GetNativePathCString()), path);
|
||||
file->GetPath(path);
|
||||
const PRUnichar *pathFormatStrings[] = { path.get() };
|
||||
|
||||
if (!mStringBundle)
|
||||
|
@ -519,7 +519,6 @@ nsMessenger::PromptIfFileExists(nsFileSpec &fileSpec)
|
|||
}
|
||||
|
||||
nsCOMPtr<nsILocalFile> localFile;
|
||||
nsCAutoString filePath;
|
||||
|
||||
rv = filePicker->GetFile(getter_AddRefs(localFile));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
@ -527,12 +526,9 @@ nsMessenger::PromptIfFileExists(nsFileSpec &fileSpec)
|
|||
rv = SetLastSaveDirectory(localFile);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
rv = localFile->GetNativePath(filePath);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
fileSpec = filePath.get();
|
||||
return NS_OK;
|
||||
}
|
||||
// reset the file to point to the new path
|
||||
return file->InitWithFile(localFile);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -693,7 +689,7 @@ nsMessenger::LoadURL(nsIDOMWindowInternal *aWin, const char *aURL)
|
|||
}
|
||||
|
||||
nsresult
|
||||
nsMessenger::SaveAttachment(nsIFileSpec * fileSpec,
|
||||
nsMessenger::SaveAttachment(nsIFile * file,
|
||||
const char * url,
|
||||
const char * messageUri,
|
||||
const char * contentType,
|
||||
|
@ -709,7 +705,7 @@ nsMessenger::SaveAttachment(nsIFileSpec * fileSpec,
|
|||
// XXX todo
|
||||
// document the ownership model of saveListener
|
||||
// whacky ref counting here...what's the deal? when does saveListener get released? it's not clear.
|
||||
nsSaveMsgListener *saveListener = new nsSaveMsgListener(fileSpec, this);
|
||||
nsSaveMsgListener *saveListener = new nsSaveMsgListener(file, this);
|
||||
if (!saveListener)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
|
||||
|
@ -722,16 +718,8 @@ nsMessenger::SaveAttachment(nsIFileSpec * fileSpec,
|
|||
if (saveState->m_detachingAttachments)
|
||||
{
|
||||
|
||||
nsFileSpec realSpec;
|
||||
fileSpec->GetFileSpec(&realSpec);
|
||||
|
||||
// Create nsILocalFile from a nsFileSpec.
|
||||
nsCOMPtr<nsILocalFile> outputFile;
|
||||
nsresult rv = NS_FileSpecToIFile(&realSpec, getter_AddRefs(outputFile));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIURI> outputURI;
|
||||
rv = NS_NewFileURI(getter_AddRefs(outputURI), outputFile);
|
||||
nsresult rv = NS_NewFileURI(getter_AddRefs(outputURI), file);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsCAutoString fileUriSpec;
|
||||
outputURI->GetSpec(fileUriSpec);
|
||||
|
@ -848,11 +836,7 @@ nsMessenger::SaveAttachmentToFolder(const char * contentType, const char * url,
|
|||
rv = attachmentDestination->AppendNative(unescapedFileName);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIFileSpec> fileSpec;
|
||||
rv = NS_NewFileSpecFromIFile(attachmentDestination, getter_AddRefs(fileSpec));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = SaveAttachment(fileSpec, url, messageUri, contentType, nsnull);
|
||||
rv = SaveAttachment(attachmentDestination, url, messageUri, contentType, nsnull);
|
||||
|
||||
attachmentDestination.swap(*aOutFile);
|
||||
return rv;
|
||||
|
@ -877,7 +861,6 @@ nsMessenger::SaveAttachment(const char * contentType, const char * url,
|
|||
PRInt16 dialogResult;
|
||||
nsCOMPtr<nsILocalFile> localFile;
|
||||
nsCOMPtr<nsILocalFile> lastSaveDir;
|
||||
nsCOMPtr<nsIFileSpec> fileSpec;
|
||||
nsXPIDLCString filePath;
|
||||
|
||||
|
||||
|
@ -904,10 +887,7 @@ nsMessenger::SaveAttachment(const char * contentType, const char * url,
|
|||
|
||||
(void)SetLastSaveDirectory(localFile);
|
||||
|
||||
rv = NS_NewFileSpecFromIFile(localFile, getter_AddRefs(fileSpec));
|
||||
if (NS_FAILED(rv)) goto done;
|
||||
|
||||
rv = SaveAttachment(fileSpec, url, messageUri, contentType, nsnull);
|
||||
rv = SaveAttachment(localFile, url, messageUri, contentType, nsnull);
|
||||
|
||||
done:
|
||||
return rv;
|
||||
|
@ -939,7 +919,6 @@ nsMessenger::SaveAllAttachments(PRUint32 count,
|
|||
do_CreateInstance("@mozilla.org/filepicker;1", &rv);
|
||||
nsCOMPtr<nsILocalFile> localFile;
|
||||
nsCOMPtr<nsILocalFile> lastSaveDir;
|
||||
nsCOMPtr<nsIFileSpec> fileSpec;
|
||||
nsXPIDLCString dirName;
|
||||
nsSaveAllAttachmentsState *saveState = nsnull;
|
||||
PRInt16 dialogResult;
|
||||
|
@ -968,8 +947,6 @@ nsMessenger::SaveAllAttachments(PRUint32 count,
|
|||
|
||||
rv = localFile->GetNativePath(dirName);
|
||||
if (NS_FAILED(rv)) goto done;
|
||||
rv = NS_NewFileSpec(getter_AddRefs(fileSpec));
|
||||
if (NS_FAILED(rv)) goto done;
|
||||
|
||||
saveState = new nsSaveAllAttachmentsState(count,
|
||||
contentTypeArray,
|
||||
|
@ -978,19 +955,16 @@ nsMessenger::SaveAllAttachments(PRUint32 count,
|
|||
messageUriArray,
|
||||
(const char*) dirName, detaching);
|
||||
{
|
||||
nsFileSpec aFileSpec((const char *) dirName);
|
||||
|
||||
nsXPIDLCString unescapedName;
|
||||
rv = ConvertAndSanitizeFileName(displayNameArray[0], nsnull, getter_Copies(unescapedName));
|
||||
if (NS_FAILED(rv))
|
||||
goto done;
|
||||
|
||||
aFileSpec += unescapedName.get();
|
||||
rv = PromptIfFileExists(aFileSpec);
|
||||
localFile->AppendNative(unescapedName);
|
||||
rv = PromptIfFileExists(localFile);
|
||||
if (NS_FAILED(rv))
|
||||
return rv;
|
||||
fileSpec->SetFromFileSpec(aFileSpec);
|
||||
rv = SaveAttachment(fileSpec, urlArray[0], messageUriArray[0],
|
||||
rv = SaveAttachment(localFile, urlArray[0], messageUriArray[0],
|
||||
contentTypeArray[0], (void *)saveState);
|
||||
}
|
||||
done:
|
||||
|
@ -1149,18 +1123,10 @@ nsMessenger::SaveAs(const char *aURI, PRBool aAsFile, nsIMsgIdentity *aIdentity,
|
|||
}
|
||||
break;
|
||||
}
|
||||
|
||||
// XXX argh! converting from nsILocalFile to nsFileSpec ... oh baby, lets drop from unicode to ascii too
|
||||
// nsXPIDLString path;
|
||||
// localFile->GetUnicodePath(getter_Copies(path));
|
||||
nsCOMPtr<nsIFileSpec> fileSpec;
|
||||
rv = NS_NewFileSpecFromIFile(localFile, getter_AddRefs(fileSpec));
|
||||
if (NS_FAILED(rv))
|
||||
goto done;
|
||||
|
||||
|
||||
// XXX todo
|
||||
// document the ownership model of saveListener
|
||||
saveListener = new nsSaveMsgListener(fileSpec, this);
|
||||
saveListener = new nsSaveMsgListener(localFile, this);
|
||||
if (!saveListener) {
|
||||
rv = NS_ERROR_OUT_OF_MEMORY;
|
||||
goto done;
|
||||
|
@ -1173,7 +1139,7 @@ nsMessenger::SaveAs(const char *aURI, PRBool aAsFile, nsIMsgIdentity *aIdentity,
|
|||
|
||||
if (saveAsFileType == EML_FILE_TYPE)
|
||||
{
|
||||
rv = messageService->SaveMessageToDisk(aURI, fileSpec, PR_FALSE,
|
||||
rv = messageService->SaveMessageToDisk(aURI, localFile, PR_FALSE,
|
||||
urlListener, nsnull,
|
||||
PR_FALSE, mMsgWindow);
|
||||
}
|
||||
|
@ -1236,14 +1202,20 @@ nsMessenger::SaveAs(const char *aURI, PRBool aAsFile, nsIMsgIdentity *aIdentity,
|
|||
else
|
||||
{
|
||||
// ** save as Template
|
||||
nsCOMPtr<nsIFileSpec> fileSpec;
|
||||
nsFileSpec tmpFileSpec("nsmail.tmp");
|
||||
rv = NS_NewFileSpecWithSpec(tmpFileSpec, getter_AddRefs(fileSpec));
|
||||
nsCOMPtr <nsIFile> tmpTempFile;
|
||||
nsresult rv = GetSpecialDirectoryWithFileName(NS_OS_TEMP_DIR,
|
||||
"nsmail.tmp",
|
||||
getter_AddRefs(tmpTempFile));
|
||||
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr <nsILocalFile> tmpFile = do_QueryInterface(tmpTempFile, &rv);
|
||||
rv = tmpFile->CreateUnique(nsIFile::NORMAL_FILE_TYPE, 00600);
|
||||
if (NS_FAILED(rv)) goto done;
|
||||
|
||||
// XXX todo
|
||||
// document the ownership model of saveListener
|
||||
saveListener = new nsSaveMsgListener(fileSpec, this);
|
||||
saveListener = new nsSaveMsgListener(tmpFile, this);
|
||||
if (!saveListener) {
|
||||
rv = NS_ERROR_OUT_OF_MEMORY;
|
||||
goto done;
|
||||
|
@ -1268,7 +1240,7 @@ nsMessenger::SaveAs(const char *aURI, PRBool aAsFile, nsIMsgIdentity *aIdentity,
|
|||
if (NS_FAILED(rv))
|
||||
goto done;
|
||||
|
||||
rv = messageService->SaveMessageToDisk(aURI, fileSpec,
|
||||
rv = messageService->SaveMessageToDisk(aURI, tmpFile,
|
||||
needDummyHeader,
|
||||
urlListener, nsnull,
|
||||
canonicalLineEnding, mMsgWindow);
|
||||
|
@ -1778,9 +1750,9 @@ nsMessenger::SendUnsentMessages(nsIMsgIdentity *aIdentity, nsIMsgWindow *aMsgWin
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsSaveMsgListener::nsSaveMsgListener(nsIFileSpec* aSpec, nsMessenger *aMessenger)
|
||||
nsSaveMsgListener::nsSaveMsgListener(nsIFile* aFile, nsMessenger *aMessenger)
|
||||
{
|
||||
m_fileSpec = do_QueryInterface(aSpec);
|
||||
m_file = do_QueryInterface(aFile);
|
||||
m_messenger = aMessenger;
|
||||
|
||||
// rhp: for charset handling
|
||||
|
@ -1791,8 +1763,8 @@ nsSaveMsgListener::nsSaveMsgListener(nsIFileSpec* aSpec, nsMessenger *aMessenger
|
|||
mCanceled = PR_FALSE;
|
||||
m_outputFormat = eUnknown;
|
||||
mInitialized = PR_FALSE;
|
||||
if (m_fileSpec)
|
||||
m_fileSpec->GetOutputStream(getter_AddRefs(m_outputStream));
|
||||
if (m_file)
|
||||
NS_NewLocalFileOutputStream(getter_AddRefs(m_outputStream), m_file, -1, 00600);
|
||||
m_dataBuffer = (char*) PR_CALLOC(FOUR_K+1);
|
||||
}
|
||||
|
||||
|
@ -1828,10 +1800,10 @@ nsSaveMsgListener::OnStopRunningUrl(nsIURI* url, nsresult exitCode)
|
|||
nsresult rv = exitCode;
|
||||
PRBool killSelf = PR_TRUE;
|
||||
|
||||
if (m_fileSpec)
|
||||
if (m_outputStream)
|
||||
{
|
||||
m_fileSpec->Flush();
|
||||
m_fileSpec->CloseStream();
|
||||
m_outputStream->Flush();
|
||||
m_outputStream->Close();
|
||||
if (NS_FAILED(rv)) goto done;
|
||||
if (m_templateUri) { // ** save as template goes here
|
||||
nsCOMPtr<nsIRDFService> rdf(do_GetService(kRDFServiceCID, &rv));
|
||||
|
@ -1844,7 +1816,7 @@ nsSaveMsgListener::OnStopRunningUrl(nsIURI* url, nsresult exitCode)
|
|||
if (NS_FAILED(rv)) goto done;
|
||||
nsCOMPtr<nsIMsgCopyService> copyService = do_GetService(NS_MSGCOPYSERVICE_CONTRACTID);
|
||||
if (copyService)
|
||||
rv = copyService->CopyFileMessage(m_fileSpec, templateFolder, nsnull,
|
||||
rv = copyService->CopyFileMessage(m_file, templateFolder, nsnull,
|
||||
PR_TRUE, MSG_FLAG_READ, this, nsnull);
|
||||
killSelf = PR_FALSE;
|
||||
}
|
||||
|
@ -1853,12 +1825,8 @@ nsSaveMsgListener::OnStopRunningUrl(nsIURI* url, nsresult exitCode)
|
|||
done:
|
||||
if (NS_FAILED(rv))
|
||||
{
|
||||
if (m_fileSpec)
|
||||
{
|
||||
nsFileSpec realSpec;
|
||||
m_fileSpec->GetFileSpec(&realSpec);
|
||||
realSpec.Delete(PR_FALSE);
|
||||
}
|
||||
if (m_file)
|
||||
m_file->Remove(PR_FALSE);
|
||||
if (m_messenger)
|
||||
m_messenger->Alert("saveMessageFailed");
|
||||
}
|
||||
|
@ -1895,12 +1863,8 @@ nsSaveMsgListener::GetMessageId(nsCString* aMessageId)
|
|||
NS_IMETHODIMP
|
||||
nsSaveMsgListener::OnStopCopy(nsresult aStatus)
|
||||
{
|
||||
if (m_fileSpec)
|
||||
{
|
||||
nsFileSpec realSpec;
|
||||
m_fileSpec->GetFileSpec(&realSpec);
|
||||
realSpec.Delete(PR_FALSE);
|
||||
}
|
||||
if (m_file)
|
||||
m_file->Remove(PR_FALSE);
|
||||
Release(); // all done kill ourself
|
||||
return aStatus;
|
||||
}
|
||||
|
@ -1927,12 +1891,8 @@ nsresult nsSaveMsgListener::InitializeDownload(nsIRequest * aRequest, PRInt32 aB
|
|||
nsCOMPtr<nsIMIMEInfo> mimeinfo;
|
||||
|
||||
mimeService->GetFromTypeAndExtension(m_contentType, EmptyCString(), getter_AddRefs(mimeinfo));
|
||||
nsFileSpec realSpec;
|
||||
m_fileSpec->GetFileSpec(&realSpec);
|
||||
|
||||
// Create nsILocalFile from a nsFileSpec.
|
||||
nsCOMPtr<nsILocalFile> outputFile;
|
||||
NS_FileSpecToIFile(&realSpec, getter_AddRefs(outputFile));
|
||||
nsCOMPtr<nsILocalFile> outputFile = do_QueryInterface(m_file);
|
||||
|
||||
// create a download progress window
|
||||
// XXX: we don't want to show the progress dialog if the download is really small.
|
||||
|
@ -2017,7 +1977,7 @@ nsSaveMsgListener::OnStopRequest(nsIRequest* request, nsISupports* aSupport,
|
|||
// rhp: If we are doing the charset conversion magic, this is different
|
||||
// processing, otherwise, its just business as usual.
|
||||
//
|
||||
if ( (m_doCharsetConversion) && (m_fileSpec) )
|
||||
if ( (m_doCharsetConversion) && (m_outputStream) )
|
||||
{
|
||||
char *conBuf = nsnull;
|
||||
PRUint32 conLength = 0;
|
||||
|
@ -2045,11 +2005,10 @@ nsSaveMsgListener::OnStopRequest(nsIRequest* request, nsISupports* aSupport,
|
|||
PR_FREEIF(conBuf);
|
||||
}
|
||||
|
||||
// close down the file stream and release ourself
|
||||
if (m_fileSpec)
|
||||
// close down the output stream and release ourself
|
||||
if (m_outputStream)
|
||||
{
|
||||
m_fileSpec->Flush();
|
||||
m_fileSpec->CloseStream();
|
||||
m_outputStream->Close();
|
||||
m_outputStream = nsnull;
|
||||
}
|
||||
|
||||
|
@ -2061,11 +2020,11 @@ nsSaveMsgListener::OnStopRequest(nsIRequest* request, nsISupports* aSupport,
|
|||
{
|
||||
nsSaveAllAttachmentsState *state = m_saveAllAttachmentsState;
|
||||
PRUint32 i = state->m_curIndex;
|
||||
nsCOMPtr<nsIFileSpec> fileSpec;
|
||||
nsFileSpec aFileSpec ((const char *) state->m_directoryName);
|
||||
|
||||
nsXPIDLCString unescapedName;
|
||||
rv = NS_NewFileSpec(getter_AddRefs(fileSpec));
|
||||
nsCOMPtr<nsILocalFile> localFile = do_CreateInstance(NS_LOCAL_FILE_CONTRACTID, &rv);
|
||||
if (NS_FAILED(rv)) goto done;
|
||||
rv = localFile->InitWithNativePath(nsDependentCString(state->m_directoryName));
|
||||
|
||||
if (NS_FAILED(rv)) goto done;
|
||||
|
||||
rv = ConvertAndSanitizeFileName(state->m_displayNameArray[i], nsnull,
|
||||
|
@ -2073,11 +2032,10 @@ nsSaveMsgListener::OnStopRequest(nsIRequest* request, nsISupports* aSupport,
|
|||
if (NS_FAILED(rv))
|
||||
goto done;
|
||||
|
||||
aFileSpec += unescapedName;
|
||||
rv = m_messenger->PromptIfFileExists(aFileSpec);
|
||||
localFile->AppendNative(unescapedName);
|
||||
rv = m_messenger->PromptIfFileExists(localFile);
|
||||
if (NS_FAILED(rv)) goto done;
|
||||
fileSpec->SetFromFileSpec(aFileSpec);
|
||||
rv = m_messenger->SaveAttachment(fileSpec,
|
||||
rv = m_messenger->SaveAttachment(localFile,
|
||||
state->m_urlArray[i],
|
||||
state->m_messageUriArray[i],
|
||||
state->m_contentTypeArray[i],
|
||||
|
@ -2785,11 +2743,8 @@ nsDelAttachListener::OnStopRequest(nsIRequest * aRequest, nsISupports * aContext
|
|||
m_state = eCopyingNewMsg;
|
||||
if (copyService)
|
||||
{
|
||||
nsCOMPtr<nsIFileSpec> fileSpec;
|
||||
rv = NS_NewFileSpecFromIFile(mMsgFile, getter_AddRefs(fileSpec));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
rv = copyService->CopyFileMessage(fileSpec, mMessageFolder, nsnull, PR_FALSE,
|
||||
mOrigMsgFlags, listenerCopyService, mMsgWindow);
|
||||
rv = copyService->CopyFileMessage(mMsgFile, mMessageFolder, nsnull, PR_FALSE,
|
||||
mOrigMsgFlags, listenerCopyService, mMsgWindow);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
#include "nsIMessenger.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsITransactionManager.h"
|
||||
#include "nsFileSpec.h"
|
||||
#include "nsILocalFile.h"
|
||||
#include "nsIDocShell.h"
|
||||
#include "nsIStringBundle.h"
|
||||
#include "nsILocalFile.h"
|
||||
|
@ -63,10 +63,10 @@ public:
|
|||
NS_DECL_NSIFOLDERLISTENER
|
||||
|
||||
nsresult Alert(const char * stringName);
|
||||
nsresult SaveAttachment(nsIFileSpec *fileSpec, const char* unescapedUrl,
|
||||
nsresult SaveAttachment(nsIFile *file, const char* unescapedUrl,
|
||||
const char* messageUri, const char* contentType,
|
||||
void *closure);
|
||||
nsresult PromptIfFileExists(nsFileSpec &fileSpec);
|
||||
nsresult PromptIfFileExists(nsILocalFile *file);
|
||||
nsresult DetachAttachments(PRUint32 aCount,
|
||||
const char ** aContentTypeArray,
|
||||
const char ** aUrlArray,
|
||||
|
|
|
@ -180,7 +180,7 @@ nsMessengerBootstrap::Handle(nsICommandLine* aCmdLine)
|
|||
{
|
||||
nsMsgKey msgKey;
|
||||
msgHdr->GetMessageKey(&msgKey);
|
||||
rv = OpenMessengerWindowWithUri("mail:3pane", folderUri.get(), msgKey);
|
||||
rv = OpenMessengerWindowWithUri("mail:messageWindow", folderUri.get(), msgKey);
|
||||
return rv;
|
||||
}
|
||||
}
|
||||
|
@ -292,7 +292,7 @@ NS_IMETHODIMP nsMessengerBootstrap::OpenMessengerWindowWithUri(const char *windo
|
|||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// we need to use the "mailnews.reuse_thread_window2" pref
|
||||
// to determine if we should open a new window, or use an existing one.
|
||||
// to determine if we should open a new window, or use an existing one.
|
||||
nsCOMPtr<nsIDOMWindow> newWindow;
|
||||
rv = wwatch->OpenWindow(0, chromeurl.get(), "_blank",
|
||||
"chrome,extrachrome,menubar,resizable,scrollbars,status,toolbar,dialog=no",
|
||||
|
|
|
@ -1,156 +0,0 @@
|
|||
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
||||
/* ***** BEGIN LICENSE BLOCK *****
|
||||
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
||||
*
|
||||
* The contents of this file are subject to the Mozilla Public License Version
|
||||
* 1.1 (the "License"); you may not use this file except in compliance with
|
||||
* the License. You may obtain a copy of the License at
|
||||
* http://www.mozilla.org/MPL/
|
||||
*
|
||||
* Software distributed under the License is distributed on an "AS IS" basis,
|
||||
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
||||
* for the specific language governing rights and limitations under the
|
||||
* License.
|
||||
*
|
||||
* The Original Code is mozilla.org code.
|
||||
*
|
||||
* The Initial Developer of the Original Code is
|
||||
* Netscape Communications Corporation.
|
||||
* Portions created by the Initial Developer are Copyright (C) 1998
|
||||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Seth Spitzer <sspitzer@netscape.com>
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
||||
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
||||
* in which case the provisions of the GPL or the LGPL are applicable instead
|
||||
* of those above. If you wish to allow use of your version of this file only
|
||||
* under the terms of either the GPL or the LGPL, and not to allow others to
|
||||
* use your version of this file under the terms of the MPL, indicate your
|
||||
* decision by deleting the provisions above and replace them with the notice
|
||||
* and other provisions required by the GPL or the LGPL. If you do not delete
|
||||
* the provisions above, a recipient may use your version of this file under
|
||||
* the terms of any one of the MPL, the GPL or the LGPL.
|
||||
*
|
||||
* ***** END LICENSE BLOCK ***** */
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsIMessengerMigrator.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsISmtpServer.h"
|
||||
#include "nsIPrefService.h"
|
||||
#include "nsIPrefBranch.h"
|
||||
#include "nsIMsgIdentity.h"
|
||||
#include "nsIMsgIncomingServer.h"
|
||||
#include "nsIObserver.h"
|
||||
|
||||
/*
|
||||
* some platforms (like Windows and Mac) use a map file, because of
|
||||
* file name length limitations.
|
||||
*/
|
||||
#if defined(XP_UNIX) || defined(XP_BEOS)
|
||||
/* in 4.x, the prefix was ".newsrc-" and ".snewsrc-"
|
||||
* in 5.0, the profile migrator code copies the newsrc files from
|
||||
* ~/.newsrc-* to ~/.mozilla/<profile>/News/newsrc-*
|
||||
* ~/.snewsrc-* to ~/.mozilla/<profile>/News/snewsrc-*
|
||||
*/
|
||||
#define NEWSRC_FILE_PREFIX_IN_5x "newsrc-"
|
||||
#define SNEWSRC_FILE_PREFIX_IN_5x "snewsrc-"
|
||||
#else
|
||||
#define USE_NEWSRC_MAP_FILE
|
||||
|
||||
// in the fat file, the hostname is prefix by one of these:
|
||||
#define PSEUDO_NAME_PREFIX "newsrc-"
|
||||
#define PSEUDO_SECURE_NAME_PREFIX "snewsrc-"
|
||||
|
||||
#if defined(XP_WIN) || defined(XP_OS2)
|
||||
/* another case of mac vs. windows in 4.x
|
||||
* on mac, the default for news fcc, if you used imap,
|
||||
* was "Sent on Local Mail"
|
||||
* on windows, the default for news fcc,
|
||||
* if you used imap, was "Sent on <imap server>"
|
||||
*/
|
||||
#define NEWS_FCC_DEFAULT_TO_IMAP_SENT
|
||||
#define NEWS_FAT_FILE_NAME "fat"
|
||||
/*
|
||||
* on the PC, the fat file stores absolute paths to the newsrc files
|
||||
* on the Mac, the fat file stores relative paths to the newsrc files
|
||||
*/
|
||||
#define NEWS_FAT_STORES_ABSOLUTE_NEWSRC_FILE_PATHS 1
|
||||
#elif defined(XP_MACOSX)
|
||||
#define NEWS_FAT_FILE_NAME "NewsFAT"
|
||||
#else
|
||||
#error dont_know_what_your_news_fat_file_is
|
||||
#endif /* XP_WIN, XP_OS2, XP_MACOSX */
|
||||
|
||||
#endif /* XP_UNIX || XP_BEOS */
|
||||
|
||||
class nsMessengerMigrator
|
||||
: public nsIMessengerMigrator, public nsIObserver
|
||||
{
|
||||
public:
|
||||
|
||||
nsMessengerMigrator();
|
||||
virtual ~nsMessengerMigrator();
|
||||
|
||||
NS_DECL_ISUPPORTS
|
||||
NS_DECL_NSIMESSENGERMIGRATOR
|
||||
NS_DECL_NSIOBSERVER
|
||||
|
||||
nsresult Init();
|
||||
nsresult Shutdown();
|
||||
|
||||
private:
|
||||
|
||||
nsresult MigrateIdentity(nsIMsgIdentity *identity);
|
||||
nsresult MigrateSmtpServer(nsISmtpServer *server);
|
||||
nsresult SetMailCopiesAndFolders(nsIMsgIdentity *identity, const char *username, const char *hostname);
|
||||
nsresult SetNewsCopiesAndFolders(nsIMsgIdentity *identity);
|
||||
nsresult SetUsernameIfNecessary();
|
||||
|
||||
nsresult MigrateImapAccounts(nsIMsgIdentity *identity);
|
||||
nsresult MigrateImapAccount(nsIMsgIdentity *identity, const char *hostAndPort, PRBool isDefaultAccount);
|
||||
|
||||
nsresult MigrateOldImapPrefs(nsIMsgIncomingServer *server, const char *hostAndPort);
|
||||
|
||||
nsresult MigratePopAccount(nsIMsgIdentity *identity);
|
||||
|
||||
#ifdef HAVE_MOVEMAIL
|
||||
nsresult MigrateMovemailAccount(nsIMsgIdentity *identity);
|
||||
#endif /* HAVE_MOVEMAIL */
|
||||
|
||||
nsresult MigrateLocalMailAccount();
|
||||
|
||||
nsresult MigrateOldMailPrefs(nsIMsgIncomingServer *server);
|
||||
|
||||
nsresult MigrateNewsAccounts(nsIMsgIdentity *identity);
|
||||
nsresult MigrateNewsAccount(nsIMsgIdentity *identity, const char *hostAndPort, nsFileSpec &newsrcfile, nsFileSpec &newsHostsDir, PRBool isSecure);
|
||||
nsresult MigrateOldNntpPrefs(nsIMsgIncomingServer *server, const char *hostAndPort, nsFileSpec &newsrcfile);
|
||||
|
||||
nsresult MigrateAddressBookPrefs();
|
||||
void migrateAddressBookPrefEnum(const char *aPref);
|
||||
|
||||
nsresult ProceedWithMigration();
|
||||
|
||||
nsresult Convert4XUri(const char *old_uri, PRBool for_news, const char *aUsername, const char *aHostname, const char *default_folder_name, const char *default_pref_name, char **new_uri);
|
||||
|
||||
nsresult SetSendLaterUriPref(nsIMsgIncomingServer *server);
|
||||
|
||||
nsresult getPrefService();
|
||||
nsresult initializeStrings();
|
||||
|
||||
nsresult ResetState();
|
||||
|
||||
nsCOMPtr <nsIPrefBranch> m_prefs;
|
||||
PRBool m_haveShutdown;
|
||||
PRInt32 m_oldMailType;
|
||||
PRBool m_alreadySetNntpDefaultLocalPath;
|
||||
PRBool m_alreadySetImapDefaultLocalPath;
|
||||
|
||||
nsCString mLocalFoldersHostname;
|
||||
nsString mLocalFoldersName;
|
||||
|
||||
};
|
||||
|
|
@ -40,7 +40,7 @@
|
|||
#include "nsMsgKeyArray.h"
|
||||
#include "nsCOMArray.h"
|
||||
#include "nspr.h"
|
||||
#include "nsIFileSpec.h"
|
||||
#include "nsIFile.h"
|
||||
#include "nsIMsgFolderNotificationService.h"
|
||||
#include "nsMsgBaseCID.h"
|
||||
|
||||
|
@ -342,7 +342,7 @@ nsMsgCopyService::DoNextCopy()
|
|||
}
|
||||
else if (copyRequest->m_requestType == nsCopyFileMessageType)
|
||||
{
|
||||
nsCOMPtr<nsIFileSpec> aSpec(do_QueryInterface(copyRequest->m_srcSupport, &rv));
|
||||
nsCOMPtr<nsIFile> aFile(do_QueryInterface(copyRequest->m_srcSupport, &rv));
|
||||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
// ** in case of saving draft/template; the very first
|
||||
|
@ -357,7 +357,7 @@ nsMsgCopyService::DoNextCopy()
|
|||
}
|
||||
copyRequest->m_processed = PR_TRUE;
|
||||
rv = copyRequest->m_dstFolder->CopyFileMessage
|
||||
(aSpec, aMessage,
|
||||
(aFile, aMessage,
|
||||
copyRequest->m_isMoveOrDraftOrTemplate,
|
||||
copyRequest->m_newMsgFlags,
|
||||
copyRequest->m_msgWindow,
|
||||
|
@ -581,7 +581,7 @@ nsMsgCopyService::CopyFolders( nsISupportsArray* folders,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgCopyService::CopyFileMessage(nsIFileSpec* fileSpec,
|
||||
nsMsgCopyService::CopyFileMessage(nsIFile* file,
|
||||
nsIMsgFolder* dstFolder,
|
||||
nsIMsgDBHdr* msgToReplace,
|
||||
PRBool isDraft,
|
||||
|
@ -595,14 +595,14 @@ nsMsgCopyService::CopyFileMessage(nsIFileSpec* fileSpec,
|
|||
nsCOMPtr<nsISupports> fileSupport;
|
||||
nsCOMPtr<nsITransactionManager> txnMgr;
|
||||
|
||||
NS_ENSURE_ARG_POINTER(fileSpec);
|
||||
NS_ENSURE_ARG_POINTER(file);
|
||||
NS_ENSURE_ARG_POINTER(dstFolder);
|
||||
|
||||
if (window)
|
||||
window->GetTransactionManager(getter_AddRefs(txnMgr));
|
||||
copyRequest = new nsCopyRequest();
|
||||
if (!copyRequest) return rv;
|
||||
fileSupport = do_QueryInterface(fileSpec, &rv);
|
||||
fileSupport = do_QueryInterface(file, &rv);
|
||||
if (NS_FAILED(rv)) goto done;
|
||||
|
||||
rv = copyRequest->Init(nsCopyFileMessageType, fileSupport, dstFolder,
|
||||
|
|
|
@ -4555,7 +4555,7 @@ nsMsgDBFolder::CopyFolder(nsIMsgFolder* srcFolder,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgDBFolder::CopyFileMessage(nsIFileSpec* fileSpec,
|
||||
nsMsgDBFolder::CopyFileMessage(nsIFile* aFile,
|
||||
nsIMsgDBHdr* messageToReplace,
|
||||
PRBool isDraftOrTemplate,
|
||||
PRUint32 aNewMsgFlags,
|
||||
|
|
|
@ -54,7 +54,8 @@
|
|||
#include "nsIStreamListener.h"
|
||||
#include "nsIOutputStream.h"
|
||||
#include "nsIInputStream.h"
|
||||
#include "nsIFileSpec.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsIFile.h"
|
||||
#include <time.h>
|
||||
|
||||
nsMsgMailNewsUrl::nsMsgMailNewsUrl()
|
||||
|
@ -817,12 +818,12 @@ public:
|
|||
NS_DECL_NSIREQUESTOBSERVER
|
||||
NS_DECL_NSISTREAMLISTENER
|
||||
|
||||
nsMsgSaveAsListener(nsIFileSpec *aFileSpec, PRBool addDummyEnvelope);
|
||||
nsMsgSaveAsListener(nsIFile *aFile, PRBool addDummyEnvelope);
|
||||
virtual ~nsMsgSaveAsListener();
|
||||
nsresult SetupMsgWriteStream(nsIFileSpec *aFileSpec, PRBool addDummyEnvelope);
|
||||
nsresult SetupMsgWriteStream(nsIFile *aFile, PRBool addDummyEnvelope);
|
||||
protected:
|
||||
nsCOMPtr<nsIOutputStream> m_outputStream;
|
||||
nsCOMPtr<nsIFileSpec> m_outputFile;
|
||||
nsCOMPtr<nsIFile> m_outputFile;
|
||||
PRBool m_addDummyEnvelope;
|
||||
PRBool m_writtenData;
|
||||
PRUint32 m_leftOver;
|
||||
|
@ -832,9 +833,9 @@ protected:
|
|||
|
||||
NS_IMPL_ISUPPORTS1(nsMsgSaveAsListener, nsIStreamListener)
|
||||
|
||||
nsMsgSaveAsListener::nsMsgSaveAsListener(nsIFileSpec *aFileSpec, PRBool addDummyEnvelope)
|
||||
nsMsgSaveAsListener::nsMsgSaveAsListener(nsIFile *aFile, PRBool addDummyEnvelope)
|
||||
{
|
||||
m_outputFile = aFileSpec;
|
||||
m_outputFile = aFile;
|
||||
m_writtenData = PR_FALSE;
|
||||
m_addDummyEnvelope = addDummyEnvelope;
|
||||
m_leftOver = 0;
|
||||
|
@ -857,8 +858,6 @@ nsMsgSaveAsListener::OnStopRequest(nsIRequest *request, nsISupports * aCtxt, nsr
|
|||
m_outputStream->Flush();
|
||||
m_outputStream->Close();
|
||||
}
|
||||
if (m_outputFile)
|
||||
m_outputFile->CloseStream();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -947,7 +946,7 @@ NS_IMETHODIMP nsMsgSaveAsListener::OnDataAvailable(nsIRequest* request,
|
|||
// rv = m_outputStream->WriteFrom(inStream, PR_MIN(available, count), &bytesWritten);
|
||||
}
|
||||
|
||||
nsresult nsMsgSaveAsListener::SetupMsgWriteStream(nsIFileSpec *aFileSpec, PRBool addDummyEnvelope)
|
||||
nsresult nsMsgSaveAsListener::SetupMsgWriteStream(nsIFile *aFile, PRBool addDummyEnvelope)
|
||||
{
|
||||
nsresult rv = NS_ERROR_FAILURE;
|
||||
|
||||
|
@ -960,12 +959,10 @@ nsresult nsMsgSaveAsListener::SetupMsgWriteStream(nsIFileSpec *aFileSpec, PRBool
|
|||
// have to close the stream before deleting the file, else data
|
||||
// would still be written happily into a now non-existing file.
|
||||
// (Windows doesn't care, btw, just unixoids do...)
|
||||
nsFileSpec fileSpec;
|
||||
aFileSpec->CloseStream();
|
||||
aFileSpec->GetFileSpec(&fileSpec);
|
||||
fileSpec.Delete(PR_FALSE);
|
||||
aFile->Remove(PR_FALSE);
|
||||
|
||||
rv = aFileSpec->GetOutputStream(getter_AddRefs(m_outputStream));
|
||||
nsCOMPtr <nsILocalFile> localFile = do_QueryInterface(aFile);
|
||||
rv = NS_NewLocalFileOutputStream(getter_AddRefs(m_outputStream), localFile, -1, 00600);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
||||
if (m_outputStream && addDummyEnvelope)
|
||||
|
@ -996,10 +993,10 @@ nsresult nsMsgSaveAsListener::SetupMsgWriteStream(nsIFileSpec *aFileSpec, PRBool
|
|||
|
||||
|
||||
NS_IMETHODIMP nsMsgMailNewsUrl::GetSaveAsListener(PRBool addDummyEnvelope,
|
||||
nsIFileSpec *aFileSpec, nsIStreamListener **aSaveListener)
|
||||
nsIFile *aFile, nsIStreamListener **aSaveListener)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aSaveListener);
|
||||
nsMsgSaveAsListener *saveAsListener = new nsMsgSaveAsListener(aFileSpec, addDummyEnvelope);
|
||||
nsMsgSaveAsListener *saveAsListener = new nsMsgSaveAsListener(aFile, addDummyEnvelope);
|
||||
return saveAsListener->QueryInterface(NS_GET_IID(nsIStreamListener), (void **) aSaveListener);
|
||||
}
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ interface nsIRequest;
|
|||
interface nsIMsgDBHdr;
|
||||
interface nsIMsgHdr;
|
||||
interface nsIDocShell;
|
||||
interface nsIFileSpec;
|
||||
interface nsIFile;
|
||||
interface nsIFile;
|
||||
interface nsIOutputStream;
|
||||
interface nsIMsgComposeSecure;
|
||||
|
@ -165,7 +165,7 @@ typedef struct nsMsgAttachedFile
|
|||
[ptr] native nsMsgAttachmentHandler(nsMsgAttachmentHandler);
|
||||
[ptr] native nsCString(nsCString);
|
||||
|
||||
[scriptable, uuid(7d3aad47-b742-42b8-b5af-0af65cd1b366)]
|
||||
[scriptable, uuid(F9F9E2DA-967D-4598-8FD5-ECAF1D369366)]
|
||||
interface nsIMsgSend : nsISupports
|
||||
{
|
||||
//
|
||||
|
@ -242,7 +242,7 @@ interface nsIMsgSend : nsISupports
|
|||
[noscript] void notifyListenerOnStartSending(in string aMsgID, in unsigned long aMsgSize);
|
||||
[noscript] void notifyListenerOnProgress(in string aMsgID, in unsigned long aProgress, in unsigned long aProgressMax);
|
||||
[noscript] void notifyListenerOnStatus(in string aMsgID, in wstring aMsg);
|
||||
[noscript] void notifyListenerOnStopSending(in string aMsgID, in nsresult aStatus, in wstring aMsg, in nsIFileSpec returnFileSpec);
|
||||
[noscript] void notifyListenerOnStopSending(in string aMsgID, in nsresult aStatus, in wstring aMsg, in nsIFile returnFile);
|
||||
[noscript] void deliverAsMailExit(in nsIURI aUrl, in nsresult aExitCode);
|
||||
[noscript] void deliverAsNewsExit(in nsIURI aUrl, in nsresult aExitCode);
|
||||
|
||||
|
|
|
@ -37,9 +37,9 @@
|
|||
|
||||
#include "nsISupports.idl"
|
||||
|
||||
interface nsIFileSpec;
|
||||
interface nsIFile;
|
||||
|
||||
[scriptable, uuid(ED3D3227-2803-11D3-82B7-444553540002)]
|
||||
[scriptable, uuid(D34DC178-5E78-45E8-8658-A8F52D9CCF5F)]
|
||||
interface nsIMsgSendListener : nsISupports {
|
||||
|
||||
/**
|
||||
|
@ -73,7 +73,7 @@ interface nsIMsgSendListener : nsISupports {
|
|||
* returnFileSpec The returned file spec for save to file operations.
|
||||
*/
|
||||
void onStopSending(in string aMsgID, in nsresult aStatus, in wstring aMsg,
|
||||
in nsIFileSpec returnFileSpec);
|
||||
in nsIFile aReturnFile);
|
||||
|
||||
/**
|
||||
* Notify the observer with the folder uri before the draft is copied.
|
||||
|
|
|
@ -3055,10 +3055,10 @@ NS_IMETHODIMP nsMsgCompose::OnStatus(const char *aMsgID, const PRUnichar *aMsg)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgCompose::OnStopSending(const char *aMsgID, nsresult aStatus, const PRUnichar *aMsg,
|
||||
nsIFileSpec *returnFileSpec)
|
||||
nsIFile *returnFile)
|
||||
{
|
||||
for (PRInt32 i = 0; i < mExternalSendListeners.Count(); i++)
|
||||
mExternalSendListeners[i]->OnStopSending(aMsgID, aStatus, aMsg, returnFileSpec);
|
||||
mExternalSendListeners[i]->OnStopSending(aMsgID, aStatus, aMsg, returnFile);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -3189,7 +3189,7 @@ nsresult nsMsgComposeSendListener::OnSendNotPerformed(const char *aMsgID, nsresu
|
|||
|
||||
|
||||
nsresult nsMsgComposeSendListener::OnStopSending(const char *aMsgID, nsresult aStatus, const PRUnichar *aMsg,
|
||||
nsIFileSpec *returnFileSpec)
|
||||
nsIFile *returnFile)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
|
@ -3263,7 +3263,7 @@ nsresult nsMsgComposeSendListener::OnStopSending(const char *aMsgID, nsresult aS
|
|||
|
||||
nsCOMPtr<nsIMsgSendListener> composeSendlistener = do_QueryReferent(mWeakComposeObj);
|
||||
if (composeSendlistener)
|
||||
composeSendlistener->OnStopSending(aMsgID, aStatus, aMsg, returnFileSpec);
|
||||
composeSendlistener->OnStopSending(aMsgID, aStatus, aMsg, returnFile);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
@ -3744,6 +3744,7 @@ nsMsgCompose::ProcessSignature(nsIMsgIdentity *identity, PRBool aQuoted, nsStrin
|
|||
//
|
||||
// user_pref(".....sig_file", "y:\\sig.html");
|
||||
// user_pref(".....attach_signature", true);
|
||||
// user_pref("...sigText", "unicode sig");
|
||||
//
|
||||
// Note: We will have intelligent signature behavior in that we
|
||||
// look at the signature file first...if the extension is .htm or
|
||||
|
@ -3755,6 +3756,10 @@ nsMsgCompose::ProcessSignature(nsIMsgIdentity *identity, PRBool aQuoted, nsStrin
|
|||
// are doing plain text compose, we should insert some sort of message
|
||||
// saying "Image Signature Omitted" or something.
|
||||
//
|
||||
// If there's a sig pref, we will append its text after the sig file contents - we don't
|
||||
// expect many users to use both, but when they do, I think it the pref text is more
|
||||
// likely to be centrally controlled by MCD or a custom installation, and thus will
|
||||
// be more general, and thus should probably go after the user's sig file.
|
||||
nsCAutoString sigNativePath;
|
||||
PRBool useSigFile = PR_FALSE;
|
||||
PRBool htmlSig = PR_FALSE;
|
||||
|
@ -3797,17 +3802,19 @@ nsMsgCompose::ProcessSignature(nsIMsgIdentity *identity, PRBool aQuoted, nsStrin
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
nsXPIDLString prefSigText;
|
||||
// the pref sig is always going to be treated as html
|
||||
identity->GetUnicharAttribute("htmlSigText", getter_Copies(prefSigText));
|
||||
// Now, if they didn't even want to use a signature, we should
|
||||
// just return nicely.
|
||||
//
|
||||
if (!useSigFile || NS_FAILED(rv))
|
||||
if ((!useSigFile && prefSigText.IsEmpty()) || NS_FAILED(rv))
|
||||
return NS_OK;
|
||||
|
||||
nsFileSpec testSpec(sigNativePath.get());
|
||||
|
||||
// If this file doesn't really exist, just bail!
|
||||
if (!testSpec.Exists())
|
||||
if (!testSpec.Exists() && prefSigText.IsEmpty())
|
||||
return NS_OK;
|
||||
|
||||
static const char htmlBreak[] = "<BR>";
|
||||
|
@ -3858,6 +3865,26 @@ nsMsgCompose::ProcessSignature(nsIMsgIdentity *identity, PRBool aQuoted, nsStrin
|
|||
LoadDataFromFile(testSpec, sigData); // Get the data!
|
||||
}
|
||||
|
||||
// if we have a prefSigText, append it to sigData.
|
||||
if (!prefSigText.IsEmpty())
|
||||
{
|
||||
// insert a line between the sig file and the pref sig text, if there was a sig file.
|
||||
if (!sigData.IsEmpty())
|
||||
if (m_composeHTML)
|
||||
sigOutput.AppendLiteral(htmlBreak);
|
||||
else
|
||||
sigOutput.AppendLiteral(CRLF);
|
||||
|
||||
if (!m_composeHTML)
|
||||
{
|
||||
ConvertBufToPlainText(prefSigText, PR_FALSE);
|
||||
sigData.Append(prefSigText);
|
||||
}
|
||||
else
|
||||
{
|
||||
sigData.Append(prefSigText);
|
||||
}
|
||||
}
|
||||
// Now that sigData holds data...if any, append it to the body in a nice
|
||||
// looking manner
|
||||
if (!sigData.IsEmpty())
|
||||
|
|
|
@ -173,7 +173,7 @@ NS_IMPL_ISUPPORTS1(nsMsgCopy, nsIUrlListener)
|
|||
|
||||
nsMsgCopy::nsMsgCopy()
|
||||
{
|
||||
mFileSpec = nsnull;
|
||||
mFile = nsnull;
|
||||
mMode = nsIMsgSend::nsMsgDeliverNow;
|
||||
mSavePref = nsnull;
|
||||
}
|
||||
|
@ -185,7 +185,7 @@ nsMsgCopy::~nsMsgCopy()
|
|||
|
||||
nsresult
|
||||
nsMsgCopy::StartCopyOperation(nsIMsgIdentity *aUserIdentity,
|
||||
nsIFileSpec *aFileSpec,
|
||||
nsIFile *aFile,
|
||||
nsMsgDeliverMode aMode,
|
||||
nsIMsgSend *aMsgSendObj,
|
||||
const char *aSavePref,
|
||||
|
@ -247,7 +247,7 @@ nsMsgCopy::StartCopyOperation(nsIMsgIdentity *aUserIdentity,
|
|||
}
|
||||
|
||||
mMode = aMode;
|
||||
mFileSpec = aFileSpec;
|
||||
mFile = aFile;
|
||||
mDstFolder = dstFolder;
|
||||
mMsgToReplace = aMsgToReplace;
|
||||
mIsDraft = isDraft;
|
||||
|
@ -255,14 +255,14 @@ nsMsgCopy::StartCopyOperation(nsIMsgIdentity *aUserIdentity,
|
|||
if (!waitForUrl)
|
||||
{
|
||||
// cache info needed for DoCopy and call DoCopy when OnStopUrl is called.
|
||||
rv = DoCopy(aFileSpec, dstFolder, aMsgToReplace, isDraft, msgWindow, aMsgSendObj);
|
||||
rv = DoCopy(aFile, dstFolder, aMsgToReplace, isDraft, msgWindow, aMsgSendObj);
|
||||
// N.B. "this" may be deleted when this call returns.
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsMsgCopy::DoCopy(nsIFileSpec *aDiskFile, nsIMsgFolder *dstFolder,
|
||||
nsMsgCopy::DoCopy(nsIFile *aDiskFile, nsIMsgFolder *dstFolder,
|
||||
nsIMsgDBHdr *aMsgToReplace, PRBool aIsDraft,
|
||||
nsIMsgWindow *msgWindow,
|
||||
nsIMsgSend *aMsgSendObj)
|
||||
|
@ -334,7 +334,7 @@ nsMsgCopy::OnStopRunningUrl(nsIURI * aUrl, nsresult aExitCode)
|
|||
nsresult rv = aExitCode;
|
||||
if (NS_SUCCEEDED(aExitCode))
|
||||
{
|
||||
rv = DoCopy(mFileSpec, mDstFolder, mMsgToReplace, mIsDraft, nsnull, mMsgSendObj);
|
||||
rv = DoCopy(mFile, mDstFolder, mMsgToReplace, mIsDraft, nsnull, mMsgSendObj);
|
||||
}
|
||||
return rv;
|
||||
}
|
||||
|
@ -381,10 +381,10 @@ nsMsgCopy::CreateIfMissing(nsIMsgFolder **folder, PRBool *waitForUrl)
|
|||
(*folder)->GetParent(getter_AddRefs(parent));
|
||||
if (!parent)
|
||||
{
|
||||
nsCOMPtr <nsIFileSpec> folderPath;
|
||||
nsCOMPtr <nsILocalFile> folderPath;
|
||||
// for local folders, path is to the berkeley mailbox.
|
||||
// for imap folders, path needs to have .msf appended to the name
|
||||
(*folder)->GetPath(getter_AddRefs(folderPath));
|
||||
(*folder)->GetFilePath(getter_AddRefs(folderPath));
|
||||
PRBool isImapFolder = !nsCRT::strncasecmp(mSavePref, "imap:", 5);
|
||||
// if we can't get the path from the folder, then try to create the storage.
|
||||
// for imap, it doesn't matter if the .msf file exists - it still might not
|
||||
|
|
|
@ -39,7 +39,7 @@
|
|||
#define _nsMsgCopy_H_
|
||||
|
||||
#include "nscore.h"
|
||||
#include "nsIFileSpec.h"
|
||||
#include "nsIFile.h"
|
||||
#include "nsMsgSend.h"
|
||||
#include "nsIMsgFolder.h"
|
||||
#include "nsITransactionManager.h"
|
||||
|
@ -105,13 +105,13 @@ public:
|
|||
//////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
nsresult StartCopyOperation(nsIMsgIdentity *aUserIdentity,
|
||||
nsIFileSpec *aFileSpec,
|
||||
nsIFile *aFile,
|
||||
nsMsgDeliverMode aMode,
|
||||
nsIMsgSend *aMsgSendObj,
|
||||
const char *aSavePref,
|
||||
nsIMsgDBHdr *aMsgToReplace);
|
||||
|
||||
nsresult DoCopy(nsIFileSpec *aDiskFile, nsIMsgFolder *dstFolder,
|
||||
nsresult DoCopy(nsIFile *aDiskFile, nsIMsgFolder *dstFolder,
|
||||
nsIMsgDBHdr *aMsgToReplace, PRBool aIsDraft,
|
||||
nsIMsgWindow *msgWindow,
|
||||
nsIMsgSend *aMsgSendObj);
|
||||
|
@ -126,7 +126,7 @@ public:
|
|||
//
|
||||
// Vars for implementation...
|
||||
//
|
||||
nsIFileSpec *mFileSpec; // the file we are sending...
|
||||
nsIFile *mFile; // the file we are sending...
|
||||
nsMsgDeliverMode mMode;
|
||||
nsCOMPtr<nsIMsgFolder> mDstFolder;
|
||||
nsCOMPtr<nsIMsgDBHdr> mMsgToReplace;
|
||||
|
|
|
@ -60,7 +60,7 @@
|
|||
#include "nsICharsetConverterManager.h"
|
||||
#include "nsIMsgSendListener.h"
|
||||
#include "nsIMsgCopyServiceListener.h"
|
||||
#include "nsIFileSpec.h"
|
||||
#include "nsIFile.h"
|
||||
#include "nsIURL.h"
|
||||
#include "nsNetUtil.h"
|
||||
#include "nsIFileURL.h"
|
||||
|
@ -1166,10 +1166,7 @@ nsMsgComposeAndSend::GatherMimeAttachments()
|
|||
NotifyListenerOnStopSending(nsnull, NS_ERROR_OUT_OF_MEMORY, nsnull, nsnull);
|
||||
else
|
||||
{
|
||||
nsCOMPtr<nsIFileSpec> aFileSpec;
|
||||
NS_NewFileSpecFromIFile(mTempFile, getter_AddRefs(aFileSpec));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
NotifyListenerOnStopSending(nsnull, NS_OK, nsnull, aFileSpec);
|
||||
NotifyListenerOnStopSending(nsnull, NS_OK, nsnull, mTempFile);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
@ -3949,10 +3946,10 @@ nsMsgComposeAndSend::NotifyListenerOnStatus(const char *aMsgID, const PRUnichar
|
|||
|
||||
NS_IMETHODIMP
|
||||
nsMsgComposeAndSend::NotifyListenerOnStopSending(const char *aMsgID, nsresult aStatus, const PRUnichar *aMsg,
|
||||
nsIFileSpec *returnFileSpec)
|
||||
nsIFile *returnFile)
|
||||
{
|
||||
if (mListener != nsnull)
|
||||
mListener->OnStopSending(aMsgID, aStatus, aMsg, returnFileSpec);
|
||||
mListener->OnStopSending(aMsgID, aStatus, aMsg, returnFile);
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -4829,6 +4826,11 @@ FAIL:
|
|||
if (inputFile)
|
||||
inputFile->Close();
|
||||
|
||||
|
||||
// here we should clone mCopyFile, since it has changed on disk.
|
||||
nsCOMPtr <nsIFile> clonedFile;
|
||||
mCopyFile->Clone(getter_AddRefs(clonedFile));
|
||||
mCopyFile = clonedFile;
|
||||
//
|
||||
// When we get here, we have to see if we have been successful so far.
|
||||
// If we have, then we should start up the async copy service operation.
|
||||
|
@ -4872,11 +4874,7 @@ nsMsgComposeAndSend::StartMessageCopyOperation(nsIFile *aFile,
|
|||
if (mListener)
|
||||
mListener->OnGetDraftFolderURI(m_folderName.get());
|
||||
|
||||
nsCOMPtr<nsIFileSpec> fileSpec;
|
||||
rv = NS_NewFileSpecFromIFile(aFile, getter_AddRefs(fileSpec));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
rv = mCopyObj->StartCopyOperation(mUserIdentity, fileSpec, mode,
|
||||
rv = mCopyObj->StartCopyOperation(mUserIdentity, aFile, mode,
|
||||
this, m_folderName.get(), mMsgToReplace);
|
||||
return rv;
|
||||
}
|
||||
|
@ -4943,11 +4941,7 @@ nsresult nsMsgComposeAndSend::Abort()
|
|||
nsCOMPtr<nsIMsgCopyService> copyService = do_GetService(NS_MSGCOPYSERVICE_CONTRACTID, &rv);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIFileSpec> fileSpec;
|
||||
rv = NS_NewFileSpecFromIFile(mCopyFile, getter_AddRefs(fileSpec));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
copyService->NotifyCompletion(fileSpec, mCopyObj->mDstFolder, NS_ERROR_ABORT);
|
||||
copyService->NotifyCompletion(mCopyFile, mCopyObj->mDstFolder, NS_ERROR_ABORT);
|
||||
}
|
||||
mAbortInProcess = PR_FALSE;
|
||||
return NS_OK;
|
||||
|
|
|
@ -41,7 +41,7 @@
|
|||
#include "nsIPrefService.h"
|
||||
#include "nsIPrefBranch.h"
|
||||
#include "nsIEnumerator.h"
|
||||
#include "nsIFileSpec.h"
|
||||
#include "nsIFile.h"
|
||||
#include "nsISmtpService.h"
|
||||
#include "nsIMsgMailNewsUrl.h"
|
||||
#include "nsMsgDeliveryListener.h"
|
||||
|
@ -370,7 +370,7 @@ SendOperationListener::OnSendNotPerformed(const char *aMsgID, nsresult aStatus)
|
|||
|
||||
nsresult
|
||||
SendOperationListener::OnStopSending(const char *aMsgID, nsresult aStatus, const PRUnichar *aMsg,
|
||||
nsIFileSpec *returnFileSpec)
|
||||
nsIFile *returnFile)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
||||
|
@ -548,7 +548,7 @@ nsMsgSendLater::CompleteMailFileSend()
|
|||
rv = pMsgSend->SendMessageFile(identity,
|
||||
mAccountKey,
|
||||
compFields, // nsIMsgCompFields *fields,
|
||||
mTempFile, // nsIFile *sendFileSpec,
|
||||
mTempFile, // nsIFile *sendFile,
|
||||
PR_TRUE, // PRBool deleteSendFileOnCompletion,
|
||||
PR_FALSE, // PRBool digest_p,
|
||||
nsIMsgSend::nsMsgSendUnsent, // nsMsgDeliverMode mode,
|
||||
|
@ -563,7 +563,6 @@ nsMsgSendLater::CompleteMailFileSend()
|
|||
nsresult
|
||||
nsMsgSendLater::StartNextMailFileSend()
|
||||
{
|
||||
nsFileSpec fileSpec;
|
||||
nsresult rv = NS_OK;
|
||||
nsXPIDLCString messageURI;
|
||||
|
||||
|
|
|
@ -712,6 +712,8 @@ NS_IMETHODIMP nsMsgHdr::SetCharset(const char *aCharset)
|
|||
NS_IMETHODIMP nsMsgHdr::SetThreadParent(nsMsgKey inKey)
|
||||
{
|
||||
m_threadParent = inKey;
|
||||
if (inKey == m_messageKey)
|
||||
NS_ASSERTION(PR_FALSE, "can't be your own parent");
|
||||
SetUInt32Column(m_threadParent, m_mdb->m_threadParentColumnToken);
|
||||
m_initedValues |= THREAD_PARENT_INITED;
|
||||
return NS_OK;
|
||||
|
|
|
@ -45,7 +45,6 @@ interface nsIMsgMailNewsUrl;
|
|||
|
||||
interface nsIImapMessageSink : nsISupports {
|
||||
// set up messge download output stream
|
||||
// void SetupMsgWriteStream(in nsIFileSpec aFileSpec, in boolean appendDummyEnvelope);
|
||||
void SetupMsgWriteStream(in string aNativePath, in boolean appendDummyEnvelope);
|
||||
|
||||
void ParseAdoptedMsgLine(in string adoptedMsgLine, in nsMsgKey uidOfMsg);
|
||||
|
|
|
@ -52,13 +52,14 @@ interface nsIImapMessageSink;
|
|||
interface nsIUrlListener;
|
||||
interface nsIURI;
|
||||
interface nsIEventTarget;
|
||||
interface nsIFile;
|
||||
interface nsIMsgFolder;
|
||||
interface nsIMsgWindow;
|
||||
interface nsIImapIncomingServer;
|
||||
interface nsICacheSession;
|
||||
|
||||
|
||||
[scriptable, uuid(0819ca53-746b-4072-896a-87a452dc5a77)]
|
||||
[scriptable, uuid(f05bce9f-66ec-40d3-ac89-0273bbcb4ed6)]
|
||||
interface nsIImapService : nsISupports
|
||||
{
|
||||
// As always, you can pass in null for the url listener and the url if you don't require either.....
|
||||
|
@ -185,7 +186,7 @@ interface nsIImapService : nsISupports
|
|||
|
||||
|
||||
void appendMessageFromFile(in nsIEventTarget aClientEventTarget,
|
||||
in nsIFileSpec aFileSpec,
|
||||
in nsIFile aFile,
|
||||
in nsIMsgFolder aDstFolder,
|
||||
in string aMessageId,
|
||||
in boolean idsAreUids,
|
||||
|
|
|
@ -41,7 +41,7 @@ interface nsIImapMailFolderSink;
|
|||
interface nsIImapMessageSink;
|
||||
interface nsIImapServerSink;
|
||||
interface nsIImapMockChannel;
|
||||
interface nsIFileSpec;
|
||||
interface nsIFile;
|
||||
interface nsIMsgFolder;
|
||||
|
||||
typedef long nsImapAction;
|
||||
|
@ -60,7 +60,7 @@ interface nsImapContentModifiedTypes
|
|||
const long IMAP_CONTENT_FORCE_CONTENT_NOT_MODIFIED = 3;
|
||||
} ;
|
||||
|
||||
[scriptable, uuid(76497ba8-2a58-4d59-8347-0cf6c6a50586)]
|
||||
[scriptable, uuid(6EB322E4-47BA-4EB9-8116-7AFF70D66AAD)]
|
||||
interface nsIImapUrl : nsISupports
|
||||
{
|
||||
// Initialization method used to initialize the url...
|
||||
|
@ -108,7 +108,7 @@ interface nsIImapUrl : nsISupports
|
|||
attribute boolean externalLinkUrl; // true if we ran this url because the user clicked on a link.
|
||||
attribute boolean validUrl; // false if we couldn't parse url for whatever reason.
|
||||
attribute nsISupports copyState;
|
||||
attribute nsIFileSpec msgFileSpec;
|
||||
attribute nsIFile msgFile;
|
||||
attribute nsIImapMockChannel mockChannel;
|
||||
attribute boolean shouldStoreMsgOffline; // set to true if we should store the msg for offline use if we can,
|
||||
// i.e., we're not doing mime parts on demand.
|
||||
|
|
|
@ -3091,37 +3091,24 @@ NS_IMETHODIMP nsImapMailFolder::BeginCopy(nsIMsgDBHdr *message)
|
|||
nsresult rv = NS_ERROR_NULL_POINTER;
|
||||
if (!m_copyState)
|
||||
return rv;
|
||||
if (m_copyState->m_tmpFileSpec) // leftover file spec nuke it
|
||||
if (m_copyState->m_tmpFile) // leftover file spec nuke it
|
||||
{
|
||||
PRBool isOpen = PR_FALSE;
|
||||
rv = m_copyState->m_tmpFileSpec->IsStreamOpen(&isOpen);
|
||||
if (isOpen)
|
||||
m_copyState->m_tmpFileSpec->CloseStream();
|
||||
nsFileSpec fileSpec;
|
||||
m_copyState->m_tmpFileSpec->GetFileSpec(&fileSpec);
|
||||
if (fileSpec.Valid())
|
||||
fileSpec.Delete(PR_FALSE);
|
||||
m_copyState->m_tmpFileSpec = nsnull;
|
||||
m_copyState->m_tmpFile->Remove(PR_FALSE);
|
||||
m_copyState->m_tmpFile = nsnull;
|
||||
}
|
||||
if (message)
|
||||
m_copyState->m_message = do_QueryInterface(message, &rv);
|
||||
|
||||
nsFileSpec tmpFileSpec;
|
||||
nsCOMPtr<nsIFile> msgFile;
|
||||
|
||||
rv = GetSpecialDirectoryWithFileName(NS_OS_TEMP_DIR,
|
||||
"nscpmsg.txt",
|
||||
&tmpFileSpec);
|
||||
|
||||
tmpFileSpec.MakeUnique();
|
||||
rv = NS_NewFileSpecWithSpec(tmpFileSpec,
|
||||
getter_AddRefs(m_copyState->m_tmpFileSpec));
|
||||
nsCOMPtr<nsILocalFile> msgFile;
|
||||
if (NS_SUCCEEDED(rv))
|
||||
rv = NS_FileSpecToIFile(&tmpFileSpec, getter_AddRefs(msgFile));
|
||||
getter_AddRefs(m_copyState->m_tmpFile));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
nsCOMPtr<nsIOutputStream> fileOutputStream;
|
||||
rv = NS_NewLocalFileOutputStream(getter_AddRefs(fileOutputStream), msgFile, -1, 00600);
|
||||
nsCOMPtr <nsILocalFile> localFile = do_QueryInterface(m_copyState->m_tmpFile);
|
||||
rv = NS_NewLocalFileOutputStream(getter_AddRefs(fileOutputStream), localFile, -1, 00600);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
rv = NS_NewBufferedOutputStream(getter_AddRefs(m_copyState->m_msgFileStream), fileOutputStream, FOUR_K);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
|
@ -3225,7 +3212,7 @@ NS_IMETHODIMP nsImapMailFolder::CopyData(nsIInputStream *aIStream,
|
|||
PRInt32 aLength)
|
||||
{
|
||||
nsresult rv = NS_ERROR_NULL_POINTER;
|
||||
NS_ASSERTION(m_copyState && m_copyState->m_tmpFileSpec
|
||||
NS_ASSERTION(m_copyState && m_copyState->m_tmpFile
|
||||
&& m_copyState->m_dataBuffer, "Fatal copy operation error\n");
|
||||
if (!m_copyState || !m_copyState->m_msgFileStream || !m_copyState->m_dataBuffer)
|
||||
return rv;
|
||||
|
@ -3251,7 +3238,7 @@ NS_IMETHODIMP nsImapMailFolder::EndCopy(PRBool copySucceeded)
|
|||
if (m_copyState)
|
||||
copySupport = do_QueryInterface(m_copyState);
|
||||
rv = imapService->AppendMessageFromFile(m_thread,
|
||||
m_copyState->m_tmpFileSpec,
|
||||
m_copyState->m_tmpFile,
|
||||
this, "", PR_TRUE,
|
||||
m_copyState->m_selectedState,
|
||||
urlListener, nsnull,
|
||||
|
@ -7389,7 +7376,7 @@ nsImapMailFolder::CopyFolder(nsIMsgFolder* srcFolder,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImapMailFolder::CopyFileMessage(nsIFileSpec* fileSpec,
|
||||
nsImapMailFolder::CopyFileMessage(nsIFile* file,
|
||||
nsIMsgDBHdr* msgToReplace,
|
||||
PRBool isDraftOrTemplate,
|
||||
PRUint32 aNewMsgFlags,
|
||||
|
@ -7401,7 +7388,7 @@ nsImapMailFolder::CopyFileMessage(nsIFileSpec* fileSpec,
|
|||
nsCAutoString messageId;
|
||||
nsCOMPtr<nsIUrlListener> urlListener;
|
||||
nsCOMPtr<nsISupportsArray> messages;
|
||||
nsCOMPtr<nsISupports> srcSupport = do_QueryInterface(fileSpec, &rv);
|
||||
nsCOMPtr<nsISupports> srcSupport = do_QueryInterface(file, &rv);
|
||||
|
||||
rv = NS_NewISupportsArray(getter_AddRefs(messages));
|
||||
if (NS_FAILED(rv))
|
||||
|
@ -7432,7 +7419,7 @@ nsImapMailFolder::CopyFileMessage(nsIFileSpec* fileSpec,
|
|||
copySupport = do_QueryInterface(m_copyState);
|
||||
if (!isDraftOrTemplate)
|
||||
m_copyState->m_totalCount = 1;
|
||||
rv = imapService->AppendMessageFromFile(m_thread, fileSpec, this,
|
||||
rv = imapService->AppendMessageFromFile(m_thread, file, this,
|
||||
messageId.get(),
|
||||
PR_TRUE, isDraftOrTemplate,
|
||||
urlListener, nsnull,
|
||||
|
@ -7543,16 +7530,8 @@ nsImapMailCopyState::~nsImapMailCopyState()
|
|||
srcFolder->GetUriForMsg(m_message, getter_Copies(uri));
|
||||
}
|
||||
}
|
||||
if (m_tmpFileSpec)
|
||||
{
|
||||
PRBool isOpen = PR_FALSE;
|
||||
nsFileSpec fileSpec;
|
||||
if (isOpen)
|
||||
m_tmpFileSpec->CloseStream();
|
||||
m_tmpFileSpec->GetFileSpec(&fileSpec);
|
||||
if (fileSpec.Valid())
|
||||
fileSpec.Delete(PR_FALSE);
|
||||
}
|
||||
if (m_tmpFile)
|
||||
m_tmpFile->Remove(PR_FALSE);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -91,7 +91,7 @@ public:
|
|||
nsCOMPtr<nsIMsgDBHdr> m_message; // current message to be copied
|
||||
nsCOMPtr<nsIMsgCopyServiceListener> m_listener; // listener of this copy
|
||||
// operation
|
||||
nsCOMPtr<nsIFileSpec> m_tmpFileSpec; // temp file spec for copy operation
|
||||
nsCOMPtr<nsIFile> m_tmpFile; // temp file spec for copy operation
|
||||
nsCOMPtr<nsIMsgWindow> m_msgWindow; // msg window for copy operation
|
||||
|
||||
nsCOMPtr<nsIMsgMessageService> m_msgService; // source folder message service; can
|
||||
|
@ -272,7 +272,7 @@ public:
|
|||
PRBool allowUndo);
|
||||
NS_IMETHOD CopyFolder(nsIMsgFolder *srcFolder, PRBool isMove, nsIMsgWindow *msgWindow,
|
||||
nsIMsgCopyServiceListener* listener);
|
||||
NS_IMETHOD CopyFileMessage(nsIFileSpec* fileSpec,
|
||||
NS_IMETHOD CopyFileMessage(nsIFile* fileSpec,
|
||||
nsIMsgDBHdr* msgToReplace,
|
||||
PRBool isDraftOrTemplate,
|
||||
PRUint32 aNewMsgFlags,
|
||||
|
|
|
@ -453,7 +453,7 @@ nsImapOfflineSync::ProcessAppendMsgOperation(nsIMsgOfflineImapOperation *current
|
|||
m_curTempFile = tempFileSpec;
|
||||
nsCOMPtr<nsIMsgCopyService> copyService = do_GetService(NS_MSGCOPYSERVICE_CONTRACTID);
|
||||
if (copyService)
|
||||
rv = copyService->CopyFileMessage(tempFileSpec, destFolder,
|
||||
rv = copyService->CopyFileMessage(tmpFile, destFolder,
|
||||
/* nsIMsgDBHdr* msgToReplace */ nsnull,
|
||||
PR_TRUE /* isDraftOrTemplate */,
|
||||
0, // new msg flags - are there interesting flags here?
|
||||
|
|
|
@ -2681,17 +2681,17 @@ nsresult nsImapProtocol::BeginMessageDownLoad(
|
|||
else if (m_imapMessageSink /* && m_imapAction == nsIImapUrl::nsImapSaveMessageToDisk */)
|
||||
{
|
||||
// we get here when download the inbox for offline use
|
||||
nsCOMPtr<nsIFileSpec> fileSpec;
|
||||
nsCOMPtr<nsIFile> file;
|
||||
PRBool addDummyEnvelope = PR_TRUE;
|
||||
nsCOMPtr<nsIMsgMessageUrl> msgurl = do_QueryInterface(m_runningUrl);
|
||||
msgurl->GetMessageFile(getter_AddRefs(fileSpec));
|
||||
msgurl->GetMessageFile(getter_AddRefs(file));
|
||||
msgurl->GetAddDummyEnvelope(&addDummyEnvelope);
|
||||
// m_imapMessageSink->SetupMsgWriteStream(fileSpec, addDummyEnvelope);
|
||||
nsXPIDLCString nativePath;
|
||||
// NS_ASSERTION(fileSpec, "no fileSpec!");
|
||||
if (fileSpec)
|
||||
if (file)
|
||||
{
|
||||
fileSpec->GetNativePath(getter_Copies(nativePath));
|
||||
file->GetNativePath(nativePath);
|
||||
rv = m_imapMessageSink->SetupMsgWriteStream(nativePath, addDummyEnvelope);
|
||||
}
|
||||
}
|
||||
|
@ -5377,10 +5377,10 @@ void nsImapProtocol::OnLSubFolders()
|
|||
|
||||
void nsImapProtocol::OnAppendMsgFromFile()
|
||||
{
|
||||
nsCOMPtr<nsIFileSpec> fileSpec;
|
||||
nsCOMPtr<nsIFile> file;
|
||||
nsresult rv = NS_OK;
|
||||
rv = m_runningUrl->GetMsgFileSpec(getter_AddRefs(fileSpec));
|
||||
if (NS_SUCCEEDED(rv) && fileSpec)
|
||||
rv = m_runningUrl->GetMsgFile(getter_AddRefs(file));
|
||||
if (NS_SUCCEEDED(rv) && file)
|
||||
{
|
||||
char *mailboxName = OnCreateServerSourceFolderPathString();
|
||||
if (mailboxName)
|
||||
|
@ -5412,7 +5412,7 @@ void nsImapProtocol::OnAppendMsgFromFile()
|
|||
rv = m_runningUrl->GetImapAction(&imapAction);
|
||||
if (NS_SUCCEEDED(rv) && (imapAction == nsIImapUrl::nsImapAppendDraftFromFile))
|
||||
flagsToSet |= kImapMsgDraftFlag;
|
||||
UploadMessageFromFile(fileSpec, mailboxName, date, flagsToSet, keywords);
|
||||
UploadMessageFromFile(file, mailboxName, date, flagsToSet, keywords);
|
||||
PR_Free( mailboxName );
|
||||
}
|
||||
else
|
||||
|
@ -5422,16 +5422,16 @@ void nsImapProtocol::OnAppendMsgFromFile()
|
|||
}
|
||||
}
|
||||
|
||||
void nsImapProtocol::UploadMessageFromFile (nsIFileSpec* fileSpec,
|
||||
void nsImapProtocol::UploadMessageFromFile (nsIFile* file,
|
||||
const char* mailboxName,
|
||||
PRTime date,
|
||||
imapMessageFlagsType flags,
|
||||
nsCString &keywords)
|
||||
{
|
||||
if (!fileSpec || !mailboxName) return;
|
||||
if (!file || !mailboxName) return;
|
||||
IncrementCommandTagNumber();
|
||||
|
||||
PRUint32 fileSize = 0;
|
||||
PRInt64 fileSize = 0;
|
||||
PRInt32 totalSize;
|
||||
PRUint32 readCount;
|
||||
char *dataBuffer = nsnull;
|
||||
|
@ -5498,9 +5498,10 @@ void nsImapProtocol::UploadMessageFromFile (nsIFileSpec* fileSpec,
|
|||
|
||||
dataBuffer = (char*) PR_CALLOC(COPY_BUFFER_SIZE+1);
|
||||
if (!dataBuffer) goto done;
|
||||
rv = fileSpec->GetFileSize(&fileSize);
|
||||
rv = file->GetFileSize(&fileSize);
|
||||
if (NS_FAILED(rv)) goto done;
|
||||
rv = fileSpec->GetInputStream(getter_AddRefs(fileInputStream));
|
||||
nsCOMPtr <nsILocalFile> localFile = do_QueryInterface(file);
|
||||
rv = NS_NewLocalFileInputStream(getter_AddRefs(fileInputStream), localFile);
|
||||
if (NS_FAILED(rv) || !fileInputStream) goto done;
|
||||
command.AppendInt((PRInt32)fileSize);
|
||||
if (hasLiteralPlus)
|
||||
|
@ -5526,7 +5527,6 @@ void nsImapProtocol::UploadMessageFromFile (nsIFileSpec* fileSpec,
|
|||
rv = SendData(dataBuffer);
|
||||
totalSize -= readCount;
|
||||
PercentProgressUpdateEvent(nsnull, fileSize - totalSize, fileSize);
|
||||
rv = fileSpec->Eof(&eof);
|
||||
}
|
||||
}
|
||||
if (NS_SUCCEEDED(rv))
|
||||
|
@ -5611,7 +5611,7 @@ void nsImapProtocol::UploadMessageFromFile (nsIFileSpec* fileSpec,
|
|||
}
|
||||
done:
|
||||
PR_Free(dataBuffer);
|
||||
fileSpec->CloseStream();
|
||||
fileInputStream->Close();
|
||||
nsMemory::Free(escapedName);
|
||||
}
|
||||
|
||||
|
|
|
@ -407,7 +407,7 @@ private:
|
|||
void WaitForPotentialListOfMsgsToFetch(PRUint32 **msgIdList, PRUint32 &msgCount);
|
||||
void WaitForPotentialListOfBodysToFetch(PRUint32 **msgIdList, PRUint32 &msgCount);
|
||||
void HeaderFetchCompleted();
|
||||
void UploadMessageFromFile(nsIFileSpec* fileSpec, const char* mailboxName, PRTime date,
|
||||
void UploadMessageFromFile(nsIFile* file, const char* mailboxName, PRTime date,
|
||||
imapMessageFlagsType flags, nsCString &keywords);
|
||||
|
||||
// mailbox name utilities.
|
||||
|
|
|
@ -898,7 +898,7 @@ nsresult nsImapService::DecomposeImapURI(const char * aMessageURI, nsIMsgFolder
|
|||
}
|
||||
|
||||
NS_IMETHODIMP nsImapService::SaveMessageToDisk(const char *aMessageURI,
|
||||
nsIFileSpec *aFile,
|
||||
nsIFile *aFile,
|
||||
PRBool aAddDummyEnvelope,
|
||||
nsIUrlListener *aUrlListener,
|
||||
nsIURI **aURL,
|
||||
|
@ -1912,7 +1912,7 @@ nsImapService::OnlineMessageCopy(nsIEventTarget* aClientEventTarget,
|
|||
return rv;
|
||||
}
|
||||
|
||||
nsresult nsImapService::OfflineAppendFromFile(nsIFileSpec* aFileSpec,
|
||||
nsresult nsImapService::OfflineAppendFromFile(nsIFile* aFile,
|
||||
nsIURI *aUrl,
|
||||
nsIMsgFolder* aDstFolder,
|
||||
const char* messageId, // te be replaced
|
||||
|
@ -1959,15 +1959,16 @@ nsresult nsImapService::OfflineAppendFromFile(nsIFileSpec* aFileSpec,
|
|||
nsCOMPtr <nsIMsgParseMailMsgState> msgParser = do_CreateInstance(NS_PARSEMAILMSGSTATE_CONTRACTID, &rv);
|
||||
msgParser->SetMailDB(destDB);
|
||||
|
||||
nsCOMPtr <nsILocalFile> localFile = do_QueryInterface(aFile);
|
||||
if (NS_SUCCEEDED(rv))
|
||||
rv = aFileSpec->GetInputStream(getter_AddRefs(inputStream));
|
||||
rv = NS_NewLocalFileInputStream(getter_AddRefs(inputStream), localFile);
|
||||
if (NS_SUCCEEDED(rv) && inputStream)
|
||||
{
|
||||
// now, copy the temp file to the offline store for the dest folder.
|
||||
PRInt32 inputBufferSize = 10240;
|
||||
nsMsgLineStreamBuffer *inputStreamBuffer = new nsMsgLineStreamBuffer(inputBufferSize, PR_TRUE /* allocate new lines */, PR_FALSE /* leave CRLFs on the returned string */);
|
||||
PRUint32 fileSize;
|
||||
aFileSpec->GetFileSize(&fileSize);
|
||||
PRInt64 fileSize;
|
||||
aFile->GetFileSize(&fileSize);
|
||||
PRUint32 bytesWritten;
|
||||
rv = NS_OK;
|
||||
// rv = inputStream->Read(inputBuffer, inputBufferSize, &bytesRead);
|
||||
|
@ -2007,8 +2008,8 @@ nsresult nsImapService::OfflineAppendFromFile(nsIFileSpec* aFileSpec,
|
|||
}
|
||||
}
|
||||
// tell the listener we're done.
|
||||
inputStream->Close();
|
||||
inputStream = nsnull;
|
||||
aFileSpec->CloseStream();
|
||||
aListener->OnStopRunningUrl(aUrl, NS_OK);
|
||||
delete inputStreamBuffer;
|
||||
}
|
||||
|
@ -2027,7 +2028,7 @@ nsresult nsImapService::OfflineAppendFromFile(nsIFileSpec* aFileSpec,
|
|||
/* imap://HOST>appenddraftfromfile>DESTINATIONMAILBOXPATH>UID>messageId */
|
||||
NS_IMETHODIMP
|
||||
nsImapService::AppendMessageFromFile(nsIEventTarget* aClientEventTarget,
|
||||
nsIFileSpec* aFileSpec,
|
||||
nsIFile* aFile,
|
||||
nsIMsgFolder* aDstFolder,
|
||||
const char* messageId, // te be replaced
|
||||
PRBool idsAreUids,
|
||||
|
@ -2038,7 +2039,7 @@ nsImapService::AppendMessageFromFile(nsIEventTarget* aClientEventTarget,
|
|||
nsIMsgWindow *aMsgWindow)
|
||||
{
|
||||
nsresult rv = NS_ERROR_NULL_POINTER;
|
||||
if (!aClientEventTarget || !aFileSpec || !aDstFolder)
|
||||
if (!aClientEventTarget || !aFile || !aDstFolder)
|
||||
return rv;
|
||||
|
||||
nsCOMPtr<nsIImapUrl> imapUrl;
|
||||
|
@ -2057,7 +2058,7 @@ nsImapService::AppendMessageFromFile(nsIEventTarget* aClientEventTarget,
|
|||
}
|
||||
|
||||
SetImapUrlSink(aDstFolder, imapUrl);
|
||||
imapUrl->SetMsgFileSpec(aFileSpec);
|
||||
imapUrl->SetMsgFile(aFile);
|
||||
imapUrl->SetCopyState(aCopyState);
|
||||
|
||||
nsCOMPtr<nsIURI> uri = do_QueryInterface(imapUrl);
|
||||
|
@ -2088,7 +2089,7 @@ nsImapService::AppendMessageFromFile(nsIEventTarget* aClientEventTarget,
|
|||
rv = uri->SetSpec(urlSpec);
|
||||
if (WeAreOffline())
|
||||
{
|
||||
return OfflineAppendFromFile(aFileSpec, uri, aDstFolder, messageId, inSelectedState, aListener, aURL, aCopyState);
|
||||
return OfflineAppendFromFile(aFile, uri, aDstFolder, messageId, inSelectedState, aListener, aURL, aCopyState);
|
||||
// handle offline append to drafts or templates folder here.
|
||||
}
|
||||
if (NS_SUCCEEDED(rv))
|
||||
|
@ -2864,14 +2865,6 @@ nsImapService::GetShowComposeMsgLink(PRBool *showComposeMsgLink)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImapService::GetNeedToBuildSpecialFolderURIs(PRBool *needToBuildSpecialFolderURIs)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(needToBuildSpecialFolderURIs);
|
||||
*needToBuildSpecialFolderURIs = PR_TRUE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImapService::GetSpecialFoldersDeletionAllowed(PRBool *specialFoldersDeletionAllowed)
|
||||
{
|
||||
|
|
|
@ -42,7 +42,7 @@
|
|||
#include "nsIMsgMessageService.h"
|
||||
#include "nsISupportsArray.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIFileSpec.h"
|
||||
#include "nsIFile.h"
|
||||
#include "nsIProtocolHandler.h"
|
||||
#include "nsIMsgProtocolInfo.h"
|
||||
#include "nsIContentHandler.h"
|
||||
|
@ -136,7 +136,7 @@ protected:
|
|||
imapMessageFlagsType flags,
|
||||
PRBool messageIdsAreUID);
|
||||
|
||||
nsresult OfflineAppendFromFile(nsIFileSpec* aFileSpec,
|
||||
nsresult OfflineAppendFromFile(nsIFile* aFile,
|
||||
nsIURI *aUrl,
|
||||
nsIMsgFolder* aDstFolder,
|
||||
const char* messageId, // te be replaced
|
||||
|
|
|
@ -96,7 +96,7 @@ nsImapUrl::nsImapUrl()
|
|||
|
||||
// ** jt - the following are not ref counted
|
||||
m_copyState = nsnull;
|
||||
m_fileSpec = nsnull;
|
||||
m_file = nsnull;
|
||||
m_imapMailFolderSink = nsnull;
|
||||
m_imapMessageSink = nsnull;
|
||||
m_addDummyEnvelope = PR_FALSE;
|
||||
|
@ -1184,22 +1184,21 @@ NS_IMETHODIMP nsImapUrl::GetCopyState(nsISupports** copyState)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImapUrl::SetMsgFileSpec(nsIFileSpec* fileSpec)
|
||||
nsImapUrl::SetMsgFile(nsIFile* aFile)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
nsAutoCMonitor mon(this);
|
||||
m_fileSpec = fileSpec; // ** jt - not ref counted
|
||||
m_file = aFile;
|
||||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsImapUrl::GetMsgFileSpec(nsIFileSpec** fileSpec)
|
||||
nsImapUrl::GetMsgFile(nsIFile** aFile)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(fileSpec);
|
||||
NS_ENSURE_ARG_POINTER(aFile);
|
||||
|
||||
nsAutoCMonitor mon(this);
|
||||
*fileSpec = m_fileSpec;
|
||||
NS_IF_ADDREF(*fileSpec);
|
||||
NS_IF_ADDREF(*aFile = m_file);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -1320,19 +1319,16 @@ NS_IMETHODIMP nsImapUrl::SetMsgLoadingFromCache(PRBool loadingFromCache)
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsImapUrl::SetMessageFile(nsIFileSpec * aFileSpec)
|
||||
NS_IMETHODIMP nsImapUrl::SetMessageFile(nsIFile * aFile)
|
||||
{
|
||||
m_messageFileSpec = aFileSpec;
|
||||
m_messageFile = aFile;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsImapUrl::GetMessageFile(nsIFileSpec ** aFileSpec)
|
||||
NS_IMETHODIMP nsImapUrl::GetMessageFile(nsIFile ** aFile)
|
||||
{
|
||||
if (aFileSpec)
|
||||
{
|
||||
*aFileSpec = m_messageFileSpec;
|
||||
NS_IF_ADDREF(*aFileSpec);
|
||||
}
|
||||
if (aFile)
|
||||
NS_IF_ADDREF(*aFile = m_messageFile);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -49,7 +49,7 @@
|
|||
|
||||
#include "nsWeakPtr.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsIFileSpec.h"
|
||||
#include "nsIFile.h"
|
||||
|
||||
class nsImapUrl : public nsIImapUrl, public nsMsgMailNewsUrl, public nsIMsgMessageUrl, public nsIMsgI18NUrl
|
||||
{
|
||||
|
@ -142,11 +142,11 @@ protected:
|
|||
|
||||
// online message copy support; i don't have a better solution yet
|
||||
nsCOMPtr <nsISupports> m_copyState; // now, refcounted.
|
||||
nsIFileSpec* m_fileSpec;
|
||||
nsIFile* m_file;
|
||||
nsCOMPtr<nsIImapMockChannel> m_mockChannel;
|
||||
|
||||
// used by save message to disk
|
||||
nsCOMPtr<nsIFileSpec> m_messageFileSpec;
|
||||
nsCOMPtr<nsIFile> m_messageFile;
|
||||
PRBool m_addDummyEnvelope;
|
||||
PRBool m_canonicalLineEnding; // CRLF
|
||||
|
||||
|
|
|
@ -113,10 +113,9 @@ class EudoraSendListener : public nsIMsgSendListener
|
|||
public:
|
||||
EudoraSendListener() {
|
||||
m_done = PR_FALSE;
|
||||
m_location = nsnull;
|
||||
}
|
||||
|
||||
virtual ~EudoraSendListener() { NS_IF_RELEASE( m_location); }
|
||||
virtual ~EudoraSendListener() { }
|
||||
|
||||
// nsISupports interface
|
||||
NS_DECL_ISUPPORTS
|
||||
|
@ -132,10 +131,9 @@ public:
|
|||
|
||||
/* void OnStopSending (in string aMsgID, in nsresult aStatus, in wstring aMsg, in nsIFileSpec returnFileSpec); */
|
||||
NS_IMETHOD OnStopSending(const char *aMsgID, nsresult aStatus, const PRUnichar *aMsg,
|
||||
nsIFileSpec *returnFileSpec) {
|
||||
nsIFile *returnFile) {
|
||||
m_done = PR_TRUE;
|
||||
m_location = returnFileSpec;
|
||||
NS_IF_ADDREF( m_location);
|
||||
m_location = returnFile;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
@ -147,11 +145,11 @@ public:
|
|||
|
||||
static nsresult CreateSendListener( nsIMsgSendListener **ppListener);
|
||||
|
||||
void Reset() { m_done = PR_FALSE; NS_IF_RELEASE( m_location); m_location = nsnull;}
|
||||
void Reset() { m_done = PR_FALSE; m_location = nsnull;}
|
||||
|
||||
public:
|
||||
PRBool m_done;
|
||||
nsIFileSpec * m_location;
|
||||
nsCOMPtr <nsIFile> m_location;
|
||||
};
|
||||
|
||||
|
||||
|
@ -777,7 +775,7 @@ nsresult nsEudoraCompose::SendTheMessage( nsIFileSpec *pMsg)
|
|||
nsCRT::free( pMimeType);
|
||||
|
||||
if (pListen->m_location) {
|
||||
pMsg->FromFileSpec( pListen->m_location);
|
||||
NS_NewFileSpecFromIFile(pListen->m_location, &pMsg);
|
||||
rv = NS_OK;
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
#include "nsReadableUtils.h"
|
||||
#include "nsUnicharUtils.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIFileSpec.h"
|
||||
#include "nsIFile.h"
|
||||
#include "nsIComponentManager.h"
|
||||
#include "nsIServiceManager.h"
|
||||
#include "nsIIOService.h"
|
||||
|
@ -133,9 +133,9 @@ public:
|
|||
|
||||
/* void OnStopSending (in string aMsgID, in nsresult aStatus, in wstring aMsg, in nsIFileSpec returnFileSpec); */
|
||||
NS_IMETHOD OnStopSending(const char *aMsgID, nsresult aStatus, const PRUnichar *aMsg,
|
||||
nsIFileSpec *returnFileSpec) {
|
||||
nsIFile *returnFile) {
|
||||
m_done = PR_TRUE;
|
||||
m_location = returnFileSpec;
|
||||
m_location = returnFile;
|
||||
NS_IF_ADDREF( m_location);
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -152,7 +152,7 @@ public:
|
|||
|
||||
public:
|
||||
PRBool m_done;
|
||||
nsIFileSpec * m_location;
|
||||
nsIFile * m_location;
|
||||
};
|
||||
|
||||
|
||||
|
@ -718,7 +718,7 @@ nsresult nsOutlookCompose::SendTheMessage( nsIFileSpec *pMsg, nsMsgDeliverMode m
|
|||
nsCRT::free( pMimeType);
|
||||
|
||||
if (pListen->m_location) {
|
||||
pMsg->FromFileSpec( pListen->m_location);
|
||||
NS_NewFileSpecFromIFile(pListen->m_location, &pMsg);
|
||||
rv = NS_OK;
|
||||
}
|
||||
else {
|
||||
|
|
|
@ -714,15 +714,12 @@ NS_IMETHODIMP nsMsgLocalMailFolder::GetFolderURL(char **url)
|
|||
|
||||
nsresult rv;
|
||||
|
||||
nsCOMPtr<nsIFileSpec> pathSpec;
|
||||
rv = GetPath(getter_AddRefs(pathSpec));
|
||||
nsCOMPtr<nsILocalFile> path;
|
||||
rv = GetFilePath(getter_AddRefs(path));
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsFileSpec path;
|
||||
rv = pathSpec->GetFileSpec(&path);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsCAutoString tmpPath((nsFilePath)path);
|
||||
nsCAutoString tmpPath;
|
||||
path->GetNativePath(tmpPath);
|
||||
|
||||
nsCAutoString urlStr(urlScheme);
|
||||
urlStr.Append(tmpPath);
|
||||
|
@ -2193,7 +2190,7 @@ nsMsgLocalMailFolder::CopyFolderLocal(nsIMsgFolder *srcFolder,
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgLocalMailFolder::CopyFileMessage(nsIFileSpec* fileSpec, nsIMsgDBHdr*
|
||||
nsMsgLocalMailFolder::CopyFileMessage(nsIFile* aFile, nsIMsgDBHdr*
|
||||
msgToReplace, PRBool isDraftOrTemplate,
|
||||
PRUint32 newMsgFlags,
|
||||
nsIMsgWindow *msgWindow,
|
||||
|
@ -2203,7 +2200,7 @@ nsMsgLocalMailFolder::CopyFileMessage(nsIFileSpec* fileSpec, nsIMsgDBHdr*
|
|||
nsCOMPtr<nsIInputStream> inputStream;
|
||||
nsParseMailMessageState* parseMsgState = nsnull;
|
||||
PRUint32 fileSize = 0;
|
||||
nsCOMPtr<nsISupports> fileSupport(do_QueryInterface(fileSpec, &rv));
|
||||
nsCOMPtr<nsISupports> fileSupport(do_QueryInterface(aFile, &rv));
|
||||
|
||||
nsCOMPtr<nsISupportsArray> messages;
|
||||
rv = NS_NewISupportsArray(getter_AddRefs(messages));
|
||||
|
@ -2229,10 +2226,7 @@ nsMsgLocalMailFolder::CopyFileMessage(nsIFileSpec* fileSpec, nsIMsgDBHdr*
|
|||
parseMsgState->SetMailDB(msgDb);
|
||||
}
|
||||
|
||||
rv = fileSpec->OpenStreamForReading();
|
||||
if (NS_FAILED(rv)) goto done;
|
||||
|
||||
rv = fileSpec->GetInputStream(getter_AddRefs(inputStream));
|
||||
rv = NS_NewLocalFileInputStream(getter_AddRefs(inputStream), aFile);
|
||||
if (NS_FAILED(rv)) goto done;
|
||||
|
||||
rv = NS_ERROR_NULL_POINTER;
|
||||
|
@ -2253,7 +2247,7 @@ done:
|
|||
if(NS_FAILED(rv))
|
||||
(void) OnCopyCompleted(fileSupport, PR_FALSE);
|
||||
|
||||
fileSpec->CloseStream();
|
||||
inputStream->Close();
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
|
|
@ -178,7 +178,7 @@ public:
|
|||
nsIMsgCopyServiceListener* listener, PRBool isFolder, PRBool allowUndo);
|
||||
NS_IMETHOD CopyFolder(nsIMsgFolder *srcFolder, PRBool isMoveFolder, nsIMsgWindow *msgWindow,
|
||||
nsIMsgCopyServiceListener* listener);
|
||||
NS_IMETHOD CopyFileMessage(nsIFileSpec* fileSpec, nsIMsgDBHdr* msgToReplace,
|
||||
NS_IMETHOD CopyFileMessage(nsIFile* aFile, nsIMsgDBHdr* msgToReplace,
|
||||
PRBool isDraftOrTemplate,
|
||||
PRUint32 newMsgFlags,
|
||||
nsIMsgWindow *msgWindow,
|
||||
|
|
|
@ -153,14 +153,13 @@ nsLocalURI2Server(const char* uriStr,
|
|||
// given rootURI and rootURI##folder, return on-disk path of folder
|
||||
nsresult
|
||||
nsLocalURI2Path(const char* rootURI, const char* uriStr,
|
||||
nsFileSpec& pathResult)
|
||||
nsCString& pathResult)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
// verify that rootURI starts with "mailbox:/" or "mailbox-message:/"
|
||||
if ((PL_strcmp(rootURI, kMailboxRootURI) != 0) &&
|
||||
(PL_strcmp(rootURI, kMailboxMessageRootURI) != 0)) {
|
||||
pathResult = nsnull;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
||||
|
@ -184,6 +183,12 @@ nsLocalURI2Path(const char* rootURI, const char* uriStr,
|
|||
nsCString localNativePath;
|
||||
|
||||
localPath->GetNativePath(localNativePath);
|
||||
#if defined(XP_WIN) || defined(XP_OS2)
|
||||
localNativePath.Insert('/', 0);
|
||||
localNativePath.ReplaceChar('\\', '/');
|
||||
if (localNativePath.CharAt(2) == ':')
|
||||
localNativePath.SetCharAt('|', 2);
|
||||
#endif
|
||||
pathResult = localNativePath.get();
|
||||
const char *curPos = uriStr + PL_strlen(rootURI);
|
||||
if (curPos) {
|
||||
|
@ -208,7 +213,8 @@ nsLocalURI2Path(const char* rootURI, const char* uriStr,
|
|||
else
|
||||
NS_MsgCreatePathStringFromFolderURI(curPos, newPath);
|
||||
|
||||
pathResult+=newPath.get();
|
||||
pathResult.Append('/');
|
||||
pathResult.Append(newPath);
|
||||
}
|
||||
|
||||
return NS_OK;
|
||||
|
|
|
@ -46,7 +46,7 @@ static const char kMailboxRootURI[] = "mailbox:/";
|
|||
static const char kMailboxMessageRootURI[] = "mailbox-message:/";
|
||||
|
||||
nsresult
|
||||
nsLocalURI2Path(const char* rootURI, const char* uriStr, nsFileSpec& pathResult);
|
||||
nsLocalURI2Path(const char* rootURI, const char* uriStr, nsCString& pathResult);
|
||||
|
||||
nsresult
|
||||
nsParseLocalMessageURI(const char* uri, nsCString& folderURI, PRUint32 *key);
|
||||
|
|
|
@ -218,7 +218,8 @@ nsresult nsMailboxProtocol::Initialize(nsIURI * aURL)
|
|||
m_initialState = MAILBOX_READ_FOLDER;
|
||||
mCurrentProgress = 0;
|
||||
|
||||
NS_NewFileSpecFromIFile(m_tempMsgFile, getter_AddRefs(m_tempMessageFile));
|
||||
// do we really need both?
|
||||
m_tempMessageFile = m_tempMsgFile;
|
||||
return rv;
|
||||
}
|
||||
|
||||
|
@ -399,8 +400,8 @@ PRInt32 nsMailboxProtocol::DoneReadingMessage()
|
|||
nsresult rv = NS_OK;
|
||||
// and close the article file if it was open....
|
||||
|
||||
if (m_mailboxAction == nsIMailboxUrl::ActionSaveMessageToDisk && m_tempMessageFile)
|
||||
rv = m_tempMessageFile->CloseStream();
|
||||
if (m_mailboxAction == nsIMailboxUrl::ActionSaveMessageToDisk && m_msgFileOutputStream)
|
||||
rv = m_msgFileOutputStream->Close();
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
@ -510,7 +511,7 @@ nsresult nsMailboxProtocol::LoadUrl(nsIURI * aURL, nsISupports * aConsumer)
|
|||
{
|
||||
nsCOMPtr<nsIMsgMessageUrl> msgUri = do_QueryInterface(m_runningUrl);
|
||||
msgUri->GetMessageFile(getter_AddRefs(m_tempMessageFile));
|
||||
m_tempMessageFile->OpenStreamForWriting();
|
||||
NS_NewLocalFileOutputStream(getter_AddRefs(m_msgFileOutputStream), m_tempMessageFile, -1, 00600);
|
||||
}
|
||||
case nsIMailboxUrl::ActionCopyMessage:
|
||||
case nsIMailboxUrl::ActionMoveMessage:
|
||||
|
@ -631,18 +632,18 @@ PRInt32 nsMailboxProtocol::ReadMessageResponse(nsIInputStream * inputStream, PRU
|
|||
// mscott - the firstline hack is aimed at making sure we don't write
|
||||
// out the dummy header when we are trying to display the message.
|
||||
// The dummy header is the From line with the date tag on it.
|
||||
if (m_tempMessageFile && TestFlag(MAILBOX_MSG_PARSE_FIRST_LINE))
|
||||
if (m_msgFileOutputStream && TestFlag(MAILBOX_MSG_PARSE_FIRST_LINE))
|
||||
{
|
||||
PRInt32 count = 0;
|
||||
PRUint32 count = 0;
|
||||
if (line)
|
||||
rv = m_tempMessageFile->Write(line, PL_strlen(line),
|
||||
rv = m_msgFileOutputStream->Write(line, PL_strlen(line),
|
||||
&count);
|
||||
if (NS_FAILED(rv)) break;
|
||||
|
||||
if (canonicalLineEnding)
|
||||
rv = m_tempMessageFile->Write(CRLF, 2, &count);
|
||||
rv = m_msgFileOutputStream->Write(CRLF, 2, &count);
|
||||
else
|
||||
rv = m_tempMessageFile->Write(MSG_LINEBREAK,
|
||||
rv = m_msgFileOutputStream->Write(MSG_LINEBREAK,
|
||||
MSG_LINEBREAK_LEN, &count);
|
||||
|
||||
if (NS_FAILED(rv)) break;
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
|
||||
#include "nsMsgProtocol.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsIFileSpec.h"
|
||||
#include "nsIFile.h"
|
||||
#include "nsIChannel.h"
|
||||
#include "nsIOutputStream.h"
|
||||
#include "nsIMailboxUrl.h"
|
||||
|
@ -116,7 +116,9 @@ private:
|
|||
PRInt32 mCurrentProgress;
|
||||
PRUint32 m_messageID;
|
||||
|
||||
nsCOMPtr<nsIFileSpec> m_tempMessageFile;
|
||||
// can we just use the base class m_tempMsgFile?
|
||||
nsCOMPtr<nsIFile> m_tempMessageFile;
|
||||
nsCOMPtr<nsIOutputStream> m_msgFileOutputStream;
|
||||
|
||||
// this is used to hold the source mailbox file open when move/copying
|
||||
// multiple messages.
|
||||
|
|
|
@ -83,9 +83,8 @@ nsresult nsMailboxService::ParseMailbox(nsIMsgWindow *aMsgWindow, nsFileSpec& aM
|
|||
{
|
||||
nsCOMPtr<nsIMsgMailNewsUrl> url = do_QueryInterface(mailboxurl);
|
||||
// okay now generate the url string
|
||||
nsFilePath filePath(aMailboxPath); // convert to file url representation...
|
||||
nsCAutoString buf;
|
||||
NS_EscapeURL((const char *)filePath,-1,
|
||||
NS_EscapeURL((const char *)aMailboxPath,-1,
|
||||
esc_Minimal|esc_Forced|esc_AlwaysCopy,buf);
|
||||
url->SetUpdatingFolder(PR_TRUE);
|
||||
url->SetMsgWindow(aMsgWindow);
|
||||
|
@ -359,7 +358,7 @@ NS_IMETHODIMP nsMailboxService::OpenAttachment(const char *aContentType,
|
|||
|
||||
NS_IMETHODIMP
|
||||
nsMailboxService::SaveMessageToDisk(const char *aMessageURI,
|
||||
nsIFileSpec *aFile,
|
||||
nsIFile *aFile,
|
||||
PRBool aAddDummyEnvelope,
|
||||
nsIUrlListener *aUrlListener,
|
||||
nsIURI **aURL,
|
||||
|
@ -443,8 +442,8 @@ nsresult nsMailboxService::PrepareMessageUrl(const char * aSrcMsgMailboxURI, nsI
|
|||
// okay now generate the url string
|
||||
char * urlSpec;
|
||||
nsCAutoString folderURI;
|
||||
nsFileSpec folderPath;
|
||||
nsMsgKey msgKey;
|
||||
nsCString folderPath;
|
||||
const char *part = PL_strstr(aSrcMsgMailboxURI, "part=");
|
||||
const char *header = PL_strstr(aSrcMsgMailboxURI, "header=");
|
||||
rv = nsParseLocalMessageURI(aSrcMsgMailboxURI, folderURI, &msgKey);
|
||||
|
@ -454,9 +453,8 @@ nsresult nsMailboxService::PrepareMessageUrl(const char * aSrcMsgMailboxURI, nsI
|
|||
if (NS_SUCCEEDED(rv))
|
||||
{
|
||||
// set up the url spec and initialize the url with it.
|
||||
nsFilePath filePath(folderPath); // convert to file url representation...
|
||||
nsCAutoString buf;
|
||||
NS_EscapeURL((const char *)filePath,-1,
|
||||
NS_EscapeURL(folderPath.get(),-1,
|
||||
esc_Directory|esc_Forced|esc_AlwaysCopy,buf);
|
||||
if (mPrintingOperation)
|
||||
urlSpec = PR_smprintf("mailbox://%s?number=%d&header=print", buf.get(), msgKey);
|
||||
|
|
|
@ -47,8 +47,7 @@
|
|||
#include "nsIURL.h"
|
||||
#include "nsIUrlListener.h"
|
||||
#include "nsIStreamListener.h"
|
||||
#include "nsFileSpec.h"
|
||||
#include "nsIFileSpec.h"
|
||||
#include "nsIFile.h"
|
||||
#include "nsIProtocolHandler.h"
|
||||
#include "nsIRDFService.h"
|
||||
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -40,8 +40,7 @@
|
|||
|
||||
#include "nsIMailboxUrl.h"
|
||||
#include "nsMsgMailNewsUrl.h"
|
||||
#include "nsFileSpec.h"
|
||||
#include "nsIFileSpec.h"
|
||||
#include "nsIFile.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsXPIDLString.h"
|
||||
#include "nsMsgKeyArray.h"
|
||||
|
@ -93,14 +92,14 @@ protected:
|
|||
nsCOMPtr<nsIStreamListener> m_mailboxCopyHandler;
|
||||
|
||||
nsMailboxAction m_mailboxAction; // the action this url represents...parse mailbox, display messages, etc.
|
||||
nsFileSpec *m_filePath;
|
||||
nsCOMPtr <nsILocalFile> m_filePath;
|
||||
char *m_messageID;
|
||||
PRUint32 m_messageSize;
|
||||
nsMsgKey m_messageKey;
|
||||
nsXPIDLCString m_file;
|
||||
|
||||
// used by save message to disk
|
||||
nsCOMPtr<nsIFileSpec> m_messageFileSpec;
|
||||
nsCOMPtr<nsIFile> m_messageFile;
|
||||
PRBool m_addDummyEnvelope;
|
||||
PRBool m_canonicalLineEnding;
|
||||
nsresult ParseSearchPart();
|
||||
|
|
|
@ -595,14 +595,6 @@ nsMovemailService::GetShowComposeMsgLink(PRBool *showComposeMsgLink)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMovemailService::GetNeedToBuildSpecialFolderURIs(PRBool *needToBuildSpecialFolderURIs)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(needToBuildSpecialFolderURIs);
|
||||
*needToBuildSpecialFolderURIs = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMovemailService::GetSpecialFoldersDeletionAllowed(PRBool *specialFoldersDeletionAllowed)
|
||||
{
|
||||
|
|
|
@ -196,14 +196,6 @@ nsNoneService::GetShowComposeMsgLink(PRBool *showComposeMsgLink)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNoneService::GetNeedToBuildSpecialFolderURIs(PRBool *needToBuildSpecialFolderURIs)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(needToBuildSpecialFolderURIs);
|
||||
*needToBuildSpecialFolderURIs = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNoneService::GetSpecialFoldersDeletionAllowed(PRBool *specialFoldersDeletionAllowed)
|
||||
{
|
||||
|
|
|
@ -594,15 +594,6 @@ nsPop3Service::GetShowComposeMsgLink(PRBool *showComposeMsgLink)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPop3Service::GetNeedToBuildSpecialFolderURIs(PRBool *needToBuildSpecialFolderURIs)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(needToBuildSpecialFolderURIs);
|
||||
*needToBuildSpecialFolderURIs = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsPop3Service::GetDefaultServerPort(PRBool isSecure, PRInt32 *aPort)
|
||||
{
|
||||
|
|
|
@ -156,12 +156,6 @@ NS_IMETHODIMP nsRssService::GetShowComposeMsgLink(PRBool *aShowComposeMsgLink)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRssService::GetNeedToBuildSpecialFolderURIs(PRBool *aNeedToBuildSpecialFolderURIs)
|
||||
{
|
||||
NS_ASSERTION(0,"foo");
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsRssService::GetSpecialFoldersDeletionAllowed(PRBool *aSpecialFoldersDeletionAllowed)
|
||||
{
|
||||
NS_ASSERTION(0,"foo");
|
||||
|
|
|
@ -114,7 +114,7 @@ public:
|
|||
|
||||
/* void OnStopSending (in string aMsgID, in nsresult aStatus, in wstring aMsg, in nsIFileSpec returnFileSpec); */
|
||||
NS_IMETHOD OnStopSending(const char *aMsgID, nsresult aStatus, const PRUnichar *aMsg,
|
||||
nsIFileSpec *returnFileSpec) {
|
||||
nsIFile *returnFile) {
|
||||
PR_CEnterMonitor(this);
|
||||
PR_CNotifyAll(this);
|
||||
m_done = PR_TRUE;
|
||||
|
|
|
@ -45,6 +45,7 @@
|
|||
#include "mozITXTToHTMLConv.h"
|
||||
#include "nsIMsgSend.h"
|
||||
#include "nsIMimeConverter.h"
|
||||
#include "nsIFileSpec.h"
|
||||
|
||||
class nsOutputFileStream;
|
||||
|
||||
|
|
|
@ -129,7 +129,7 @@ NS_IMPL_QUERY_INTERFACE7(nsNntpService,
|
|||
|
||||
NS_IMETHODIMP
|
||||
nsNntpService::SaveMessageToDisk(const char *aMessageURI,
|
||||
nsIFileSpec *aFile,
|
||||
nsIFile *aFile,
|
||||
PRBool aAddDummyEnvelope,
|
||||
nsIUrlListener *aUrlListener,
|
||||
nsIURI **aURL,
|
||||
|
@ -1537,14 +1537,6 @@ nsNntpService::GetShowComposeMsgLink(PRBool *showComposeMsgLink)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNntpService::GetNeedToBuildSpecialFolderURIs(PRBool *needToBuildSpecialFolderURIs)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(needToBuildSpecialFolderURIs);
|
||||
*needToBuildSpecialFolderURIs = PR_FALSE;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsNntpService::GetSpecialFoldersDeletionAllowed(PRBool *specialFoldersDeletionAllowed)
|
||||
{
|
||||
|
|
|
@ -43,7 +43,7 @@
|
|||
#include "nsIMsgMessageService.h"
|
||||
#include "nsINntpIncomingServer.h"
|
||||
#include "nsIMsgIncomingServer.h"
|
||||
#include "nsIFileSpec.h"
|
||||
#include "nsIFile.h"
|
||||
#include "MailNewsTypes.h"
|
||||
#include "nsIMsgProtocolInfo.h"
|
||||
#include "nsIMsgWindow.h"
|
||||
|
|
|
@ -226,19 +226,16 @@ NS_IMETHODIMP nsNntpUrl::GetUri(char ** aURI)
|
|||
NS_IMPL_GETSET(nsNntpUrl, AddDummyEnvelope, PRBool, m_addDummyEnvelope)
|
||||
NS_IMPL_GETSET(nsNntpUrl, CanonicalLineEnding, PRBool, m_canonicalLineEnding)
|
||||
|
||||
NS_IMETHODIMP nsNntpUrl::SetMessageFile(nsIFileSpec * aFileSpec)
|
||||
NS_IMETHODIMP nsNntpUrl::SetMessageFile(nsIFile * aFile)
|
||||
{
|
||||
m_messageFileSpec = aFileSpec;
|
||||
m_messageFile = aFile;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsNntpUrl::GetMessageFile(nsIFileSpec ** aFileSpec)
|
||||
NS_IMETHODIMP nsNntpUrl::GetMessageFile(nsIFile ** aFile)
|
||||
{
|
||||
if (aFileSpec)
|
||||
{
|
||||
*aFileSpec = m_messageFileSpec;
|
||||
NS_IF_ADDREF(*aFileSpec);
|
||||
}
|
||||
if (aFile)
|
||||
NS_IF_ADDREF(*aFile = m_messageFile);
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -41,8 +41,7 @@
|
|||
#include "nsINntpUrl.h"
|
||||
#include "nsMsgMailNewsUrl.h"
|
||||
#include "nsINNTPNewsgroupPost.h"
|
||||
#include "nsFileSpec.h"
|
||||
#include "nsIFileSpec.h"
|
||||
#include "nsIFile.h"
|
||||
|
||||
class nsNntpUrl : public nsINntpUrl, public nsMsgMailNewsUrl, public nsIMsgMessageUrl, public nsIMsgI18NUrl
|
||||
{
|
||||
|
@ -77,10 +76,10 @@ private:
|
|||
nsCString mCharsetOverride; // used by nsIMsgI18NUrl...
|
||||
|
||||
nsCString mOriginalSpec;
|
||||
nsFileSpec *m_filePath;
|
||||
nsCOMPtr <nsILocalFile> m_filePath;
|
||||
|
||||
// used by save message to disk
|
||||
nsCOMPtr<nsIFileSpec> m_messageFileSpec;
|
||||
nsCOMPtr<nsIFile> m_messageFile;
|
||||
|
||||
PRPackedBool m_addDummyEnvelope;
|
||||
PRPackedBool m_canonicalLineEnding;
|
||||
|
|
Загрузка…
Ссылка в новой задаче