зеркало из https://github.com/mozilla/pjs.git
use nsIMsgDBHdr instead of nsIMessage. Part of removing rdf dependency.
This commit is contained in:
Родитель
e310fe10ed
Коммит
432e4e2837
|
@ -22,7 +22,7 @@
|
|||
#include "nsISupports.h"
|
||||
#include "MailNewsTypes.h"
|
||||
|
||||
class nsIMessage;
|
||||
class nsIMsgDBHdr;
|
||||
class nsIDBChangeListener;
|
||||
class nsIEnumerator;
|
||||
class nsThreadMessageHdr; // XXX where's the public interface to this?
|
||||
|
@ -83,25 +83,26 @@ public:
|
|||
|
||||
NS_IMETHOD GetDBFolderInfo(nsIDBFolderInfo **result) = 0;
|
||||
// get a message header for the given key. Caller must release()!
|
||||
NS_IMETHOD GetMsgHdrForKey(nsMsgKey key, nsIMessage **msg) = 0;
|
||||
NS_IMETHOD GetMsgHdrForKey(nsMsgKey key, nsIMsgDBHdr **msg) = 0;
|
||||
// create a new message header from a hdrStruct. Caller must release resulting header,
|
||||
// after adding any extra properties they want.
|
||||
NS_IMETHOD CreateNewHdrAndAddToDB(PRBool *newThread,
|
||||
nsMsgHdrStruct *hdrStruct,
|
||||
nsIMessage **newHdr,
|
||||
nsIMsgDBHdr **newHdr,
|
||||
PRBool notify) = 0;
|
||||
|
||||
// Must call AddNewHdrToDB after creating. The idea is that you create
|
||||
// a new header, fill in its properties, and then call AddNewHdrToDB.
|
||||
// AddNewHdrToDB will send notifications to any listeners.
|
||||
NS_IMETHOD CreateNewHdr(nsMsgKey key, nsIMessage **newHdr) = 0;
|
||||
NS_IMETHOD CreateNewHdr(nsMsgKey key, nsIMsgDBHdr **newHdr) = 0;
|
||||
|
||||
NS_IMETHOD AddNewHdrToDB(nsIMessage *newHdr, PRBool notify) = 0;
|
||||
// extract info from an nsIMessage into a nsMsgHdrStruct
|
||||
NS_IMETHOD GetMsgHdrStructFromnsMsgHdr(nsIMessage *msgHdr,
|
||||
NS_IMETHOD AddNewHdrToDB(nsIMsgDBHdr *newHdr, PRBool notify) = 0;
|
||||
// extract info from an nsIMsgDBHdr into a nsMsgHdrStruct
|
||||
NS_IMETHOD GetMsgHdrStructFromnsMsgHdr(nsIMsgDBHdr *msgHdr,
|
||||
nsMsgHdrStruct *hdrStruct) = 0;
|
||||
|
||||
NS_IMETHOD CopyHdrFromExistingHdr(nsMsgKey key, nsIMessage *existingHdr, nsIMessage **newHdr) = 0;
|
||||
NS_IMETHOD CopyHdrFromExistingHdr(nsMsgKey key, nsIMsgDBHdr *existingHdr, nsIMsgDBHdr **newHdr) = 0;
|
||||
|
||||
#if HAVE_INT_ENUMERATORS
|
||||
NS_IMETHOD EnumerateKeys(nsIEnumerator* *outputKeys) = 0;
|
||||
#else
|
||||
|
@ -112,7 +113,7 @@ public:
|
|||
|
||||
// helpers for user command functions like delete, mark read, etc.
|
||||
|
||||
NS_IMETHOD MarkHdrRead(nsIMessage *msgHdr, PRBool bRead,
|
||||
NS_IMETHOD MarkHdrRead(nsIMsgDBHdr *msgHdr, PRBool bRead,
|
||||
nsIDBChangeListener *instigator) = 0;
|
||||
|
||||
// MDN support
|
||||
|
@ -158,10 +159,10 @@ public:
|
|||
NS_IMETHOD DeleteMessage(nsMsgKey key,
|
||||
nsIDBChangeListener *instigator,
|
||||
PRBool commit) = 0;
|
||||
NS_IMETHOD DeleteHeader(nsIMessage *msgHdr, nsIDBChangeListener *instigator,
|
||||
NS_IMETHOD DeleteHeader(nsIMsgDBHdr *msgHdr, nsIDBChangeListener *instigator,
|
||||
PRBool commit, PRBool notify) = 0;
|
||||
|
||||
NS_IMETHOD UndoDelete(nsIMessage *msgHdr) = 0;
|
||||
NS_IMETHOD UndoDelete(nsIMsgDBHdr *msgHdr) = 0;
|
||||
|
||||
NS_IMETHOD MarkLater(nsMsgKey key, time_t *until) = 0;
|
||||
NS_IMETHOD MarkMarked(nsMsgKey key, PRBool mark,
|
||||
|
@ -191,7 +192,7 @@ public:
|
|||
|
||||
// thread interfaces.
|
||||
NS_IMETHOD GetThreadForMsgKey(nsMsgKey msgKey, nsIMsgThread **result) = 0;
|
||||
NS_IMETHOD GetThreadContainingMsgHdr(nsIMessage *msgHdr, nsIMsgThread **result) = 0;
|
||||
NS_IMETHOD GetThreadContainingMsgHdr(nsIMsgDBHdr *msgHdr, nsIMsgThread **result) = 0;
|
||||
};
|
||||
|
||||
#endif // nsIMsgDatabase_h__
|
||||
|
|
|
@ -33,7 +33,6 @@ public:
|
|||
|
||||
NS_IMETHOD SetSummaryValid(PRBool valid = TRUE);
|
||||
|
||||
nsresult CreateMsgHdr(nsIMdbRow* hdrRow, nsFileSpec& path, nsMsgKey key, nsIMessage* *result, PRBool getKeyFromHeader);
|
||||
protected:
|
||||
// IMAP does not set local file flags, override does nothing
|
||||
virtual void UpdateFolderFlag(nsMsgHdr *msgHdr, PRBool bSet,
|
||||
|
|
|
@ -69,13 +69,12 @@ public:
|
|||
NS_IMETHOD SetSummaryValid(PRBool valid);
|
||||
|
||||
nsresult GetIdsWithNoBodies (nsMsgKeyArray &bodylessIds);
|
||||
virtual nsresult CreateMsgHdr(nsIMdbRow* hdrRow, nsFileSpec& path, nsMsgKey key, nsIMessage **result, PRBool createKeyFromHeader);
|
||||
#ifdef DEBUG // strictly for testing purposes
|
||||
virtual nsresult PrePopulate();
|
||||
#endif
|
||||
protected:
|
||||
virtual PRBool SetHdrFlag(nsIMessage *, PRBool bSet, MsgFlags flag);
|
||||
virtual void UpdateFolderFlag(nsIMessage *msgHdr, PRBool bSet,
|
||||
virtual PRBool SetHdrFlag(nsIMsgDBHdr *, PRBool bSet, MsgFlags flag);
|
||||
virtual void UpdateFolderFlag(nsIMsgDBHdr *msgHdr, PRBool bSet,
|
||||
MsgFlags flag, nsIOFileStream **ppFileStream);
|
||||
virtual void SetReparse(PRBool reparse);
|
||||
|
||||
|
|
|
@ -66,24 +66,23 @@ public:
|
|||
// In 4.x, it was mainly used to remove corrupted databases.
|
||||
NS_IMETHOD ForceClosed(void);
|
||||
// get a message header for the given key. Caller must release()!
|
||||
NS_IMETHOD GetMsgHdrForKey(nsMsgKey key, nsIMessage **msg);
|
||||
NS_IMETHOD GetMsgHdrForKey(nsMsgKey key, nsIMsgDBHdr **msg);
|
||||
// create a new message header from a hdrStruct. Caller must release resulting header,
|
||||
// after adding any extra properties they want.
|
||||
NS_IMETHOD CreateNewHdrAndAddToDB(PRBool *newThread,
|
||||
nsMsgHdrStruct *hdrStruct,
|
||||
nsIMessage **newHdr,
|
||||
nsIMsgDBHdr **newHdr,
|
||||
PRBool notify);
|
||||
// Must call AddNewHdrToDB after creating. The idea is that you create
|
||||
// a new header, fill in its properties, and then call AddNewHdrToDB.
|
||||
// AddNewHdrToDB will send notifications to any listeners.
|
||||
NS_IMETHOD CreateNewHdr(nsMsgKey key, nsIMessage **newHdr);
|
||||
NS_IMETHOD CreateNewHdr(nsMsgKey key, nsIMsgDBHdr **newHdr);
|
||||
virtual nsresult CreateMsgHdr(nsIMdbRow* hdrRow, nsMsgKey key, nsIMsgDBHdr **result);
|
||||
|
||||
virtual nsresult CreateMsgHdr(nsIMdbRow* hdrRow, nsFileSpec& path, nsMsgKey key, nsIMessage **result, PRBool createKeyFromHeader) = 0;
|
||||
|
||||
NS_IMETHOD CopyHdrFromExistingHdr(nsMsgKey key, nsIMessage *existingHdr, nsIMessage **newHdr);
|
||||
NS_IMETHOD AddNewHdrToDB(nsIMessage *newHdr, PRBool notify);
|
||||
// extract info from an nsIMessage into a nsMsgHdrStruct
|
||||
NS_IMETHOD GetMsgHdrStructFromnsMsgHdr(nsIMessage *msgHdr,
|
||||
NS_IMETHOD CopyHdrFromExistingHdr(nsMsgKey key, nsIMsgDBHdr *existingHdr, nsIMsgDBHdr **newHdr);
|
||||
NS_IMETHOD AddNewHdrToDB(nsIMsgDBHdr *newHdr, PRBool notify);
|
||||
// extract info from an nsIMsgDBHdr into a nsMsgHdrStruct
|
||||
NS_IMETHOD GetMsgHdrStructFromnsMsgHdr(nsIMsgDBHdr *msgHdr,
|
||||
nsMsgHdrStruct *hdrStruct);
|
||||
|
||||
#if HAVE_INT_ENUMERATORS
|
||||
|
@ -100,7 +99,7 @@ public:
|
|||
|
||||
// helpers for user command functions like delete, mark read, etc.
|
||||
|
||||
NS_IMETHOD MarkHdrRead(nsIMessage *msgHdr, PRBool bRead,
|
||||
NS_IMETHOD MarkHdrRead(nsIMsgDBHdr *msgHdr, PRBool bRead,
|
||||
nsIDBChangeListener *instigator);
|
||||
|
||||
// MDN support
|
||||
|
@ -146,10 +145,10 @@ public:
|
|||
NS_IMETHOD DeleteMessage(nsMsgKey key,
|
||||
nsIDBChangeListener *instigator,
|
||||
PRBool commit);
|
||||
NS_IMETHOD DeleteHeader(nsIMessage *msgHdr, nsIDBChangeListener *instigator,
|
||||
NS_IMETHOD DeleteHeader(nsIMsgDBHdr *msgHdr, nsIDBChangeListener *instigator,
|
||||
PRBool commit, PRBool notify);
|
||||
|
||||
NS_IMETHOD UndoDelete(nsIMessage *msgHdr);
|
||||
NS_IMETHOD UndoDelete(nsIMsgDBHdr *msgHdr);
|
||||
|
||||
NS_IMETHOD MarkLater(nsMsgKey key, time_t *until);
|
||||
NS_IMETHOD MarkMarked(nsMsgKey key, PRBool mark,
|
||||
|
@ -178,13 +177,13 @@ public:
|
|||
NS_IMETHOD ListAllOfflineDeletes(nsMsgKeyArray *offlineDeletes);
|
||||
|
||||
NS_IMETHOD GetThreadForMsgKey(nsMsgKey msgKey, nsIMsgThread **result);
|
||||
NS_IMETHOD GetThreadContainingMsgHdr(nsIMessage *msgHdr, nsIMsgThread **result) ;
|
||||
NS_IMETHOD GetThreadContainingMsgHdr(nsIMsgDBHdr *msgHdr, nsIMsgThread **result) ;
|
||||
//////////////////////////////////////////////////////////////////////////////
|
||||
// nsMsgDatabase methods:
|
||||
nsMsgDatabase();
|
||||
virtual ~nsMsgDatabase();
|
||||
|
||||
NS_IMETHOD IsHeaderRead(nsIMessage *hdr, PRBool *pRead);
|
||||
NS_IMETHOD IsHeaderRead(nsIMsgDBHdr *hdr, PRBool *pRead);
|
||||
|
||||
static nsIMdbFactory *GetMDBFactory();
|
||||
NS_IMETHOD GetDBFolderInfo(nsIDBFolderInfo **result);
|
||||
|
@ -216,7 +215,7 @@ public:
|
|||
static void DumpCache();
|
||||
virtual nsresult DumpContents();
|
||||
nsresult DumpThread(nsMsgKey threadId);
|
||||
nsresult DumpMsgChildren(nsIMessage *msgHdr);
|
||||
nsresult DumpMsgChildren(nsIMsgDBHdr *msgHdr);
|
||||
#endif
|
||||
|
||||
friend class nsMsgHdr; // use this to get access to cached tokens for hdr fields
|
||||
|
@ -258,10 +257,10 @@ protected:
|
|||
// Flag handling routines
|
||||
virtual nsresult SetKeyFlag(nsMsgKey key, PRBool set, PRInt32 flag,
|
||||
nsIDBChangeListener *instigator = NULL);
|
||||
virtual PRBool SetHdrFlag(nsIMessage *, PRBool bSet, MsgFlags flag);
|
||||
virtual PRUint32 GetStatusFlags(nsIMessage *msgHdr);
|
||||
virtual PRBool SetHdrFlag(nsIMsgDBHdr *, PRBool bSet, MsgFlags flag);
|
||||
virtual PRUint32 GetStatusFlags(nsIMsgDBHdr *msgHdr);
|
||||
// helper function which doesn't involve thread object
|
||||
NS_IMETHOD MarkHdrReadInDB(nsIMessage *msgHdr, PRBool bRead,
|
||||
NS_IMETHOD MarkHdrReadInDB(nsIMsgDBHdr *msgHdr, PRBool bRead,
|
||||
nsIDBChangeListener *instigator);
|
||||
|
||||
virtual nsresult RemoveHeaderFromDB(nsMsgHdr *msgHdr);
|
||||
|
|
|
@ -19,8 +19,7 @@
|
|||
#ifndef _nsMsgHdr_H
|
||||
#define _nsMsgHdr_H
|
||||
|
||||
#include "nsIMessage.h"
|
||||
#include "nsRDFResource.h"
|
||||
#include "nsIMsgHdr.h"
|
||||
#include "nsString2.h"
|
||||
#include "MailNewsTypes.h"
|
||||
#include "xp.h"
|
||||
|
@ -29,12 +28,12 @@
|
|||
class nsMsgDatabase;
|
||||
class nsString2;
|
||||
|
||||
class nsMsgHdr : public nsRDFResource, public nsIMessage {
|
||||
class nsMsgHdr : public nsIMsgDBHdr {
|
||||
public:
|
||||
|
||||
friend class nsMsgDatabase;
|
||||
////////////////////////////////////////////////////////////////////////////
|
||||
// nsIMessage methods:
|
||||
// nsIMsghdr methods:
|
||||
NS_IMETHOD GetProperty(const char *propertyName, nsString &resultProperty);
|
||||
NS_IMETHOD SetProperty(const char *propertyName, nsString &propertyStr);
|
||||
NS_IMETHOD GetUint32Property(const char *propertyName, PRUint32 *pResult);
|
||||
|
@ -88,14 +87,12 @@ public:
|
|||
////////////////////////////////////////////////////////////////////////////
|
||||
// nsMsgHdr methods:
|
||||
nsMsgHdr(nsMsgDatabase *db, nsIMdbRow *dbRow);
|
||||
nsMsgHdr();
|
||||
virtual ~nsMsgHdr();
|
||||
|
||||
void Init();
|
||||
void Init(nsMsgDatabase *db, nsIMdbRow *dbRow);
|
||||
virtual nsresult InitCachedValues();
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_ISUPPORTS
|
||||
|
||||
nsIMdbRow *GetMDBRow() {return m_mdbRow;}
|
||||
protected:
|
||||
|
|
|
@ -25,7 +25,7 @@
|
|||
#include "mdb.h"
|
||||
|
||||
class nsIMdbTable;
|
||||
class nsIMessage;
|
||||
class nsIMsgDBHdr;
|
||||
class nsMsgDatabase;
|
||||
|
||||
class nsMsgThread : public nsIMsgThread {
|
||||
|
@ -42,10 +42,10 @@ public:
|
|||
NS_IMETHOD SetFlags(PRUint32 flags);
|
||||
NS_IMETHOD GetNumChildren(PRUint32 *result);
|
||||
NS_IMETHOD GetNumUnreadChildren (PRUint32 *result);
|
||||
NS_IMETHOD AddChild(nsIMessage *child, PRBool threadInThread);
|
||||
NS_IMETHOD GetChildAt(PRInt32 index, nsIMessage **result);
|
||||
NS_IMETHOD GetChild(nsMsgKey msgKey, nsIMessage **result);
|
||||
NS_IMETHOD GetChildHdrAt(PRInt32 index, nsIMessage **result);
|
||||
NS_IMETHOD AddChild(nsIMsgDBHdr *child, PRBool threadInThread);
|
||||
NS_IMETHOD GetChildAt(PRInt32 index, nsIMsgDBHdr **result);
|
||||
NS_IMETHOD GetChild(nsMsgKey msgKey, nsIMsgDBHdr **result);
|
||||
NS_IMETHOD GetChildHdrAt(PRInt32 index, nsIMsgDBHdr **result);
|
||||
NS_IMETHOD RemoveChildAt(PRInt32 index);
|
||||
NS_IMETHOD RemoveChild(nsMsgKey msgKey);
|
||||
NS_IMETHOD MarkChildRead(PRBool bRead);
|
||||
|
|
|
@ -40,11 +40,10 @@ public:
|
|||
NS_IMETHOD Close(PRBool forceCommit);
|
||||
NS_IMETHOD ForceClosed();
|
||||
NS_IMETHOD Commit(nsMsgDBCommitType commitType);
|
||||
virtual nsresult CreateMsgHdr(nsIMdbRow* hdrRow, nsFileSpec& path, nsMsgKey key, nsIMessage **result, PRBool createKeyFromHeader = PR_FALSE);
|
||||
virtual PRUint32 GetCurVersion();
|
||||
|
||||
// methods to get and set docsets for ids.
|
||||
NS_IMETHOD MarkHdrRead(nsIMessage *msgHdr, PRBool bRead,
|
||||
NS_IMETHOD MarkHdrRead(nsIMsgDBHdr *msgHdr, PRBool bRead,
|
||||
nsIDBChangeListener *instigator = NULL);
|
||||
NS_IMETHOD IsRead(nsMsgKey key, PRBool *pRead);
|
||||
virtual PRBool IsArticleOffline(nsMsgKey key);
|
||||
|
|
|
@ -45,7 +45,6 @@ EXTRA_DSO_LDOPTS = \
|
|||
-lxpcom \
|
||||
-lreg \
|
||||
-lraptorbase \
|
||||
-lrdfutil_s \
|
||||
-lmork \
|
||||
-lmsgbaseutil \
|
||||
$(NULL)
|
||||
|
|
|
@ -52,8 +52,6 @@ EXPORTS= \
|
|||
LINCS=-I$(PUBLIC)\xpcom \
|
||||
-I$(PUBLIC)\mailnews \
|
||||
-I$(PUBLIC)\raptor \
|
||||
-I$(PUBLIC)\rdf \
|
||||
-I$(PUBLIC)\rdfutil \
|
||||
-I$(PUBLIC)\mime \
|
||||
-I$(PUBLIC)\locale \
|
||||
-I$(PUBLIC)\pref \
|
||||
|
|
|
@ -21,9 +21,6 @@
|
|||
#include "nsDBFolderInfo.h"
|
||||
#include "nsLocalFolderSummarySpec.h"
|
||||
|
||||
#include "nsRDFCID.h"
|
||||
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
|
||||
|
||||
nsImapMailDatabase::nsImapMailDatabase()
|
||||
{
|
||||
}
|
||||
|
@ -151,9 +148,9 @@ void nsImapMailDatabase::UpdateFolderFlag(nsMsgHdr * /* msgHdr */, PRBool /* bSe
|
|||
{
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
nsresult
|
||||
nsImapMailDatabase::CreateMsgHdr(nsIMdbRow* hdrRow, nsFileSpec& path, nsMsgKey key, nsIMessage* *result, PRBool getKeyFromHeader)
|
||||
nsImapMailDatabase::CreateMsgHdr(nsIMdbRow* hdrRow, nsMsgKey key, nsIMsgHdr* *result)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
|
@ -185,16 +182,18 @@ nsImapMailDatabase::CreateMsgHdr(nsIMdbRow* hdrRow, nsFileSpec& path, nsMsgKey k
|
|||
rv = rdf->GetResource(msgURI, &res);
|
||||
PR_smprintf_free(msgURI);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
|
||||
nsMsgHdr* msgHdr = (nsMsgHdr*)res;
|
||||
if (res)
|
||||
nsMsgHdr* msgHdr = new nsMsgHdr();
|
||||
if (msgHdr)
|
||||
{
|
||||
msgHdr->Init(this, hdrRow);
|
||||
msgHdr->SetMessageKey(key);
|
||||
}
|
||||
*result = msgHdr;
|
||||
|
||||
nsServiceManager::ReleaseService(kRDFServiceCID, rdf);
|
||||
//nsServiceManager::ReleaseService(kRDFServiceCID, rdf);
|
||||
|
||||
return rv;
|
||||
return NS_OK;
|
||||
}
|
||||
*/
|
|
@ -24,8 +24,6 @@
|
|||
#include "nsLocalFolderSummarySpec.h"
|
||||
#include "nsFileSpec.h"
|
||||
|
||||
#include "nsRDFCID.h"
|
||||
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
|
||||
|
||||
nsMailDatabase::nsMailDatabase()
|
||||
: m_reparse(PR_FALSE), m_folderSpec(nsnull), m_folderStream(nsnull)
|
||||
|
@ -185,7 +183,7 @@ nsresult nsMailDatabase::DeleteMessages(nsMsgKeyArray* nsMsgKeys, nsIDBChangeLis
|
|||
|
||||
|
||||
// Helper routine - lowest level of flag setting
|
||||
PRBool nsMailDatabase::SetHdrFlag(nsIMessage *msgHdr, PRBool bSet, MsgFlags flag)
|
||||
PRBool nsMailDatabase::SetHdrFlag(nsIMsgDBHdr *msgHdr, PRBool bSet, MsgFlags flag)
|
||||
{
|
||||
nsIOFileStream *fileStream = NULL;
|
||||
PRBool ret = PR_FALSE;
|
||||
|
@ -221,7 +219,7 @@ int msg_UnHex(char C)
|
|||
// and we don't want to open and close the file every time through.
|
||||
// As an experiment, try caching the fid in the db as m_folderFile.
|
||||
// If this is set, use it but don't return *pFid.
|
||||
void nsMailDatabase::UpdateFolderFlag(nsIMessage *mailHdr, PRBool bSet,
|
||||
void nsMailDatabase::UpdateFolderFlag(nsIMsgDBHdr *mailHdr, PRBool bSet,
|
||||
MsgFlags flag, nsIOFileStream **ppFileStream)
|
||||
{
|
||||
static char buf[30];
|
||||
|
@ -518,55 +516,10 @@ PRBool nsMailDatabase::ThreadBySubjectWithoutRe()
|
|||
return gThreadWithoutRe;
|
||||
}
|
||||
|
||||
nsresult
|
||||
nsMailDatabase::CreateMsgHdr(nsIMdbRow* hdrRow, nsFileSpec& path, nsMsgKey key, nsIMessage* *result, PRBool getKeyFromHeader)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
nsIRDFService *rdf;
|
||||
rv = nsServiceManager::GetService(kRDFServiceCID,
|
||||
nsIRDFService::GetIID(),
|
||||
(nsISupports**)&rdf);
|
||||
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
char* msgURI;
|
||||
|
||||
//Need to remove ".msf".
|
||||
nsFileSpec folderPath = path;
|
||||
char* leafName = folderPath.GetLeafName();
|
||||
nsString folderName(leafName);
|
||||
PL_strfree(leafName);
|
||||
if(folderName.Find(".msf") != -1)
|
||||
{
|
||||
nsString realFolderName;
|
||||
folderName.Left(realFolderName, folderName.Length() - 4);
|
||||
folderPath.SetLeafName((const nsString)realFolderName);
|
||||
}
|
||||
|
||||
rv = nsBuildLocalMessageURI(folderPath, key, &msgURI);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
|
||||
nsIRDFResource* res;
|
||||
rv = rdf->GetResource(msgURI, &res);
|
||||
PR_smprintf_free(msgURI);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsMsgHdr* msgHdr = (nsMsgHdr*)res;
|
||||
msgHdr->Init(this, hdrRow);
|
||||
msgHdr->SetMessageKey(key);
|
||||
*result = msgHdr;
|
||||
|
||||
nsServiceManager::ReleaseService(kRDFServiceCID, rdf);
|
||||
|
||||
return rv;
|
||||
}
|
||||
|
||||
#ifdef DEBUG // strictly for testing purposes
|
||||
nsresult nsMailDatabase::PrePopulate()
|
||||
{
|
||||
nsIMessage *msg;
|
||||
nsIMsgDBHdr *msg;
|
||||
nsMsgHdr *newHdr = NULL;
|
||||
PRTime resultTime, intermediateResult, microSecondsPerSecond;
|
||||
resultTime = PR_Now();
|
||||
|
|
|
@ -23,9 +23,6 @@
|
|||
#include "nsDBFolderInfo.h"
|
||||
#include "nsNewsSet.h"
|
||||
#include "nsIEnumerator.h"
|
||||
#include "nsIRDFService.h"
|
||||
#include "nsRDFCID.h"
|
||||
#include "nsIRDFResource.h"
|
||||
#include "nsMsgThread.h"
|
||||
#include "nsFileStream.h"
|
||||
#include "nsString2.h"
|
||||
|
@ -50,7 +47,6 @@
|
|||
static NS_DEFINE_IID(kIPrefIID, NS_IPREF_IID);
|
||||
static NS_DEFINE_CID(kPrefCID, NS_PREF_CID);
|
||||
static NS_DEFINE_CID(kCMimeConverterCID, NS_MIME_CONVERTER_CID);
|
||||
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
|
||||
static NS_DEFINE_CID(kLocaleFactoryCID, NS_LOCALEFACTORY_CID);
|
||||
static NS_DEFINE_IID(kILocaleFactoryIID, NS_ILOCALEFACTORY_IID);
|
||||
static NS_DEFINE_CID(kLocaleCID, NS_LOCALE_CID);
|
||||
|
@ -78,21 +74,19 @@ static NS_DEFINE_CID(kIMBBCID, NS_IMBB_IID);
|
|||
|
||||
const int kMsgDBVersion = 1;
|
||||
|
||||
#if 0
|
||||
//Temporary function to create a URI so that nsMsgHdr functions with RDF.
|
||||
//This will get removed.
|
||||
static char* CreateURI(nsFileSpec path, nsMsgKey key)
|
||||
|
||||
nsresult
|
||||
nsMsgDatabase::CreateMsgHdr(nsIMdbRow* hdrRow, nsMsgKey key, nsIMsgDBHdr* *result)
|
||||
{
|
||||
nsString uri = "mailmess://";
|
||||
uri+=path;
|
||||
|
||||
char keyBuffer[50];
|
||||
PR_snprintf(keyBuffer, 50, "%u", key);
|
||||
|
||||
uri+=keyBuffer;
|
||||
return uri.ToNewCString();
|
||||
nsMsgHdr *msgHdr = new nsMsgHdr(this, hdrRow);
|
||||
if(!msgHdr)
|
||||
return NS_ERROR_OUT_OF_MEMORY;
|
||||
msgHdr->SetMessageKey(key);
|
||||
msgHdr->AddRef();
|
||||
*result = msgHdr;
|
||||
|
||||
return NS_OK;
|
||||
}
|
||||
#endif
|
||||
|
||||
NS_IMETHODIMP nsMsgDatabase::AddListener(nsIDBChangeListener *listener)
|
||||
{
|
||||
|
@ -827,7 +821,7 @@ nsresult nsMsgDatabase::InitMDBInfo()
|
|||
}
|
||||
|
||||
// get a message header for the given key. Caller must release()!
|
||||
NS_IMETHODIMP nsMsgDatabase::GetMsgHdrForKey(nsMsgKey key, nsIMessage **pmsgHdr)
|
||||
NS_IMETHODIMP nsMsgDatabase::GetMsgHdrForKey(nsMsgKey key, nsIMsgDBHdr **pmsgHdr)
|
||||
{
|
||||
nsresult err = NS_OK;
|
||||
mdb_bool hasOid;
|
||||
|
@ -862,7 +856,7 @@ NS_IMETHODIMP nsMsgDatabase::GetMsgHdrForKey(nsMsgKey key, nsIMessage **pmsgHdr)
|
|||
err = hdrRow->GetOid(GetEnv(), &rowOid);
|
||||
if (NS_SUCCEEDED(err) && rowOid.mOid_Id == key)
|
||||
{
|
||||
err = CreateMsgHdr(hdrRow, m_dbName, key, pmsgHdr, PR_FALSE);
|
||||
err = CreateMsgHdr(hdrRow, key, pmsgHdr);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -874,7 +868,7 @@ NS_IMETHODIMP nsMsgDatabase::GetMsgHdrForKey(nsMsgKey key, nsIMessage **pmsgHdr)
|
|||
|
||||
if (err == NS_OK && hdrRow)
|
||||
{
|
||||
err = CreateMsgHdr(hdrRow, m_dbName, key, pmsgHdr, PR_FALSE);
|
||||
err = CreateMsgHdr(hdrRow, key, pmsgHdr);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
@ -885,7 +879,7 @@ NS_IMETHODIMP nsMsgDatabase::GetMsgHdrForKey(nsMsgKey key, nsIMessage **pmsgHdr)
|
|||
NS_IMETHODIMP nsMsgDatabase::DeleteMessage(nsMsgKey key, nsIDBChangeListener *instigator, PRBool commit)
|
||||
{
|
||||
nsresult err = NS_OK;
|
||||
nsIMessage *msgHdr = NULL;
|
||||
nsIMsgDBHdr *msgHdr = NULL;
|
||||
|
||||
err = GetMsgHdrForKey(key, &msgHdr);
|
||||
if (msgHdr == NULL)
|
||||
|
@ -902,7 +896,7 @@ NS_IMETHODIMP nsMsgDatabase::DeleteMessages(nsMsgKeyArray* nsMsgKeys, nsIDBChang
|
|||
for (PRUint32 index = 0; index < nsMsgKeys->GetSize(); index++)
|
||||
{
|
||||
nsMsgKey key = nsMsgKeys->ElementAt(index);
|
||||
nsIMessage *msgHdr = NULL;
|
||||
nsIMsgDBHdr *msgHdr = NULL;
|
||||
|
||||
err = GetMsgHdrForKey(key, &msgHdr);
|
||||
if (NS_FAILED(err))
|
||||
|
@ -919,7 +913,7 @@ NS_IMETHODIMP nsMsgDatabase::DeleteMessages(nsMsgKeyArray* nsMsgKeys, nsIDBChang
|
|||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsMsgDatabase::DeleteHeader(nsIMessage *msg, nsIDBChangeListener *instigator, PRBool commit, PRBool notify)
|
||||
NS_IMETHODIMP nsMsgDatabase::DeleteHeader(nsIMsgDBHdr *msg, nsIDBChangeListener *instigator, PRBool commit, PRBool notify)
|
||||
{
|
||||
nsMsgHdr* msgHdr = NS_STATIC_CAST(nsMsgHdr*, msg); // closed system, so this is ok
|
||||
nsMsgKey key;
|
||||
|
@ -961,7 +955,7 @@ NS_IMETHODIMP nsMsgDatabase::DeleteHeader(nsIMessage *msg, nsIDBChangeListener *
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsMsgDatabase::UndoDelete(nsIMessage *msgHdr)
|
||||
nsMsgDatabase::UndoDelete(nsIMsgDBHdr *msgHdr)
|
||||
{
|
||||
return NS_ERROR_NOT_IMPLEMENTED;
|
||||
}
|
||||
|
@ -981,7 +975,7 @@ nsresult nsMsgDatabase::RemoveHeaderFromDB(nsMsgHdr *msgHdr)
|
|||
nsresult nsMsgDatabase::IsRead(nsMsgKey key, PRBool *pRead)
|
||||
{
|
||||
nsresult rv;
|
||||
nsIMessage *msgHdr;
|
||||
nsIMsgDBHdr *msgHdr;
|
||||
|
||||
rv = GetMsgHdrForKey(key, &msgHdr);
|
||||
if (NS_FAILED(rv) || !msgHdr) return NS_MSG_MESSAGE_NOT_FOUND; // XXX return rv?
|
||||
|
@ -990,7 +984,7 @@ nsresult nsMsgDatabase::IsRead(nsMsgKey key, PRBool *pRead)
|
|||
return rv;
|
||||
}
|
||||
|
||||
PRUint32 nsMsgDatabase::GetStatusFlags(nsIMessage *msgHdr)
|
||||
PRUint32 nsMsgDatabase::GetStatusFlags(nsIMsgDBHdr *msgHdr)
|
||||
{
|
||||
PRUint32 statusFlags;
|
||||
(void)msgHdr->GetFlags(&statusFlags);
|
||||
|
@ -1005,7 +999,7 @@ PRUint32 nsMsgDatabase::GetStatusFlags(nsIMessage *msgHdr)
|
|||
return statusFlags;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgDatabase::IsHeaderRead(nsIMessage *hdr, PRBool *pRead)
|
||||
NS_IMETHODIMP nsMsgDatabase::IsHeaderRead(nsIMsgDBHdr *hdr, PRBool *pRead)
|
||||
{
|
||||
if (!hdr)
|
||||
return NS_MSG_MESSAGE_NOT_FOUND;
|
||||
|
@ -1019,7 +1013,7 @@ NS_IMETHODIMP nsMsgDatabase::IsHeaderRead(nsIMessage *hdr, PRBool *pRead)
|
|||
NS_IMETHODIMP nsMsgDatabase::IsMarked(nsMsgKey key, PRBool *pMarked)
|
||||
{
|
||||
nsresult rv;
|
||||
nsIMessage *msgHdr;
|
||||
nsIMsgDBHdr *msgHdr;
|
||||
|
||||
rv = GetMsgHdrForKey(key, &msgHdr);
|
||||
if (NS_FAILED(rv)) return NS_MSG_MESSAGE_NOT_FOUND; // XXX return rv?
|
||||
|
@ -1056,7 +1050,7 @@ nsresult nsMsgDatabase::HasAttachments(nsMsgKey key, PRBool *pHasThem)
|
|||
if (!pHasThem)
|
||||
return NS_ERROR_NULL_POINTER;
|
||||
|
||||
nsIMessage *msgHdr;
|
||||
nsIMsgDBHdr *msgHdr;
|
||||
|
||||
rv = GetMsgHdrForKey(key, &msgHdr);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
@ -1068,7 +1062,7 @@ nsresult nsMsgDatabase::HasAttachments(nsMsgKey key, PRBool *pHasThem)
|
|||
return rv;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgDatabase::MarkHdrReadInDB(nsIMessage *msgHdr, PRBool bRead,
|
||||
NS_IMETHODIMP nsMsgDatabase::MarkHdrReadInDB(nsIMsgDBHdr *msgHdr, PRBool bRead,
|
||||
nsIDBChangeListener *instigator)
|
||||
{
|
||||
nsMsgKey key;
|
||||
|
@ -1093,7 +1087,7 @@ NS_IMETHODIMP nsMsgDatabase::MarkRead(nsMsgKey key, PRBool bRead,
|
|||
nsIDBChangeListener *instigator)
|
||||
{
|
||||
nsresult rv;
|
||||
nsIMessage *msgHdr;
|
||||
nsIMsgDBHdr *msgHdr;
|
||||
|
||||
rv = GetMsgHdrForKey(key, &msgHdr);
|
||||
if (NS_FAILED(rv)) return NS_MSG_MESSAGE_NOT_FOUND; // XXX return rv?
|
||||
|
@ -1168,7 +1162,7 @@ NS_IMETHODIMP nsMsgDatabase::MarkMDNNeeded(nsMsgKey key, PRBool bNeeded,
|
|||
NS_IMETHODIMP nsMsgDatabase::IsMDNNeeded(nsMsgKey key, PRBool *pNeeded)
|
||||
{
|
||||
nsresult rv;
|
||||
nsIMessage *msgHdr;
|
||||
nsIMsgDBHdr *msgHdr;
|
||||
|
||||
rv = GetMsgHdrForKey(key, &msgHdr);
|
||||
if (NS_FAILED(rv)) return NS_MSG_MESSAGE_NOT_FOUND; // XXX return rv?
|
||||
|
@ -1191,7 +1185,7 @@ nsresult nsMsgDatabase::MarkMDNSent(nsMsgKey key, PRBool bSent,
|
|||
nsresult nsMsgDatabase::IsMDNSent(nsMsgKey key, PRBool *pSent)
|
||||
{
|
||||
nsresult rv;
|
||||
nsIMessage *msgHdr;
|
||||
nsIMsgDBHdr *msgHdr;
|
||||
|
||||
rv = GetMsgHdrForKey(key, &msgHdr);
|
||||
if (NS_FAILED(rv)) return NS_MSG_MESSAGE_NOT_FOUND; // XXX return rv?
|
||||
|
@ -1208,7 +1202,7 @@ nsresult nsMsgDatabase::SetKeyFlag(nsMsgKey key, PRBool set, PRInt32 flag,
|
|||
nsIDBChangeListener *instigator)
|
||||
{
|
||||
nsresult rv;
|
||||
nsIMessage *msgHdr;
|
||||
nsIMsgDBHdr *msgHdr;
|
||||
|
||||
rv = GetMsgHdrForKey(key, &msgHdr);
|
||||
if (NS_FAILED(rv)) return NS_MSG_MESSAGE_NOT_FOUND; // XXX return rv?
|
||||
|
@ -1225,7 +1219,7 @@ nsresult nsMsgDatabase::SetKeyFlag(nsMsgKey key, PRBool set, PRInt32 flag,
|
|||
|
||||
// Helper routine - lowest level of flag setting - returns PR_TRUE if flags change,
|
||||
// PR_FALSE otherwise.
|
||||
PRBool nsMsgDatabase::SetHdrFlag(nsIMessage *msgHdr, PRBool bSet, MsgFlags flag)
|
||||
PRBool nsMsgDatabase::SetHdrFlag(nsIMsgDBHdr *msgHdr, PRBool bSet, MsgFlags flag)
|
||||
{
|
||||
// PR_ASSERT(! (flag & kDirty)); // this won't do the right thing so don't.
|
||||
PRUint32 currentStatusFlags = GetStatusFlags(msgHdr);
|
||||
|
@ -1248,7 +1242,7 @@ PRBool nsMsgDatabase::SetHdrFlag(nsIMessage *msgHdr, PRBool bSet, MsgFlags flag)
|
|||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsMsgDatabase::MarkHdrRead(nsIMessage *msgHdr, PRBool bRead,
|
||||
NS_IMETHODIMP nsMsgDatabase::MarkHdrRead(nsIMsgDBHdr *msgHdr, PRBool bRead,
|
||||
nsIDBChangeListener *instigator)
|
||||
{
|
||||
nsresult rv = NS_OK;
|
||||
|
@ -1375,7 +1369,7 @@ NS_IMETHODIMP nsMsgDatabase::ClearNewList(PRBool notify /* = FALSE */)
|
|||
while ((firstMember = m_newSet->GetFirstMember()) != 0)
|
||||
{
|
||||
m_newSet->Remove(firstMember); // this bites, since this will cause us to regen new list many times.
|
||||
nsIMessage *msgHdr;
|
||||
nsIMsgDBHdr *msgHdr;
|
||||
err = GetMsgHdrForKey(firstMember, &msgHdr);
|
||||
if (NS_SUCCEEDED(err))
|
||||
{
|
||||
|
@ -1478,7 +1472,7 @@ nsresult nsMsgDatabase::ListNext(ListContext *pContext, nsMsgHdr **pResultHdr)
|
|||
if (hdrRow->GetOid(GetEnv(), &outOid) == NS_OK)
|
||||
key = outOid.mOid_Id;
|
||||
|
||||
err = CreateMsgHdr(hdrRow, m_dbName, key, pResultHdr, PR_TRUE);
|
||||
err = CreateMsgHdr(hdrRow, key, pResultHdr);
|
||||
return err;
|
||||
}
|
||||
|
||||
|
@ -1502,7 +1496,7 @@ public:
|
|||
NS_IMETHOD IsDone(void);
|
||||
|
||||
// nsMsgDBEnumerator methods:
|
||||
typedef nsresult (*nsMsgDBEnumeratorFilter)(nsIMessage* hdr, void* closure);
|
||||
typedef nsresult (*nsMsgDBEnumeratorFilter)(nsIMsgDBHdr* hdr, void* closure);
|
||||
|
||||
nsMsgDBEnumerator(nsMsgDatabase* db,
|
||||
nsMsgDBEnumeratorFilter filter, void* closure);
|
||||
|
@ -1511,7 +1505,7 @@ public:
|
|||
protected:
|
||||
nsMsgDatabase* mDB;
|
||||
nsIMdbTableRowCursor* mRowCursor;
|
||||
nsIMessage* mResultHdr;
|
||||
nsIMsgDBHdr* mResultHdr;
|
||||
PRBool mDone;
|
||||
nsMsgDBEnumeratorFilter mFilter;
|
||||
void* mClosure;
|
||||
|
@ -1557,7 +1551,7 @@ NS_IMETHODIMP nsMsgDBEnumerator::Next(void)
|
|||
rv = mRowCursor->NextRow(mDB->GetEnv(), &hdrRow, &rowPos);
|
||||
if (!hdrRow) {
|
||||
mDone = PR_TRUE;
|
||||
return NS_RDF_CURSOR_EMPTY;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
if (NS_FAILED(rv)) {
|
||||
mDone = PR_TRUE;
|
||||
|
@ -1569,7 +1563,7 @@ NS_IMETHODIMP nsMsgDBEnumerator::Next(void)
|
|||
if (hdrRow->GetOid(mDB->GetEnv(), &outOid) == NS_OK)
|
||||
key = outOid.mOid_Id;
|
||||
|
||||
rv = mDB->CreateMsgHdr(hdrRow, mDB->m_dbName, key, &mResultHdr, PR_TRUE);
|
||||
rv = mDB->CreateMsgHdr(hdrRow, key, &mResultHdr);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
} while (mFilter && mFilter(mResultHdr, mClosure) != NS_OK);
|
||||
return rv;
|
||||
|
@ -1724,7 +1718,7 @@ NS_IMETHODIMP nsMsgDBThreadEnumerator::Next(void)
|
|||
if (!table)
|
||||
{
|
||||
mDone = PR_TRUE;
|
||||
return NS_RDF_CURSOR_EMPTY;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
if (NS_FAILED(rv))
|
||||
{
|
||||
|
@ -1807,7 +1801,7 @@ nsresult nsMsgDatabase::ListNextUnread(ListContext **pContext, nsMsgHdr **pResul
|
|||
}
|
||||
#else
|
||||
static nsresult
|
||||
nsMsgUnreadFilter(nsIMessage* msg, void* closure)
|
||||
nsMsgUnreadFilter(nsIMsgDBHdr* msg, void* closure)
|
||||
{
|
||||
nsMsgDatabase* db = (nsMsgDatabase*)closure;
|
||||
PRBool wasRead;
|
||||
|
@ -1828,7 +1822,7 @@ nsMsgDatabase::EnumerateUnreadMessages(nsIEnumerator* *result)
|
|||
}
|
||||
#endif
|
||||
|
||||
NS_IMETHODIMP nsMsgDatabase::CreateNewHdr(nsMsgKey key, nsIMessage **pnewHdr)
|
||||
NS_IMETHODIMP nsMsgDatabase::CreateNewHdr(nsMsgKey key, nsIMsgDBHdr **pnewHdr)
|
||||
{
|
||||
nsresult err = NS_OK;
|
||||
nsIMdbRow *hdrRow;
|
||||
|
@ -1843,11 +1837,11 @@ NS_IMETHODIMP nsMsgDatabase::CreateNewHdr(nsMsgKey key, nsIMessage **pnewHdr)
|
|||
err = GetStore()->NewRowWithOid(GetEnv(),
|
||||
&allMsgHdrsTableOID, &hdrRow);
|
||||
if (NS_FAILED(err)) return err;
|
||||
err = CreateMsgHdr(hdrRow, m_dbName, key, pnewHdr, PR_FALSE);
|
||||
err = CreateMsgHdr(hdrRow, key, pnewHdr);
|
||||
return err;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgDatabase::AddNewHdrToDB(nsIMessage *newHdr, PRBool notify)
|
||||
NS_IMETHODIMP nsMsgDatabase::AddNewHdrToDB(nsIMsgDBHdr *newHdr, PRBool notify)
|
||||
{
|
||||
nsMsgHdr* hdr = NS_STATIC_CAST(nsMsgHdr*, newHdr); // closed system, cast ok
|
||||
nsresult err = m_mdbAllMsgHeadersTable->AddRow(GetEnv(), hdr->GetMDBRow());
|
||||
|
@ -1883,7 +1877,7 @@ NS_IMETHODIMP nsMsgDatabase::AddNewHdrToDB(nsIMessage *newHdr, PRBool notify)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgDatabase::CreateNewHdrAndAddToDB(PRBool *newThread, nsMsgHdrStruct *hdrStruct,
|
||||
nsIMessage **pnewHdr, PRBool notify /* = FALSE */)
|
||||
nsIMsgDBHdr **pnewHdr, PRBool notify /* = FALSE */)
|
||||
{
|
||||
nsresult err = NS_OK;
|
||||
nsIMdbRow *hdrRow;
|
||||
|
@ -1936,14 +1930,14 @@ NS_IMETHODIMP nsMsgDatabase::CreateNewHdrAndAddToDB(PRBool *newThread, nsMsgHdrS
|
|||
}
|
||||
if (NS_FAILED(err)) return err;
|
||||
|
||||
err = CreateMsgHdr(hdrRow, m_dbName, hdrStruct->m_messageKey, pnewHdr, PR_FALSE);
|
||||
err = CreateMsgHdr(hdrRow, hdrStruct->m_messageKey, pnewHdr);
|
||||
if (NS_SUCCEEDED(err))
|
||||
err = AddNewHdrToDB(*pnewHdr, notify);
|
||||
return err;
|
||||
}
|
||||
|
||||
// extract info from an nsMsgHdr into a MessageHdrStruct
|
||||
NS_IMETHODIMP nsMsgDatabase::GetMsgHdrStructFromnsMsgHdr(nsIMessage *msg, nsMsgHdrStruct *hdrStruct)
|
||||
NS_IMETHODIMP nsMsgDatabase::GetMsgHdrStructFromnsMsgHdr(nsIMsgDBHdr *msg, nsMsgHdrStruct *hdrStruct)
|
||||
{
|
||||
nsresult err = NS_OK;
|
||||
nsMsgHdr* msgHdr = NS_STATIC_CAST(nsMsgHdr*, msg); // closed system, cast ok
|
||||
|
@ -1968,7 +1962,7 @@ NS_IMETHODIMP nsMsgDatabase::GetMsgHdrStructFromnsMsgHdr(nsIMessage *msg, nsMsgH
|
|||
return err;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgDatabase::CopyHdrFromExistingHdr(nsMsgKey key, nsIMessage *existingHdr, nsIMessage **newHdr)
|
||||
NS_IMETHODIMP nsMsgDatabase::CopyHdrFromExistingHdr(nsMsgKey key, nsIMsgDBHdr *existingHdr, nsIMsgDBHdr **newHdr)
|
||||
{
|
||||
nsresult err = NS_OK;
|
||||
|
||||
|
@ -2346,7 +2340,7 @@ nsMsgHdr * nsMsgDatabase::GetMsgHdrForReference(nsString2 &reference)
|
|||
nsMsgHdr * nsMsgDatabase::GetMsgHdrForMessageID(nsString2 &msgID)
|
||||
{
|
||||
nsIEnumerator* hdrs;
|
||||
nsIMessage *pHeader = nsnull;
|
||||
nsIMsgDBHdr *pHeader = nsnull;
|
||||
|
||||
nsresult rv = EnumerateMessages(&hdrs);
|
||||
if (NS_FAILED(rv))
|
||||
|
@ -2370,7 +2364,7 @@ nsMsgHdr * nsMsgDatabase::GetMsgHdrForMessageID(nsString2 &msgID)
|
|||
return msgHdr;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP nsMsgDatabase::GetThreadContainingMsgHdr(nsIMessage *msgHdr, nsIMsgThread **result)
|
||||
NS_IMETHODIMP nsMsgDatabase::GetThreadContainingMsgHdr(nsIMsgDBHdr *msgHdr, nsIMsgThread **result)
|
||||
{
|
||||
nsresult ret = NS_OK;
|
||||
if (!result)
|
||||
|
@ -2394,7 +2388,7 @@ NS_IMETHODIMP nsMsgDatabase::GetThreadForMsgKey(nsMsgKey msgKey, nsIMsgThread **
|
|||
|
||||
*result = nsnull;
|
||||
|
||||
nsIMessage *msg = NULL;
|
||||
nsIMsgDBHdr *msg = NULL;
|
||||
ret = GetMsgHdrForKey(msgKey, &msg);
|
||||
|
||||
if (NS_SUCCEEDED(ret) && msg)
|
||||
|
@ -2558,7 +2552,7 @@ nsresult nsMsgDatabase::DumpContents()
|
|||
for (i = 0; i < keys.GetSize(); i++) {
|
||||
key = keys[i];
|
||||
#endif
|
||||
nsIMessage *msg = NULL;
|
||||
nsIMsgDBHdr *msg = NULL;
|
||||
rv = GetMsgHdrForKey(key, &msg);
|
||||
nsMsgHdr* msgHdr = NS_STATIC_CAST(nsMsgHdr*, msg); // closed system, cast ok
|
||||
if (NS_SUCCEEDED(rv))
|
||||
|
@ -2591,7 +2585,7 @@ nsresult nsMsgDatabase::DumpContents()
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
nsresult nsMsgDatabase::DumpMsgChildren(nsIMessage *msgHdr)
|
||||
nsresult nsMsgDatabase::DumpMsgChildren(nsIMsgDBHdr *msgHdr)
|
||||
{
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -2611,7 +2605,7 @@ nsresult nsMsgDatabase::DumpThread(nsMsgKey threadId)
|
|||
{
|
||||
for (enumerator->First(); enumerator->IsDone() != NS_OK; enumerator->Next())
|
||||
{
|
||||
nsIMessage *pMessage = nsnull;
|
||||
nsIMsgDBHdr *pMessage = nsnull;
|
||||
ret = enumerator->CurrentItem((nsISupports**)&pMessage);
|
||||
NS_ASSERTION(NS_SUCCEEDED(ret), "nsMsgDBEnumerator broken");
|
||||
if (NS_FAILED(ret))
|
||||
|
|
|
@ -26,10 +26,9 @@
|
|||
// that multiply inherits from nsISupports
|
||||
static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID);
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED(nsMsgHdr, nsRDFResource, nsIMessage)
|
||||
NS_IMPL_ISUPPORTS(nsMsgHdr, nsIMsgDBHdr::GetIID())
|
||||
|
||||
nsMsgHdr::nsMsgHdr(nsMsgDatabase *db, nsIMdbRow *dbRow)
|
||||
: nsRDFResource()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
m_mdb = db;
|
||||
|
@ -37,6 +36,7 @@ nsMsgHdr::nsMsgHdr(nsMsgDatabase *db, nsIMdbRow *dbRow)
|
|||
m_mdb->AddRef();
|
||||
Init();
|
||||
m_mdbRow = dbRow;
|
||||
InitCachedValues();
|
||||
}
|
||||
|
||||
|
||||
|
@ -52,24 +52,6 @@ void nsMsgHdr::Init()
|
|||
m_mdbRow = NULL;
|
||||
m_numReferences = 0;
|
||||
m_threadId = nsMsgKey_None;
|
||||
|
||||
}
|
||||
|
||||
//The next two functions are temporary changes until we remove RDF from nsMsgHdr
|
||||
nsMsgHdr::nsMsgHdr()
|
||||
: nsRDFResource()
|
||||
{
|
||||
NS_INIT_REFCNT();
|
||||
Init();
|
||||
}
|
||||
|
||||
void nsMsgHdr::Init(nsMsgDatabase *db, nsIMdbRow *dbRow)
|
||||
{
|
||||
m_mdb = db;
|
||||
if(m_mdb)
|
||||
m_mdb->AddRef();
|
||||
m_mdbRow = dbRow;
|
||||
InitCachedValues();
|
||||
}
|
||||
|
||||
nsresult nsMsgHdr::InitCachedValues()
|
||||
|
|
|
@ -155,7 +155,7 @@ NS_IMETHODIMP nsMsgThread::GetNumUnreadChildren (PRUint32 *result)
|
|||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsMsgThread::AddChild(nsIMessage *child, PRBool threadInThread)
|
||||
NS_IMETHODIMP nsMsgThread::AddChild(nsIMsgDBHdr *child, PRBool threadInThread)
|
||||
{
|
||||
nsresult ret = NS_OK;
|
||||
nsMsgHdr* hdr = NS_STATIC_CAST(nsMsgHdr*, child); // closed system, cast ok
|
||||
|
@ -171,7 +171,7 @@ NS_IMETHODIMP nsMsgThread::AddChild(nsIMessage *child, PRBool threadInThread)
|
|||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsMsgThread::GetChildAt(PRInt32 index, nsIMessage **result)
|
||||
NS_IMETHODIMP nsMsgThread::GetChildAt(PRInt32 index, nsIMsgDBHdr **result)
|
||||
{
|
||||
nsresult ret = NS_OK;
|
||||
|
||||
|
@ -179,7 +179,7 @@ NS_IMETHODIMP nsMsgThread::GetChildAt(PRInt32 index, nsIMessage **result)
|
|||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsMsgThread::GetChild(nsMsgKey msgKey, nsIMessage **result)
|
||||
NS_IMETHODIMP nsMsgThread::GetChild(nsMsgKey msgKey, nsIMsgDBHdr **result)
|
||||
{
|
||||
nsresult ret = NS_OK;
|
||||
|
||||
|
@ -187,7 +187,7 @@ NS_IMETHODIMP nsMsgThread::GetChild(nsMsgKey msgKey, nsIMessage **result)
|
|||
}
|
||||
|
||||
|
||||
NS_IMETHODIMP nsMsgThread::GetChildHdrAt(PRInt32 index, nsIMessage **result)
|
||||
NS_IMETHODIMP nsMsgThread::GetChildHdrAt(PRInt32 index, nsIMsgDBHdr **result)
|
||||
{
|
||||
nsresult ret = NS_OK;
|
||||
nsIMdbRow* resultRow;
|
||||
|
@ -216,7 +216,7 @@ NS_IMETHODIMP nsMsgThread::GetChildHdrAt(PRInt32 index, nsIMessage **result)
|
|||
if (resultRow->GetOid(m_mdbDB->GetEnv(), &outOid) == NS_OK)
|
||||
key = outOid.mOid_Id;
|
||||
|
||||
ret = m_mdbDB->CreateMsgHdr(resultRow, m_mdbDB->m_dbName, key, result, PR_TRUE);
|
||||
ret = m_mdbDB->CreateMsgHdr(resultRow, key, result);
|
||||
if (NS_FAILED(ret))
|
||||
return ret;
|
||||
return ret;
|
||||
|
@ -257,7 +257,7 @@ public:
|
|||
NS_IMETHOD IsDone(void);
|
||||
|
||||
// nsMsgThreadEnumerator methods:
|
||||
typedef nsresult (*nsMsgThreadEnumeratorFilter)(nsIMessage* hdr, void* closure);
|
||||
typedef nsresult (*nsMsgThreadEnumeratorFilter)(nsIMsgDBHdr* hdr, void* closure);
|
||||
|
||||
nsMsgThreadEnumerator(nsMsgThread *thread, nsMsgKey startKey,
|
||||
nsMsgThreadEnumeratorFilter filter, void* closure);
|
||||
|
@ -265,7 +265,7 @@ public:
|
|||
|
||||
protected:
|
||||
nsIMdbTableRowCursor* mRowCursor;
|
||||
nsIMessage* mResultHdr;
|
||||
nsIMsgDBHdr* mResultHdr;
|
||||
nsMsgThread* mThread;
|
||||
nsMsgKey mCurKey;
|
||||
PRInt32 mChildIndex;
|
||||
|
@ -337,7 +337,7 @@ NS_IMETHODIMP nsMsgThreadEnumerator::Next(void)
|
|||
if (!mResultHdr)
|
||||
{
|
||||
mDone = PR_TRUE;
|
||||
return NS_RDF_CURSOR_EMPTY;
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
if (NS_FAILED(rv))
|
||||
{
|
||||
|
|
|
@ -20,8 +20,6 @@
|
|||
#include "nsNewsDatabase.h"
|
||||
#include "nsNewsSummarySpec.h"
|
||||
|
||||
#include "nsRDFCID.h"
|
||||
static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID);
|
||||
|
||||
nsNewsDatabase::nsNewsDatabase()
|
||||
{
|
||||
|
@ -105,7 +103,7 @@ PRUint32 nsNewsDatabase::GetCurVersion()
|
|||
}
|
||||
|
||||
// methods to get and set docsets for ids.
|
||||
NS_IMETHODIMP nsNewsDatabase::MarkHdrRead(nsIMessage *msgHdr, PRBool bRead,
|
||||
NS_IMETHODIMP nsNewsDatabase::MarkHdrRead(nsIMsgDBHdr *msgHdr, PRBool bRead,
|
||||
nsIDBChangeListener *instigator)
|
||||
{
|
||||
nsresult err = NS_OK;
|
||||
|
@ -246,12 +244,11 @@ nsNewsDatabase::ThreadBySubjectWithoutRe()
|
|||
return PR_TRUE;
|
||||
}
|
||||
|
||||
/*
|
||||
nsresult
|
||||
nsNewsDatabase::CreateMsgHdr(nsIMdbRow* hdrRow, nsFileSpec& path, nsMsgKey key, nsIMessage* *result,
|
||||
PRBool getKeyFromHeader)
|
||||
nsNewsDatabase::CreateMsgHdr(nsIMdbRow* hdrRow, nsMsgKey key, nsIMsgDBHdr* *result)
|
||||
{
|
||||
nsresult rv;
|
||||
|
||||
#ifdef DEBUG
|
||||
printf("nsNewsDatabase::CreateMsgHdr()\n");
|
||||
#endif
|
||||
|
@ -286,11 +283,14 @@ nsNewsDatabase::CreateMsgHdr(nsIMdbRow* hdrRow, nsFileSpec& path, nsMsgKey key,
|
|||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
nsMsgHdr* msgHdr = (nsMsgHdr*)res;
|
||||
|
||||
nsMsgHdr* msgHdr = new nsMsgHdr();
|
||||
msgHdr->Init(this, hdrRow);
|
||||
msgHdr->SetMessageKey(key);
|
||||
*result = msgHdr;
|
||||
|
||||
nsServiceManager::ReleaseService(kRDFServiceCID, rdf);
|
||||
// nsServiceManager::ReleaseService(kRDFServiceCID, rdf);
|
||||
|
||||
return rv;
|
||||
return NS_OK;
|
||||
}
|
||||
*/
|
||||
|
|
Загрузка…
Ссылка в новой задаче