From 29c731c68edfc6192f5b0b12784886b26ab28d09 Mon Sep 17 00:00:00 2001 From: "sspitzer%netscape.com" Date: Tue, 8 Jan 2002 01:40:01 +0000 Subject: [PATCH] fix for performance bug #117864. implement SetQuery() on these derived classes and make it so SetQuery() will reparse the url. we need this because we call SetQuery() after calling SetSpec() when quoting. reparsing the url will set some internal state that we use for the optimization of only quoting the body part of message, instead of the whole message (attachments and all!) r/sr=bienvenu --- mailnews/imap/src/nsImapUrl.cpp | 16 ++++++++++++---- mailnews/imap/src/nsImapUrl.h | 15 ++++++++------- mailnews/local/src/nsMailboxUrl.cpp | 16 ++++++++++++---- mailnews/local/src/nsMailboxUrl.h | 1 + 4 files changed, 33 insertions(+), 15 deletions(-) diff --git a/mailnews/imap/src/nsImapUrl.cpp b/mailnews/imap/src/nsImapUrl.cpp index 64ea3f0431b8..cdd71efb8738 100644 --- a/mailnews/imap/src/nsImapUrl.cpp +++ b/mailnews/imap/src/nsImapUrl.cpp @@ -318,10 +318,18 @@ NS_IMETHODIMP nsImapUrl::SetImapMiscellaneousSink(nsIImapMiscellaneousSink * NS_IMETHODIMP nsImapUrl::SetSpec(const char * aSpec) { - nsresult rv = nsMsgMailNewsUrl::SetSpec(aSpec); - if (NS_SUCCEEDED(rv)) - rv = ParseUrl(); - return rv; + nsresult rv = nsMsgMailNewsUrl::SetSpec(aSpec); + if (NS_SUCCEEDED(rv)) + rv = ParseUrl(); + return rv; +} + +NS_IMETHODIMP nsImapUrl::SetQuery(const char *aQuery) +{ + nsresult rv = nsMsgMailNewsUrl::SetQuery(aQuery); + if (NS_SUCCEEDED(rv)) + rv = ParseUrl(); + return rv; } nsresult nsImapUrl::ParseUrl() diff --git a/mailnews/imap/src/nsImapUrl.h b/mailnews/imap/src/nsImapUrl.h index fa0c36e163bd..3a2f8a452ed6 100644 --- a/mailnews/imap/src/nsImapUrl.h +++ b/mailnews/imap/src/nsImapUrl.h @@ -57,18 +57,19 @@ class nsImapUrl : public nsIImapUrl, public nsMsgMailNewsUrl, public nsIMsgMessa { public: - NS_DECL_ISUPPORTS_INHERITED + NS_DECL_ISUPPORTS_INHERITED - // nsIURI override - NS_IMETHOD SetSpec(const char * aSpec); + // nsIURI override + NS_IMETHOD SetSpec(const char * aSpec); + NS_IMETHOD SetQuery(const char * aQuery); - /////////////////////////////////////////////////////////////////////////////// - // we support the nsIImapUrl interface - /////////////////////////////////////////////////////////////////////////////// + ////////////////////////////////////////////////////////////////////////////// + // we support the nsIImapUrl interface + ////////////////////////////////////////////////////////////////////////////// NS_DECL_NSIIMAPURL // nsIMsgMailNewsUrl overrides - NS_IMETHOD IsUrlType(PRUint32 type, PRBool *isType); + NS_IMETHOD IsUrlType(PRUint32 type, PRBool *isType); NS_IMETHOD SetMsgWindow(nsIMsgWindow *aMsgWindow); // nsIMsgMessageUrl diff --git a/mailnews/local/src/nsMailboxUrl.cpp b/mailnews/local/src/nsMailboxUrl.cpp index 163076a518e0..4fda648fd25b 100644 --- a/mailnews/local/src/nsMailboxUrl.cpp +++ b/mailnews/local/src/nsMailboxUrl.cpp @@ -419,10 +419,18 @@ nsresult nsMailboxUrl::ParseUrl() NS_IMETHODIMP nsMailboxUrl::SetSpec(const char * aSpec) { - nsresult rv = nsMsgMailNewsUrl::SetSpec(aSpec); - if (NS_SUCCEEDED(rv)) - rv = ParseUrl(); - return rv; + nsresult rv = nsMsgMailNewsUrl::SetSpec(aSpec); + if (NS_SUCCEEDED(rv)) + rv = ParseUrl(); + return rv; +} + +NS_IMETHODIMP nsMailboxUrl::SetQuery(const char *aQuery) +{ + nsresult rv = nsMsgMailNewsUrl::SetQuery(aQuery); + if (NS_SUCCEEDED(rv)) + rv = ParseUrl(); + return rv; } // takes a string like ?messageID=fooo&number=MsgKey and returns a new string diff --git a/mailnews/local/src/nsMailboxUrl.h b/mailnews/local/src/nsMailboxUrl.h index 3234697d673e..9c31b013c331 100644 --- a/mailnews/local/src/nsMailboxUrl.h +++ b/mailnews/local/src/nsMailboxUrl.h @@ -51,6 +51,7 @@ class nsMailboxUrl : public nsIMailboxUrl, public nsMsgMailNewsUrl, public nsIMs public: // nsIURI over-ride... NS_IMETHOD SetSpec(const char * aSpec); + NS_IMETHOD SetQuery(const char * aQuery); // from nsIMailboxUrl: NS_IMETHOD GetMessageHeader(nsIMsgDBHdr ** aMsgHdr);