зеркало из https://github.com/mozilla/pjs.git
fix 268025 notification when msg is loaded, sr=sspitzer
This commit is contained in:
Родитель
814c4bd9ae
Коммит
763d470e54
|
@ -51,6 +51,7 @@ interface nsIMimeHeaders;
|
|||
interface nsIStreamListener;
|
||||
interface nsIMsgFolder;
|
||||
interface nsIMsgHeaderSink;
|
||||
interface nsIMsgDBHdr;
|
||||
|
||||
[scriptable, uuid(6CFFCEB0-CB8C-11d2-8065-006008128C4E)]
|
||||
interface nsIMsgMailNewsUrl : nsIURL {
|
||||
|
@ -124,7 +125,7 @@ interface nsIMsgMailNewsUrl : nsIURL {
|
|||
// grouping it into a separate interface...
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
[scriptable, uuid(02338DD2-E7B9-11d2-8070-006008128C4E)]
|
||||
[scriptable, uuid(6BEED963-0424-44C5-A605-C01F6DCBAAC2)]
|
||||
interface nsIMsgMessageUrl : nsISupports {
|
||||
// get and set the RDF URI associated with the url. Note, not all urls have
|
||||
// had uri's set on them so be prepared to handle cases where this string is empty.
|
||||
|
@ -134,6 +135,9 @@ interface nsIMsgMessageUrl : nsISupports {
|
|||
attribute boolean AddDummyEnvelope;
|
||||
attribute boolean canonicalLineEnding;
|
||||
attribute string originalSpec;
|
||||
// a message db header for that message.
|
||||
readonly attribute nsIMsgDBHdr messageHeader;
|
||||
|
||||
};
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -56,9 +56,13 @@
|
|||
#include "nsIMsgMailNewsUrl.h"
|
||||
#include "nsIMimeMiscStatus.h"
|
||||
#include "nsIMsgWindow.h"
|
||||
#include "nsMsgUtils.h"
|
||||
#include "nsIMsgHdr.h"
|
||||
|
||||
#define MSGFEEDBACK_TIMER_INTERVAL 500
|
||||
|
||||
nsIAtom * nsMsgStatusFeedback::kMsgLoadedAtom = nsnull;
|
||||
|
||||
nsMsgStatusFeedback::nsMsgStatusFeedback() :
|
||||
m_lastPercent(0)
|
||||
{
|
||||
|
@ -71,11 +75,14 @@ nsMsgStatusFeedback::nsMsgStatusFeedback() :
|
|||
if (NS_SUCCEEDED(rv))
|
||||
bundleService->CreateBundle("chrome://messenger/locale/messenger.properties",
|
||||
getter_AddRefs(mBundle));
|
||||
|
||||
kMsgLoadedAtom = NS_NewAtom("msgLoaded");
|
||||
}
|
||||
|
||||
nsMsgStatusFeedback::~nsMsgStatusFeedback()
|
||||
{
|
||||
mBundle = nsnull;
|
||||
NS_RELEASE(kMsgLoadedAtom);
|
||||
}
|
||||
|
||||
NS_IMPL_THREADSAFE_ADDREF(nsMsgStatusFeedback)
|
||||
|
@ -169,6 +176,22 @@ nsMsgStatusFeedback::OnStateChange(nsIWebProgress* aWebProgress,
|
|||
if (hdrSink)
|
||||
hdrSink->OnEndMsgDownload(mailnewsUrl);
|
||||
}
|
||||
// get the folder and notify that the msg has been loaded. We're
|
||||
// using NotifyPropertyFlagChanged. To be completely consistent,
|
||||
// we'd send a similar notification that the old message was
|
||||
// unloaded.
|
||||
nsXPIDLCString spec;
|
||||
nsCOMPtr <nsIMsgDBHdr> msgHdr;
|
||||
nsCOMPtr <nsIMsgFolder> msgFolder;
|
||||
mailnewsUrl->GetFolder(getter_AddRefs(msgFolder));
|
||||
nsCOMPtr <nsIMsgMessageUrl> msgUrl = do_QueryInterface(mailnewsUrl);
|
||||
if (msgUrl)
|
||||
{
|
||||
// not sending this notification is not a fatal error...
|
||||
(void) msgUrl->GetMessageHeader(getter_AddRefs(msgHdr));
|
||||
if (msgFolder && msgHdr)
|
||||
msgFolder->NotifyPropertyFlagChanged(msgHdr, kMsgLoadedAtom, 0, 1);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
#include "nsIProgressEventSink.h"
|
||||
#include "nsIStringBundle.h"
|
||||
#include "nsWeakReference.h"
|
||||
#include "nsIAtom.h"
|
||||
|
||||
class nsMsgStatusFeedback : public nsIMsgStatusFeedback,
|
||||
public nsIProgressEventSink,
|
||||
|
@ -77,6 +78,7 @@ protected:
|
|||
nsCOMPtr<nsIMsgStatusFeedback> mStatusFeedback;
|
||||
|
||||
nsCOMPtr<nsIStringBundle> mBundle;
|
||||
static nsIAtom* kMsgLoadedAtom;
|
||||
};
|
||||
|
||||
#endif // _nsMsgStatusFeedback_h
|
||||
|
|
|
@ -1628,3 +1628,12 @@ NS_IMETHODIMP nsImapUrl::SetShouldStoreMsgOffline(PRBool aShouldStoreMsgOffline)
|
|||
m_shouldStoreMsgOffline = aShouldStoreMsgOffline;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsImapUrl::GetMessageHeader(nsIMsgDBHdr ** aMsgHdr)
|
||||
{
|
||||
nsXPIDLCString uri;
|
||||
nsresult rv = GetUri(getter_Copies(uri));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
return GetMsgDBHdrFromURI(uri.get(), aMsgHdr);
|
||||
}
|
||||
|
||||
|
|
|
@ -417,7 +417,9 @@ PRInt32 nsMailboxProtocol::SetupMessageExtraction()
|
|||
NS_ASSERTION(m_runningUrl, "Not running a url");
|
||||
if (m_runningUrl)
|
||||
{
|
||||
rv = m_runningUrl->GetMessageHeader(getter_AddRefs(msgHdr));
|
||||
nsCOMPtr<nsIMsgMessageUrl> msgUrl = do_QueryInterface(m_runningUrl, &rv);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
rv = msgUrl->GetMessageHeader(getter_AddRefs(msgHdr));
|
||||
if (NS_SUCCEEDED(rv) && msgHdr)
|
||||
{
|
||||
PRUint32 messageSize = 0;
|
||||
|
|
|
@ -55,7 +55,6 @@ public:
|
|||
NS_IMETHOD SetQuery(const nsACString &aQuery);
|
||||
|
||||
// from nsIMailboxUrl:
|
||||
NS_IMETHOD GetMessageHeader(nsIMsgDBHdr ** aMsgHdr);
|
||||
NS_IMETHOD SetMailboxParser(nsIStreamListener * aConsumer);
|
||||
NS_IMETHOD GetMailboxParser(nsIStreamListener ** aConsumer);
|
||||
NS_IMETHOD SetMailboxCopyHandler(nsIStreamListener * aConsumer);
|
||||
|
|
|
@ -322,7 +322,9 @@ NS_IMETHODIMP nsPop3Service::NewURI(const nsACString &aSpec,
|
|||
rv = localFolder->GetFolderScanState(&folderScanState);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
nsCOMPtr <nsIMsgDBHdr> msgHdr;
|
||||
mailboxUrl->GetMessageHeader(getter_AddRefs(msgHdr));
|
||||
nsCOMPtr<nsIMsgMessageUrl> msgUrl = do_QueryInterface(mailboxUrl, &rv);
|
||||
NS_ENSURE_SUCCESS(rv,rv);
|
||||
msgUrl->GetMessageHeader(getter_AddRefs(msgHdr));
|
||||
// we do this to get the account key
|
||||
localFolder->GetUidlFromFolder(&folderScanState, msgHdr);
|
||||
if (!folderScanState.m_accountKey.IsEmpty())
|
||||
|
|
|
@ -51,10 +51,9 @@ interface nsINNTPNewsgroupPost;
|
|||
|
||||
typedef long nsNewsAction;
|
||||
|
||||
[scriptable, uuid(BDD12930-A682-11d2-804C-006008128C4E)]
|
||||
[scriptable, uuid(CAB8B3DF-9F66-4B36-838E-BB59950A2349)]
|
||||
interface nsINntpUrl : nsISupports {
|
||||
attribute nsINNTPNewsgroupPost messageToPost;
|
||||
readonly attribute nsIMsgDBHdr messageHeader;
|
||||
attribute nsNewsAction newsAction;
|
||||
attribute boolean getOldMessages;
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче