From c50332383b9683564958a145cac40685a45c7226 Mon Sep 17 00:00:00 2001 From: "alecf%netscape.com" Date: Wed, 28 Apr 1999 06:03:28 +0000 Subject: [PATCH] change DisplayMessage to take a URI instead of a path (this method probably isn't used anymore anyway) --- mailnews/local/public/nsIMailboxService.h | 7 ++-- mailnews/local/src/nsMailboxService.cpp | 40 ++++++++++++++++------- mailnews/local/src/nsMailboxService.h | 7 ++-- 3 files changed, 39 insertions(+), 15 deletions(-) diff --git a/mailnews/local/public/nsIMailboxService.h b/mailnews/local/public/nsIMailboxService.h index 0719115bedb..bdf07c5ed82 100644 --- a/mailnews/local/public/nsIMailboxService.h +++ b/mailnews/local/public/nsIMailboxService.h @@ -73,8 +73,11 @@ public: // message number 'n' in this mailbox without having to go out and get the key for message number // 'n'. this function simply makes that possible. ///////////////////////////////////////////////////////////////////////////////////////////// - NS_IMETHOD DisplayMessageNumber(const nsFileSpec& aMailboxPath, PRUint32 aMessageNumber, - nsISupports * aDisplayConsumer, nsIUrlListener * aUrlListener, nsIURL ** aURL) = 0; + NS_IMETHOD DisplayMessageNumber(const char *url, + PRUint32 aMessageNumber, + nsISupports * aDisplayConsumer, + nsIUrlListener * aUrlListener, + nsIURL ** aURL) = 0; }; diff --git a/mailnews/local/src/nsMailboxService.cpp b/mailnews/local/src/nsMailboxService.cpp index 6657b1c36ab..95f7ee97c5e 100644 --- a/mailnews/local/src/nsMailboxService.cpp +++ b/mailnews/local/src/nsMailboxService.cpp @@ -124,8 +124,12 @@ nsresult nsMailboxService::ParseMailbox(const nsFileSpec& aMailboxPath, nsIStrea } -nsresult nsMailboxService::CopyMessage(const char * aSrcMailboxURI, nsIStreamListener * aMailboxCopyHandler, PRBool moveMessage, - nsIUrlListener * aUrlListener, nsIURL **aURL) +nsresult +nsMailboxService::CopyMessage(const char * aSrcMailboxURI, + nsIStreamListener * aMailboxCopyHandler, + PRBool moveMessage, + nsIUrlListener * aUrlListener, + nsIURL **aURL) { nsMailboxUrl * mailboxUrl = nsnull; nsIMailboxUrl * url = nsnull; @@ -147,7 +151,8 @@ nsresult nsMailboxService::CopyMessage(const char * aSrcMailboxURI, nsIStreamLis nsParseLocalMessageURI(aSrcMailboxURI, folderURI, &msgKey); char *rootURI = folderURI.ToNewCString(); nsLocalURI2Path(kMailboxMessageRootURI, rootURI, folderPath); - + delete[] rootURI; + nsFilePath filePath(folderPath); // convert to file url representation... urlSpec = PR_smprintf("mailboxMessage://%s?number=%d", (const char *) filePath, msgKey); @@ -182,8 +187,10 @@ nsresult nsMailboxService::CopyMessage(const char * aSrcMailboxURI, nsIStreamLis return rv; } -nsresult nsMailboxService::DisplayMessage(const char* aMessageURI, nsISupports * aDisplayConsumer, - nsIUrlListener * aUrlListener, nsIURL ** aURL) +nsresult nsMailboxService::DisplayMessage(const char* aMessageURI, + nsISupports * aDisplayConsumer, + nsIUrlListener * aUrlListener, + nsIURL ** aURL) { nsMailboxUrl * mailboxUrl = nsnull; nsIMailboxUrl * url = nsnull; @@ -232,8 +239,11 @@ nsresult nsMailboxService::DisplayMessage(const char* aMessageURI, nsISupports * return rv; } -nsresult nsMailboxService::DisplayMessageNumber(const nsFileSpec& aMailboxPath, PRUint32 aMessageNumber, nsISupports * aDisplayConsumer, - nsIUrlListener * aUrlListener, nsIURL ** aURL) +nsresult nsMailboxService::DisplayMessageNumber(const char *url, + PRUint32 aMessageNumber, + nsISupports * aDisplayConsumer, + nsIUrlListener * aUrlListener, + nsIURL ** aURL) { nsMsgKeyArray msgKeys; nsresult rv = NS_OK; @@ -241,13 +251,18 @@ nsresult nsMailboxService::DisplayMessageNumber(const nsFileSpec& aMailboxPath, nsIMsgDatabase * mailDB = nsnull; nsIMsgDatabase *mailDBFactory; - rv = nsComponentManager::CreateInstance(kCMailDB, nsnull, nsIMsgDatabase::GetIID(), (void **) &mailDBFactory); + rv = nsComponentManager::CreateInstance(kCMailDB, + nsnull, + nsIMsgDatabase::GetIID(), + (void **) &mailDBFactory); + nsFileSpec mailboxPath; + // ALECF: convert uri->mailboxPath with nsLocalURI2Path if (NS_SUCCEEDED(rv) && mailDBFactory) { - rv = mailDBFactory->Open((nsFileSpec&) aMailboxPath, PR_FALSE, (nsIMsgDatabase **) &mailDB, PR_FALSE); + rv = mailDBFactory->Open((nsFileSpec&) mailboxPath, PR_FALSE, (nsIMsgDatabase **) &mailDB, PR_FALSE); mailDBFactory->Release(); } -// rv = nsMailDatabase::Open((nsFileSpec&) aMailboxPath, PR_FALSE, &mailDb); +// rv = nsMailDatabase::Open((nsFileSpec&) mailboxPath, PR_FALSE, &mailDb); if (NS_SUCCEEDED(rv) && mailDB) { @@ -261,7 +276,10 @@ nsresult nsMailboxService::DisplayMessageNumber(const nsFileSpec& aMailboxPath, mailDB = nsnull; char * uri = nsnull; - nsBuildLocalMessageURI(aMailboxPath, msgKey, &uri); + nsBuildLocalMessageURI(url, msgKey, &uri); +#ifdef DEBUG_alecf + fprintf(stderr, "nsBuildLocalMessageURI(%s, %d -> %s) in nsMailboxService::DisplayMessageNumber", url, msgKey, uri); +#endif rv = DisplayMessage(uri, aDisplayConsumer, aUrlListener, aURL); } diff --git a/mailnews/local/src/nsMailboxService.h b/mailnews/local/src/nsMailboxService.h index e8e31358d42..6768df9decc 100644 --- a/mailnews/local/src/nsMailboxService.h +++ b/mailnews/local/src/nsMailboxService.h @@ -53,8 +53,11 @@ public: nsIUrlListener * aUrlListener, nsIURL ** aURL); - NS_IMETHOD DisplayMessageNumber(const nsFileSpec& aMailboxPath, PRUint32 aMessageNumber, nsISupports * aDisplayConsumer, - nsIUrlListener * aUrlListener, nsIURL ** aURL); + NS_IMETHOD DisplayMessageNumber(const char *url, + PRUint32 aMessageNumber, + nsISupports * aDisplayConsumer, + nsIUrlListener * aUrlListener, + nsIURL ** aURL); //////////////////////////////////////////////////////////////////////////////////////// // End suppport for the nsIMailboxService Interface