From f0326b313f2216b98b926fd50100079cb02f7c8d Mon Sep 17 00:00:00 2001 From: "bienvenu%netscape.com" Date: Sun, 25 Mar 2001 22:13:22 +0000 Subject: [PATCH] get replying to offline msg working sr=sspitzer 64424 --- mailnews/imap/src/nsImapProtocol.cpp | 9 ++++++--- mailnews/imap/src/nsImapService.cpp | 13 ++++++++++++- mailnews/news/src/nsNntpService.cpp | 10 ++++++++++ 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/mailnews/imap/src/nsImapProtocol.cpp b/mailnews/imap/src/nsImapProtocol.cpp index 91db169f31d..f7bef5211df 100644 --- a/mailnews/imap/src/nsImapProtocol.cpp +++ b/mailnews/imap/src/nsImapProtocol.cpp @@ -611,10 +611,13 @@ nsresult nsImapProtocol::SetupWithUrl(nsIURI * aURL, nsISupports* aConsumer) // Ensure that the socket can get the notification callbacks nsCOMPtr callbacks; m_mockChannel->GetNotificationCallbacks(getter_AddRefs(callbacks)); - m_channel->SetNotificationCallbacks(callbacks, PR_FALSE); + if (m_channel) + { + m_channel->SetNotificationCallbacks(callbacks, PR_FALSE); - if (NS_SUCCEEDED(rv)) - rv = m_channel->OpenOutputStream(0, -1, 0, getter_AddRefs(m_outputStream)); + if (NS_SUCCEEDED(rv)) + rv = m_channel->OpenOutputStream(0, -1, 0, getter_AddRefs(m_outputStream)); + } } } // if m_runningUrl diff --git a/mailnews/imap/src/nsImapService.cpp b/mailnews/imap/src/nsImapService.cpp index 26e0cbb3fe6..a26f1cb5a91 100644 --- a/mailnews/imap/src/nsImapService.cpp +++ b/mailnews/imap/src/nsImapService.cpp @@ -288,7 +288,18 @@ NS_IMETHODIMP nsImapService::GetUrlForUri(const char *aMessageURI, nsIURI **aURL PRUnichar hierarchySeparator = GetHierarchyDelimiter(folder);; rv = CreateStartOfImapUrl(aMessageURI, getter_AddRefs(imapUrl), folder, nsnull, urlSpec, hierarchySeparator); if (NS_FAILED(rv)) return rv; - imapUrl->SetImapMessageSink(imapMessageSink); + imapUrl->SetImapMessageSink(imapMessageSink); + imapUrl->SetImapFolder(folder); + if (folder) + { + nsCOMPtr mailnewsUrl = do_QueryInterface(imapUrl); + if (mailnewsUrl) + { + PRBool useLocalCache = PR_FALSE; + folder->HasMsgOffline(atoi(msgKey), &useLocalCache); + mailnewsUrl->SetMsgIsInLocalCache(useLocalCache); + } + } nsCOMPtr url = do_QueryInterface(imapUrl); nsXPIDLCString currentSpec; diff --git a/mailnews/news/src/nsNntpService.cpp b/mailnews/news/src/nsNntpService.cpp index ba6f5fdf132..62849280507 100644 --- a/mailnews/news/src/nsNntpService.cpp +++ b/mailnews/news/src/nsNntpService.cpp @@ -377,6 +377,16 @@ NS_IMETHODIMP nsNntpService::GetUrlForUri(const char *aMessageURI, nsIURI **aURL // this is only called by view message source rv = ConstructNntpUrl(messageIdURL.get(), nsnull, aMsgWindow, aMessageURI, nsINntpUrl::ActionDisplayArticle, aURL); NS_ENSURE_SUCCESS(rv,rv); + if (folder && *aURL) + { + nsCOMPtr mailnewsUrl = do_QueryInterface(*aURL); + if (mailnewsUrl) + { + PRBool useLocalCache = PR_FALSE; + folder->HasMsgOffline(key, &useLocalCache); + mailnewsUrl->SetMsgIsInLocalCache(useLocalCache); + } + } return rv; }