change DisplayMessage to take a URI instead of a path (this method probably isn't used anymore anyway)

This commit is contained in:
alecf%netscape.com 1999-04-28 06:03:28 +00:00
Родитель 7601a780f1
Коммит c50332383b
3 изменённых файлов: 39 добавлений и 15 удалений

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

@ -73,8 +73,11 @@ public:
// message number 'n' in this mailbox without having to go out and get the key for message number // 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. // 'n'. this function simply makes that possible.
///////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////
NS_IMETHOD DisplayMessageNumber(const nsFileSpec& aMailboxPath, PRUint32 aMessageNumber, NS_IMETHOD DisplayMessageNumber(const char *url,
nsISupports * aDisplayConsumer, nsIUrlListener * aUrlListener, nsIURL ** aURL) = 0; PRUint32 aMessageNumber,
nsISupports * aDisplayConsumer,
nsIUrlListener * aUrlListener,
nsIURL ** aURL) = 0;
}; };

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

@ -124,8 +124,12 @@ nsresult nsMailboxService::ParseMailbox(const nsFileSpec& aMailboxPath, nsIStrea
} }
nsresult nsMailboxService::CopyMessage(const char * aSrcMailboxURI, nsIStreamListener * aMailboxCopyHandler, PRBool moveMessage, nsresult
nsIUrlListener * aUrlListener, nsIURL **aURL) nsMailboxService::CopyMessage(const char * aSrcMailboxURI,
nsIStreamListener * aMailboxCopyHandler,
PRBool moveMessage,
nsIUrlListener * aUrlListener,
nsIURL **aURL)
{ {
nsMailboxUrl * mailboxUrl = nsnull; nsMailboxUrl * mailboxUrl = nsnull;
nsIMailboxUrl * url = nsnull; nsIMailboxUrl * url = nsnull;
@ -147,7 +151,8 @@ nsresult nsMailboxService::CopyMessage(const char * aSrcMailboxURI, nsIStreamLis
nsParseLocalMessageURI(aSrcMailboxURI, folderURI, &msgKey); nsParseLocalMessageURI(aSrcMailboxURI, folderURI, &msgKey);
char *rootURI = folderURI.ToNewCString(); char *rootURI = folderURI.ToNewCString();
nsLocalURI2Path(kMailboxMessageRootURI, rootURI, folderPath); nsLocalURI2Path(kMailboxMessageRootURI, rootURI, folderPath);
delete[] rootURI;
nsFilePath filePath(folderPath); // convert to file url representation... nsFilePath filePath(folderPath); // convert to file url representation...
urlSpec = PR_smprintf("mailboxMessage://%s?number=%d", (const char *) filePath, msgKey); urlSpec = PR_smprintf("mailboxMessage://%s?number=%d", (const char *) filePath, msgKey);
@ -182,8 +187,10 @@ nsresult nsMailboxService::CopyMessage(const char * aSrcMailboxURI, nsIStreamLis
return rv; return rv;
} }
nsresult nsMailboxService::DisplayMessage(const char* aMessageURI, nsISupports * aDisplayConsumer, nsresult nsMailboxService::DisplayMessage(const char* aMessageURI,
nsIUrlListener * aUrlListener, nsIURL ** aURL) nsISupports * aDisplayConsumer,
nsIUrlListener * aUrlListener,
nsIURL ** aURL)
{ {
nsMailboxUrl * mailboxUrl = nsnull; nsMailboxUrl * mailboxUrl = nsnull;
nsIMailboxUrl * url = nsnull; nsIMailboxUrl * url = nsnull;
@ -232,8 +239,11 @@ nsresult nsMailboxService::DisplayMessage(const char* aMessageURI, nsISupports *
return rv; return rv;
} }
nsresult nsMailboxService::DisplayMessageNumber(const nsFileSpec& aMailboxPath, PRUint32 aMessageNumber, nsISupports * aDisplayConsumer, nsresult nsMailboxService::DisplayMessageNumber(const char *url,
nsIUrlListener * aUrlListener, nsIURL ** aURL) PRUint32 aMessageNumber,
nsISupports * aDisplayConsumer,
nsIUrlListener * aUrlListener,
nsIURL ** aURL)
{ {
nsMsgKeyArray msgKeys; nsMsgKeyArray msgKeys;
nsresult rv = NS_OK; nsresult rv = NS_OK;
@ -241,13 +251,18 @@ nsresult nsMailboxService::DisplayMessageNumber(const nsFileSpec& aMailboxPath,
nsIMsgDatabase * mailDB = nsnull; nsIMsgDatabase * mailDB = nsnull;
nsIMsgDatabase *mailDBFactory; 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) 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(); mailDBFactory->Release();
} }
// rv = nsMailDatabase::Open((nsFileSpec&) aMailboxPath, PR_FALSE, &mailDb); // rv = nsMailDatabase::Open((nsFileSpec&) mailboxPath, PR_FALSE, &mailDb);
if (NS_SUCCEEDED(rv) && mailDB) if (NS_SUCCEEDED(rv) && mailDB)
{ {
@ -261,7 +276,10 @@ nsresult nsMailboxService::DisplayMessageNumber(const nsFileSpec& aMailboxPath,
mailDB = nsnull; mailDB = nsnull;
char * uri = 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); rv = DisplayMessage(uri, aDisplayConsumer, aUrlListener, aURL);
} }

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

@ -53,8 +53,11 @@ public:
nsIUrlListener * aUrlListener, nsIURL ** aURL); nsIUrlListener * aUrlListener, nsIURL ** aURL);
NS_IMETHOD DisplayMessageNumber(const nsFileSpec& aMailboxPath, PRUint32 aMessageNumber, nsISupports * aDisplayConsumer, NS_IMETHOD DisplayMessageNumber(const char *url,
nsIUrlListener * aUrlListener, nsIURL ** aURL); PRUint32 aMessageNumber,
nsISupports * aDisplayConsumer,
nsIUrlListener * aUrlListener,
nsIURL ** aURL);
//////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////////////////////
// End suppport for the nsIMailboxService Interface // End suppport for the nsIMailboxService Interface