Fix for bugscape 10163. Disallowed saving sent msgs to folders in AOL accounts. r=ducarroz, sr=mscott.

This commit is contained in:
cavin%netscape.com 2002-02-13 23:55:45 +00:00
Родитель 2633911ced
Коммит 563324c47c
2 изменённых файлов: 35 добавлений и 3 удалений

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

@ -97,6 +97,7 @@
#include "nsMsgSimulateError.h" #include "nsMsgSimulateError.h"
#include "nsNetCID.h" #include "nsNetCID.h"
#include "nsMsgUtils.h" #include "nsMsgUtils.h"
#include "nsIRDFService.h"
// use these macros to define a class IID for our component. Our object currently // use these macros to define a class IID for our component. Our object currently
// supports two interfaces (nsISupports and nsIMsgCompose) so we want to define constants // supports two interfaces (nsISupports and nsIMsgCompose) so we want to define constants
@ -3012,7 +3013,7 @@ nsMsgComposeAndSend::DeliverMessage()
{ {
return SaveAsDraft(); return SaveAsDraft();
} }
else if (m_deliver_mode == nsMsgSaveAsTemplate) else if (m_deliver_mode == nsMsgSaveAsTemplate)
{ {
return SaveAsTemplate(); return SaveAsTemplate();
} }
@ -3396,6 +3397,34 @@ nsMsgComposeAndSend::DeliverAsNewsExit(nsIURI *aUrl, nsresult aExitCode)
return NS_OK; return NS_OK;
} }
PRBool nsMsgComposeAndSend::CanSaveMessagesToFolder(const char *folderURL)
{
nsresult rv;
nsCOMPtr<nsIRDFService> rdf(do_GetService("@mozilla.org/rdf/rdf-service;1", &rv));
if (NS_FAILED(rv))
return PR_FALSE;
nsCOMPtr<nsIRDFResource> resource;
rv = rdf->GetResource(folderURL, getter_AddRefs(resource));
if (NS_FAILED(rv))
return PR_FALSE;
nsCOMPtr <nsIMsgFolder> thisFolder;
thisFolder = do_QueryInterface(resource, &rv);
if (NS_FAILED(rv) || !thisFolder)
return PR_FALSE;
nsCOMPtr<nsIMsgIncomingServer> server;
rv = thisFolder->GetServer(getter_AddRefs(server));
if (NS_FAILED(rv) || !server)
return PR_FALSE;
// See if we are allowed to save/file msgs to this folder.
PRBool canSave;
rv = server->GetCanFileMessagesOnServer(&canSave);
return canSave;
}
// //
// Now, start the appropriate copy operation. // Now, start the appropriate copy operation.
// //
@ -3403,9 +3432,9 @@ nsresult
nsMsgComposeAndSend::DoFcc() nsMsgComposeAndSend::DoFcc()
{ {
// //
// Just cleanup and return success if no FCC is necessary // Just cleanup and return success if we're not allowed to save msgs to FCC folder.
// //
if (!mCompFields->GetFcc() || !*mCompFields->GetFcc()) if (! CanSaveMessagesToFolder(mCompFields->GetFcc()))
{ {
#ifdef NS_DEBUG #ifdef NS_DEBUG
printf("\nCopy operation disabled by user!\n"); printf("\nCopy operation disabled by user!\n");

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

@ -225,6 +225,9 @@ public:
nsresult SaveInSentFolder(); nsresult SaveInSentFolder();
nsresult SaveAsTemplate(); nsresult SaveAsTemplate();
// Check to see if it's ok to save msgs to the configured folder.
PRBool CanSaveMessagesToFolder(const char *folderURL);
// //
// FCC operations... // FCC operations...
// //