зеркало из https://github.com/mozilla/pjs.git
add accessor to get msg db hdr for a mailbox url.
This commit is contained in:
Родитель
2d6f16c2da
Коммит
8a469a559a
|
@ -48,6 +48,8 @@ typedef enum {
|
|||
nsMailboxActionMoveMessage
|
||||
} nsMailboxAction;
|
||||
|
||||
class nsIMsgDBHdr;
|
||||
|
||||
class nsIMailboxUrl : public nsIMsgMailNewsUrl
|
||||
{
|
||||
public:
|
||||
|
@ -84,7 +86,10 @@ public:
|
|||
// Getters and Setters for the mailbox url state
|
||||
///////////////////////////////////////////////////////////////////////////////
|
||||
NS_IMETHOD GetFilePath(const nsFileSpec ** aFilePath) = 0;
|
||||
// NS_IMETHOD SetFilePath(const nsFileSpec& aFilePath) = 0;
|
||||
|
||||
// if the mailbox url represents a single message, than this interface will
|
||||
// return a message db header for that message.
|
||||
NS_IMETHOD GetMessageHeader(nsIMsgDBHdr ** aMsgHdr) = 0;
|
||||
|
||||
// Some mailbox urls include a message key for the message in question.
|
||||
NS_IMETHOD GetMessageKey(nsMsgKey& aMessageID) = 0;
|
||||
|
|
|
@ -32,12 +32,16 @@
|
|||
#include "nsEscape.h"
|
||||
#include "nsCRT.h"
|
||||
#include "nsLocalUtils.h"
|
||||
#include "nsIMsgDatabase.h"
|
||||
#include "nsMsgDBCID.h"
|
||||
#include "nsIMsgHdr.h"
|
||||
|
||||
// we need this because of an egcs 1.0 (and possibly gcc) compiler bug
|
||||
// that doesn't allow you to call ::nsISupports::GetIID() inside of a class
|
||||
// that multiply inherits from nsISupports
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
static NS_DEFINE_CID(kUrlListenerManagerCID, NS_URLLISTENERMANAGER_CID);
|
||||
static NS_DEFINE_CID(kCMailDB, NS_MAILDB_CID);
|
||||
|
||||
// this is totally lame and MUST be removed by M6
|
||||
// the real fix is to attach the URI to the URL as it runs through netlib
|
||||
|
@ -358,8 +362,7 @@ nsresult nsMailboxUrl::SetUrlState(PRBool aRunningUrl, nsresult aExitCode)
|
|||
}
|
||||
|
||||
// from nsIMsgUriUrl
|
||||
NS_IMETHODIMP
|
||||
nsMailboxUrl::GetURI(char ** aURI)
|
||||
NS_IMETHODIMP nsMailboxUrl::GetURI(char ** aURI)
|
||||
{
|
||||
// function not implemented yet....
|
||||
// when I get scott's function to take a path and a message id and turn it into
|
||||
|
@ -386,6 +389,27 @@ nsMailboxUrl::GetURI(char ** aURI)
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMailboxUrl::GetMessageHeader(nsIMsgDBHdr ** aMsgHdr)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
if (aMsgHdr)
|
||||
{
|
||||
nsCOMPtr<nsIMsgDatabase> mailDBFactory;
|
||||
nsCOMPtr<nsIMsgDatabase> mailDB;
|
||||
|
||||
rv = nsComponentManager::CreateInstance(kCMailDB, nsnull, nsIMsgDatabase::GetIID(),
|
||||
(void **) getter_AddRefs(mailDBFactory));
|
||||
if (NS_SUCCEEDED(rv) && mailDBFactory)
|
||||
rv = mailDBFactory->Open((nsFileSpec&) *m_filePath, PR_FALSE, (nsIMsgDatabase **) getter_AddRefs(mailDB), PR_FALSE);
|
||||
if (NS_SUCCEEDED(rv) && mailDB) // did we get a db back?
|
||||
rv = mailDB->GetMsgHdrForKey(m_messageKey, aMsgHdr);
|
||||
}
|
||||
else
|
||||
rv = NS_ERROR_NULL_POINTER;
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
// End nsIMailboxUrl specific support
|
||||
////////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -65,6 +65,7 @@ public:
|
|||
NS_IMETHOD SetURLInfo(URL_Struct_ *URL_s);
|
||||
|
||||
// from nsIMailboxUrl:
|
||||
NS_IMETHOD GetMessageHeader(nsIMsgDBHdr ** aMsgHdr);
|
||||
NS_IMETHOD SetMailboxParser(nsIStreamListener * aConsumer);
|
||||
NS_IMETHOD GetMailboxParser(nsIStreamListener ** aConsumer);
|
||||
NS_IMETHOD SetMailboxCopyHandler(nsIStreamListener * aConsumer);
|
||||
|
|
Загрузка…
Ссылка в новой задаче