diff --git a/mozilla/mailnews/base/util/nsMsgFolder.h b/mozilla/mailnews/base/util/nsMsgFolder.h index eb9572aa01a..1a932edcccb 100644 --- a/mozilla/mailnews/base/util/nsMsgFolder.h +++ b/mozilla/mailnews/base/util/nsMsgFolder.h @@ -52,7 +52,7 @@ public: NS_IMETHOD Clear(void); // nsIFolder methods: - NS_IMETHOD GetURI(char* *name) { return nsRDFResource::GetValue((const char**)&name); } + NS_IMETHOD GetURI(char* *name) { return nsRDFResource::GetValue(name); } NS_IMETHOD GetName(char **name); NS_IMETHOD SetName(char *name); NS_IMETHOD GetChildNamed(const char *name, nsISupports* *result); diff --git a/mozilla/mailnews/compose/src/nsComposeAppCore.cpp b/mozilla/mailnews/compose/src/nsComposeAppCore.cpp index a0e1f275e5a..1f8e9c9c136 100644 --- a/mozilla/mailnews/compose/src/nsComposeAppCore.cpp +++ b/mozilla/mailnews/compose/src/nsComposeAppCore.cpp @@ -45,6 +45,7 @@ #include "nsMsgCompPrefs.h" #include "nsIDOMMsgAppCore.h" #include "nsIMessage.h" +#include "nsXPIDLString.h" #include "nsMsgCompCID.h" #include "nsIMsgCompose.h" @@ -615,8 +616,8 @@ nsComposeAppCore::NewMessage(nsAutoString& aUrl, getter_AddRefs(rdfResource)); if (rdfResource) { - const char *uri = 0; - rdfResource->GetValue(&uri); + nsXPIDLCString uri; + rdfResource->GetValue( getter_Copies(uri) ); nsString messageUri = uri; } if (messageType == 2) diff --git a/mozilla/mailnews/local/src/nsMSGFolderDataSource.cpp b/mozilla/mailnews/local/src/nsMSGFolderDataSource.cpp index 851033f23f3..60654439efa 100644 --- a/mozilla/mailnews/local/src/nsMSGFolderDataSource.cpp +++ b/mozilla/mailnews/local/src/nsMSGFolderDataSource.cpp @@ -42,6 +42,7 @@ #include "nsIMsgRFC822Parser.h" #include "nsMsgBaseCID.h" #include "nsCOMPtr.h" +#include "nsXPIDLString.h" //This is a temporary dependency. I need this for parsemessageURI. In the future //we should have the nsIMessage have the ability to get the folder from it. #include "nsLocalMailFolder.h" @@ -238,7 +239,7 @@ NS_IMETHODIMP nsMSGFolderDataSource::Init(const char* uri) if ((mURI = PL_strdup(uri)) == nsnull) return NS_ERROR_OUT_OF_MEMORY; - gRDFService->RegisterDataSource(this); + gRDFService->RegisterDataSource(this, PR_FALSE); if (! kNC_Child) { gRDFService->GetResource(kURINC_child, &kNC_Child); @@ -284,10 +285,12 @@ NS_IMETHODIMP nsMSGFolderDataSource::Init(const char* uri) return NS_OK; } -NS_IMETHODIMP nsMSGFolderDataSource::GetURI(const char* *uri) const +NS_IMETHODIMP nsMSGFolderDataSource::GetURI(char* *uri) { - *uri = mURI; - return NS_OK; + if ((*uri = nsXPIDLCString::Copy(mURI)) == nsnull) + return NS_ERROR_OUT_OF_MEMORY; + else + return NS_OK; } NS_IMETHODIMP nsMSGFolderDataSource::GetSource(nsIRDFResource* property, @@ -719,7 +722,8 @@ nsMSGFolderDataSource::GetAllCommands(nsIRDFResource* source, NS_IMETHODIMP nsMSGFolderDataSource::IsCommandEnabled(nsISupportsArray/**/* aSources, nsIRDFResource* aCommand, - nsISupportsArray/**/* aArguments) + nsISupportsArray/**/* aArguments, + PRBool* aResult) { nsIMsgFolder* folder; nsIMessage* message; @@ -731,8 +735,10 @@ nsMSGFolderDataSource::IsCommandEnabled(nsISupportsArray/**/* aS NS_RELEASE(folder); // release now that we know it's a folder // we don't care about the arguments -- folder commands are always enabled - if (!(peq(aCommand, kNC_Delete))) - return NS_COMFALSE; + if (!(peq(aCommand, kNC_Delete))) { + *aResult = PR_FALSE; + return NS_OK; + } } else if (NS_SUCCEEDED(source->QueryInterface(nsIMessage::GetIID(), (void**)&message))) { NS_RELEASE(message); // release now that we know it's a message @@ -740,10 +746,13 @@ nsMSGFolderDataSource::IsCommandEnabled(nsISupportsArray/**/* aS // we don't care about the arguments -- message commands are always enabled if (!(peq(aCommand, kNC_Delete) || peq(aCommand, kNC_Reply) || - peq(aCommand, kNC_Forward))) - return NS_COMFALSE; + peq(aCommand, kNC_Forward))) { + *aResult = PR_FALSE; + return NS_OK; + } } } + *aResult = PR_TRUE; return NS_OK; // succeeded for all sources } @@ -847,11 +856,11 @@ nsresult nsMSGFolderDataSource::GetFolderFromMessage(nsIMessage *message, nsIMsg { nsresult rv; - const char *uri; + nsXPIDLCString uri; nsIRDFResource *resource; if(NS_SUCCEEDED( rv = message->QueryInterface(nsIRDFResource::GetIID(), (void**)&resource))) { - resource->GetValue(&uri); + resource->GetValue( getter_Copies(uri) ); nsString messageFolderURIStr; nsMsgKey key; nsParseLocalMessageURI(uri, messageFolderURIStr, &key); diff --git a/mozilla/mailnews/local/src/nsMSGFolderDataSource.h b/mozilla/mailnews/local/src/nsMSGFolderDataSource.h index 253004558a5..33f3fd4cb64 100644 --- a/mozilla/mailnews/local/src/nsMSGFolderDataSource.h +++ b/mozilla/mailnews/local/src/nsMSGFolderDataSource.h @@ -46,7 +46,7 @@ public: // nsIRDFDataSource methods NS_IMETHOD Init(const char* uri); - NS_IMETHOD GetURI(const char* *uri) const; + NS_IMETHOD GetURI(char* *uri); NS_IMETHOD GetSource(nsIRDFResource* property, nsIRDFNode* target, @@ -102,7 +102,8 @@ public: NS_IMETHOD IsCommandEnabled(nsISupportsArray/**/* aSources, nsIRDFResource* aCommand, - nsISupportsArray/**/* aArguments); + nsISupportsArray/**/* aArguments, + PRBool* aResult); NS_IMETHOD DoCommand(nsISupportsArray/**/* aSources, nsIRDFResource* aCommand,