diff --git a/mailnews/base/build/nsMsgFactory.cpp b/mailnews/base/build/nsMsgFactory.cpp index 5433207d9f5..2b25168b280 100644 --- a/mailnews/base/build/nsMsgFactory.cpp +++ b/mailnews/base/build/nsMsgFactory.cpp @@ -27,12 +27,8 @@ #include "nsIMsgRFC822Parser.h" #include "nsMsgRFC822Parser.h" - -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); -static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID); -static NS_DEFINE_IID(kCMsgRFC822ParserCID, NS_MSGRFC822PARSER_CID); -static NS_DEFINE_IID(kCMsgFolderEventCID, NS_MSGFOLDEREVENT_CID); - +static NS_DEFINE_CID(kCMsgRFC822ParserCID, NS_MSGRFC822PARSER_CID); +static NS_DEFINE_CID(kCMsgFolderEventCID, NS_MSGFOLDEREVENT_CID); //////////////////////////////////////////////////////////// // @@ -79,9 +75,9 @@ nsresult nsMsgFactory::QueryInterface(const nsIID &aIID, void **aResult) *aResult = NULL; // we support two interfaces....nsISupports and nsFactory..... - if (aIID.Equals(kISupportsIID)) + if (aIID.Equals(::nsISupports::IID())) *aResult = (void *)(nsISupports*)this; - else if (aIID.Equals(kIFactoryIID)) + else if (aIID.Equals(nsIFactory::IID())) *aResult = (void *)(nsIFactory*)this; if (*aResult == NULL) @@ -160,7 +156,7 @@ extern "C" NS_EXPORT nsresult NSGetFactory(const nsCID &aClass, *aFactory = new nsMsgFactory(aClass); if (aFactory) - return (*aFactory)->QueryInterface(kIFactoryIID, (void**)aFactory); // they want a Factory Interface so give it to them + return (*aFactory)->QueryInterface(nsIFactory::IID(), (void**)aFactory); // they want a Factory Interface so give it to them else return NS_ERROR_OUT_OF_MEMORY; } diff --git a/mailnews/base/public/Makefile.in b/mailnews/base/public/Makefile.in index a2e43c37d4c..5364e81003f 100644 --- a/mailnews/base/public/Makefile.in +++ b/mailnews/base/public/Makefile.in @@ -26,7 +26,6 @@ IDLSRCS = \ nsIMsgHost.idl \ nsIMsgGroupRecord.idl \ nsIMsgFolder.idl \ - nsIMsg.idl \ $(NULL) EXPORTS = \ @@ -40,7 +39,6 @@ EXPORTS = \ nsIMsgGroupRecord.h \ nsIMsgFolder.h \ nsIMsgRDFFolder.h \ - nsIMsg.h \ $(NULL) include $(topsrcdir)/config/config.mk diff --git a/mailnews/base/public/makefile.win b/mailnews/base/public/makefile.win index 424b1001285..3df963518a3 100644 --- a/mailnews/base/public/makefile.win +++ b/mailnews/base/public/makefile.win @@ -23,7 +23,6 @@ IDLSRCS = \ nsIMsgHost.idl \ nsIMsgGroupRecord.idl \ nsIMsgFolder.idl \ - nsIMsg.idl \ $(NULL) EXPORTS = \ @@ -37,7 +36,6 @@ EXPORTS = \ nsIMsgGroupRecord.h \ nsIMsgFolder.h \ nsIMsgRDFFolder.h \ - nsIMsg.h \ $(NULL) MODULE=mailnews diff --git a/mailnews/base/public/nsIMsg.h b/mailnews/base/public/nsIMsg.h deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/mailnews/base/public/nsIMsg.idl b/mailnews/base/public/nsIMsg.idl deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/mailnews/base/public/nsIMsgFolder.h b/mailnews/base/public/nsIMsgFolder.h index 9dae657f71b..3d6a14192e7 100644 --- a/mailnews/base/public/nsIMsgFolder.h +++ b/mailnews/base/public/nsIMsgFolder.h @@ -6,7 +6,8 @@ #define __gen_nsIMsgFolder_h__ #include "nsISupportsArray.h" /* interface nsISupportsArray */ -#include "nsIMsg.h" + +class nsIMessage; /* starting interface nsIMsgFolder */ @@ -72,16 +73,16 @@ class nsIMsgFolder : public nsISupports { NS_IMETHOD GetNumMessagesToDisplay(PRUint32 *_retval) = 0; /* */ - NS_IMETHOD GetMessage(PRUint32 which, nsIMsg **_retval) = 0; + NS_IMETHOD GetMessage(PRUint32 which, nsIMessage **_retval) = 0; /* */ NS_IMETHOD GetMessages(nsISupportsArray **_retval) = 0; /* */ - NS_IMETHOD AddMessage(const nsIMsg *msg) = 0; + NS_IMETHOD AddMessage(const nsIMessage *msg) = 0; /* */ - NS_IMETHOD RemoveMessage(const nsIMsg *msg) = 0; + NS_IMETHOD RemoveMessage(const nsIMessage *msg) = 0; /* */ NS_IMETHOD GetDeleteIsMoveToTrash(PRBool *aDeleteIsMoveToTrash) = 0; diff --git a/mailnews/base/public/nsMsgHeaderMasks.h b/mailnews/base/public/nsMsgHeaderMasks.h index b1299ca569c..8bf95e5ecb4 100644 --- a/mailnews/base/public/nsMsgHeaderMasks.h +++ b/mailnews/base/public/nsMsgHeaderMasks.h @@ -40,7 +40,7 @@ #define MSG_OTHERRANDOMHEADERS_HEADER_MASK 0x00001000 #define MSG_NEWSPOSTURL_HEADER_MASK 0x00002000 -#define MSG_PRIORITY_HEADER_MASK 0x00004000 +#define nsMsgPriority_HEADER_MASK 0x00004000 #define MSG_NEWS_FCC_HEADER_MASK 0x00008000 #define MSG_MESSAGE_ENCODING_HEADER_MASK 0x00010000 #define MSG_CHARACTER_SET_HEADER_MASK 0x00020000 diff --git a/mailnews/base/src/Makefile.in b/mailnews/base/src/Makefile.in index bde1d4f15b4..26e9319d9c7 100644 --- a/mailnews/base/src/Makefile.in +++ b/mailnews/base/src/Makefile.in @@ -41,7 +41,6 @@ CPPSRCS = \ nsMsgLocalMailFolder.cpp \ nsMsgImapMailFolder.cpp \ nsNewsSet.cpp \ - nsMsg.cpp \ nsLocalFolderSummarySpec.cpp \ $(NULL) diff --git a/mailnews/base/src/makefile.win b/mailnews/base/src/makefile.win index 2e33e82662e..f0607dc250c 100644 --- a/mailnews/base/src/makefile.win +++ b/mailnews/base/src/makefile.win @@ -38,7 +38,6 @@ CPPSRCS= \ nsLocalFolderSummarySpec.cpp \ nsMsgLineBuffer.cpp \ nsNewsSet.cpp \ - nsMsg.cpp \ $(NULL) CPP_OBJS= \ @@ -53,7 +52,6 @@ CPP_OBJS= \ .\$(OBJDIR)\nsMsgRDFFolder.obj \ .\$(OBJDIR)\nsNewsSet.obj \ .\$(OBJDIR)\nsMsgLineBuffer.obj \ - .\$(OBJDIR)\nsMsg.obj \ $(NULL) diff --git a/mailnews/base/src/nsMsg.cpp b/mailnews/base/src/nsMsg.cpp deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/mailnews/base/src/nsMsg.h b/mailnews/base/src/nsMsg.h deleted file mode 100644 index e69de29bb2d..00000000000 diff --git a/mailnews/base/src/nsMsgFolder.cpp b/mailnews/base/src/nsMsgFolder.cpp index df6f68146f4..6e551ee0537 100644 --- a/mailnews/base/src/nsMsgFolder.cpp +++ b/mailnews/base/src/nsMsgFolder.cpp @@ -26,9 +26,6 @@ #ifdef HAVE_DB #include "nsMsgDatabase.h" #endif -/* use these macros to define a class IID for our component. */ -static NS_DEFINE_IID(kIMsgFolderIID, NS_IMSGFOLDER_IID); -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); nsMsgFolder::nsMsgFolder(const char* uri) : nsRDFResource(PL_strdup(uri)) @@ -54,7 +51,7 @@ nsMsgFolder::nsMsgFolder(const char* uri) mCsid = 0; #ifdef HAVE_DB - mLastMessageLoaded = MSG_MESSAGEKEYNONE; + mLastMessageLoaded = nsMsgKey_None; mNumPendingUnreadMessages = 0; mNumPendingTotalMessages = 0; #endif @@ -91,8 +88,8 @@ nsMsgFolder::QueryInterface(REFNSIID iid, void** result) return NS_ERROR_NULL_POINTER; *result = nsnull; - if(iid.Equals(kIMsgFolderIID) || - iid.Equals(kISupportsIID)) { + if(iid.Equals(nsIMsgFolder::IID()) || + iid.Equals(::nsISupports::IID())) { *result = NS_STATIC_CAST(nsIMsgFolder*, this); AddRef(); return NS_OK; @@ -113,7 +110,7 @@ NS_IMETHODIMP nsMsgFolder::BuildFolderURL(char **url) #ifdef HAVE_DB // this class doesn't have a url -NS_IMETHODIMP nsMsgFolder::BuildUrl(nsMsgDatabase *db, MessageKey key, char ** url) +NS_IMETHODIMP nsMsgFolder::BuildUrl(nsMsgDatabase *db, nsMsgKey key, char ** url) { if(*url) { @@ -143,7 +140,7 @@ nsMsgFolder::StartAsyncCopyMessagesInto(MSG_FolderInfo *dstFolder, MWContext *currentContext, MSG_UrlQueue *urlQueue, PRBool deleteAfterCopy, - MessageKey nextKey = MSG_MESSAGEKEYNONE) + nsMsgKey nextKey = nsMsgKey_None) { // General note: If either the source or destination folder is an IMAP folder then we add the copy info struct // to the end of the current context's chain of copy info structs then fire off an IMAP URL. @@ -422,7 +419,7 @@ NS_IMETHODIMP nsMsgFolder::GetSubFolder(PRUint32 which, nsIMsgFolder **aFolder) nsISupports *folder = mSubFolders->ElementAt(which); if(folder) { - folder->QueryInterface(kIMsgFolderIID, (void**)aFolder); + folder->QueryInterface(nsIMsgFolder::IID(), (void**)aFolder); NS_RELEASE(folder); } @@ -450,7 +447,7 @@ NS_IMETHODIMP nsMsgFolder::AddSubFolder(const nsIMsgFolder *folder) { nsISupports * supports; - if(NS_SUCCEEDED(((nsISupports*)folder)->QueryInterface(kISupportsIID, (void**)&supports))) + if(NS_SUCCEEDED(((nsISupports*)folder)->QueryInterface(::nsISupports::IID(), (void**)&supports))) { mSubFolders->AppendElement(supports); NS_RELEASE(supports); @@ -472,7 +469,7 @@ NS_IMETHODIMP nsMsgFolder::RemoveSubFolder (const nsIMsgFolder *which) { nsISupports * supports; - if(NS_SUCCEEDED(((nsISupports*)which)->QueryInterface(kISupportsIID, (void**)&supports))) + if(NS_SUCCEEDED(((nsISupports*)which)->QueryInterface(::nsISupports::IID(), (void**)&supports))) { mSubFolders->RemoveElement(supports, 0); //make sure it's really been removed and no others exist. @@ -578,7 +575,7 @@ NS_IMETHODIMP nsMsgFolder::PropagateDelete (nsIMsgFolder **folder, PRBool delete nsISupports *supports = mSubFolders->ElementAt(i); if(supports) { - if(NS_SUCCEEDED(status = supports->QueryInterface(kIMsgFolderIID, (void**)&child))) + if(NS_SUCCEEDED(status = supports->QueryInterface(nsIMsgFolder::IID(), (void**)&child))) { if (*folder == child) { @@ -631,7 +628,7 @@ NS_IMETHODIMP nsMsgFolder::RecursiveDelete (PRBool deleteStorage) nsISupports *supports = mSubFolders->ElementAt(0); nsIMsgFolder *child = nsnull; - if(NS_SUCCEEDED(status = supports->QueryInterface(kIMsgFolderIID, (void**)&child))) + if(NS_SUCCEEDED(status = supports->QueryInterface(nsIMsgFolder::IID(), (void**)&child))) { status = child->RecursiveDelete(deleteStorage); // recur @@ -712,7 +709,7 @@ NS_IMETHODIMP nsMsgFolder::FindParentOf (const nsIMsgFolder * aFolder, nsIMsgFol { nsISupports *supports = mSubFolders->ElementAt(i); nsIMsgFolder *child = nsnull; - if(NS_SUCCEEDED(supports->QueryInterface(kIMsgFolderIID, (void**)&child))) + if(NS_SUCCEEDED(supports->QueryInterface(nsIMsgFolder::IID(), (void**)&child))) { if (aFolder == child) { @@ -730,7 +727,7 @@ NS_IMETHODIMP nsMsgFolder::FindParentOf (const nsIMsgFolder * aFolder, nsIMsgFol nsISupports *supports = mSubFolders->ElementAt(j); nsIMsgFolder *child = nsnull; - if(NS_SUCCEEDED(supports->QueryInterface(kIMsgFolderIID, (void**)&child))) + if(NS_SUCCEEDED(supports->QueryInterface(nsIMsgFolder::IID(), (void**)&child))) { child->FindParentOf(aFolder, aParent); NS_RELEASE(child); @@ -754,7 +751,7 @@ NS_IMETHODIMP nsMsgFolder::IsParentOf (const nsIMsgFolder *child, PRBool deep, P { nsISupports *supports = mSubFolders->ElementAt(i); nsIMsgFolder *folder; - if(NS_SUCCEEDED(supports->QueryInterface(kIMsgFolderIID, (void**)&folder))) + if(NS_SUCCEEDED(supports->QueryInterface(nsIMsgFolder::IID(), (void**)&folder))) { if (folder == child ) *isParent = PR_TRUE; @@ -854,7 +851,7 @@ NS_IMETHODIMP nsMsgFolder::GetNumUnread(PRBool deep, PRUint32 *numUnread) { nsISupports *supports = mSubFolders->ElementAt(i); - if(NS_SUCCEEDED(supports->QueryInterface(kIMsgFolderIID, (void**)&folder))) + if(NS_SUCCEEDED(supports->QueryInterface(nsIMsgFolder::IID(), (void**)&folder))) { if (folder) { @@ -888,7 +885,7 @@ NS_IMETHODIMP nsMsgFolder::GetTotalMessages(PRBool deep, PRUint32 *totalMessages { nsISupports *supports = mSubFolders->ElementAt(i); - if(NS_SUCCEEDED(supports->QueryInterface(kIMsgFolderIID, (void**)&folder))) + if(NS_SUCCEEDED(supports->QueryInterface(nsIMsgFolder::IID(), (void**)&folder))) { if (folder) { @@ -947,7 +944,7 @@ NS_IMETHODIMP nsMsgFolder::GetFolderCSID(PRInt16 *csid) } -NS_IMETHODIMP nsMsgFolder::SetLastMessageLoaded(MessageKey lastMessageLoaded) +NS_IMETHODIMP nsMsgFolder::SetLastMessageLoaded(nsMsgKey lastMessageLoaded) { } @@ -1035,7 +1032,7 @@ NS_IMETHODIMP nsMsgFolder::GetFoldersWithFlag(PRUint32 flags, nsIMsgFolder **res nsIMsgFolder *folder = nsnull; for (PRUint32 i=0; i < (PRUint32)mSubFolders->Count(); i++) { nsISupports *supports = mSubFolders->ElementAt(i); - if(NS_SUCCEEDED(supports->QueryInterface(kIMsgFolderIID, (void**)&folder))) + if(NS_SUCCEEDED(supports->QueryInterface(nsIMsgFolder::IID(), (void**)&folder))) { // CAREFUL! if NULL ise passed in for result then the caller // still wants the full count! Otherwise, the result should be at most the @@ -1077,7 +1074,7 @@ NS_IMETHODIMP nsMsgFolder::GetExpansionArray(const nsISupportsArray *expansionAr nsISupports *supports = mSubFolders->ElementAt(i); nsIMsgFolder *folder = nsnull; - if(NS_SUCCEEDED(supports->QueryInterface(kIMsgFolderIID, (void**)&folder))) + if(NS_SUCCEEDED(supports->QueryInterface(nsIMsgFolder::IID(), (void**)&folder))) { ((nsISupportsArray*)expansionArray)->InsertElementAt(folder, expansionArray->Count()); PRUint32 flags; @@ -1374,7 +1371,7 @@ nsMsgFolder::GetNumMessagesToDisplay(PRUint32 *_retval) } NS_IMETHODIMP -nsMsgFolder::GetMessage(PRUint32 which, nsIMsg **_retval) +nsMsgFolder::GetMessage(PRUint32 which, nsIMessage **_retval) { return NS_OK; } @@ -1386,13 +1383,13 @@ nsMsgFolder::GetMessages(nsISupportsArray **_retval) } NS_IMETHODIMP -nsMsgFolder::AddMessage(const nsIMsg *msg) +nsMsgFolder::AddMessage(const nsIMessage *msg) { return NS_OK; } NS_IMETHODIMP -nsMsgFolder::RemoveMessage(const nsIMsg *msg) +nsMsgFolder::RemoveMessage(const nsIMessage *msg) { return NS_OK; } diff --git a/mailnews/base/src/nsMsgFolder.h b/mailnews/base/src/nsMsgFolder.h index dbd0d8ab9a7..254b3000dc7 100644 --- a/mailnews/base/src/nsMsgFolder.h +++ b/mailnews/base/src/nsMsgFolder.h @@ -47,7 +47,7 @@ public: // If the db is NULL, then returns a URL that represents the entire // folder as a whole. #ifdef HAVE_DB - NS_IMETHOD BuildUrl(nsMsgDatabase *db, MessageKey key, char ** url); + NS_IMETHOD BuildUrl(nsMsgDatabase *db, nsMsgKey key, char ** url); #endif #ifdef HAVE_MASTER @@ -63,7 +63,7 @@ public: MWContext *currentContext, MSG_UrlQueue *urlQueue, PRBool deleteAfterCopy, - MessageKey nextKey = MSG_MESSAGEKEYNONE); + nsMsgKey nextKey = nsMsgKey_None); NS_IMETHOD BeginCopyingMessages(MSG_FolderInfo *dstFolder, @@ -117,10 +117,10 @@ public: NS_IMETHOD HasMessages(PRBool *_retval); NS_IMETHOD GetNumMessages(PRUint32 *_retval); NS_IMETHOD GetNumMessagesToDisplay(PRUint32 *_retval); - NS_IMETHOD GetMessage(PRUint32 which, nsIMsg **_retval); + NS_IMETHOD GetMessage(PRUint32 which, nsIMessage **_retval); NS_IMETHOD GetMessages(nsISupportsArray **_retval); - NS_IMETHOD AddMessage(const nsIMsg *msg); - NS_IMETHOD RemoveMessage(const nsIMsg *msg); + NS_IMETHOD AddMessage(const nsIMessage *msg); + NS_IMETHOD RemoveMessage(const nsIMessage *msg); #ifdef HAVE_ADMINURL NS_IMETHOD GetAdminUrl(MWContext *context, MSG_AdminURLType type); @@ -186,7 +186,7 @@ public: NS_IMETHOD GetFolderCSID(PRInt16 *csid); - NS_IMETHOD SetLastMessageLoaded(MessageKey lastMessageLoaded); + NS_IMETHOD SetLastMessageLoaded(nsMsgKey lastMessageLoaded); NS_IMETHOD GetLastMessageLoaded(); #endif @@ -289,7 +289,7 @@ protected: #endif #ifdef HAVE_DB - MessageKey m_lastMessageLoaded; + nsMsgKey m_lastMessageLoaded; // These values are used for tricking the front end into thinking that we have more // messages than are really in the DB. This is usually after and IMAP message copy where // we don't want to do an expensive select until the user actually opens that folder diff --git a/mailnews/base/src/nsMsgImapMailFolder.cpp b/mailnews/base/src/nsMsgImapMailFolder.cpp index e2d42f25721..3e182f5f543 100644 --- a/mailnews/base/src/nsMsgImapMailFolder.cpp +++ b/mailnews/base/src/nsMsgImapMailFolder.cpp @@ -22,9 +22,6 @@ #include "nsMsgFolderFlags.h" #include "prprf.h" -static NS_DEFINE_IID(kIMsgImapMailFolderIID, NS_IMSGIMAPMAILFOLDER_IID); -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); - nsMsgImapMailFolder::nsMsgImapMailFolder(const char* uri) :nsMsgFolder(uri) { @@ -46,8 +43,8 @@ nsMsgImapMailFolder::QueryInterface(REFNSIID iid, void** result) return NS_ERROR_NULL_POINTER; *result = nsnull; - if (iid.Equals(kIMsgImapMailFolderIID) || - iid.Equals(kISupportsIID)) + if (iid.Equals(nsIMsgImapMailFolder::IID()) || + iid.Equals(::nsISupports::IID())) { *result = NS_STATIC_CAST(nsIMsgImapMailFolder*, this); AddRef(); @@ -111,7 +108,7 @@ nsMsgImapMailFolder::FindChildNamed(const char *name, nsIMsgFolder ** aChild) supports = mSubFolders->ElementAt(i); if (folder) NS_RELEASE(folder); - if (NS_SUCCEEDED(supports->QueryInterface(kISupportsIID, (void**)&folder))) + if (NS_SUCCEEDED(supports->QueryInterface(::nsISupports::IID(), (void**)&folder))) { char *folderName; diff --git a/mailnews/base/src/nsMsgKeyArray.cpp b/mailnews/base/src/nsMsgKeyArray.cpp index d8110d159cb..55509243188 100644 --- a/mailnews/base/src/nsMsgKeyArray.cpp +++ b/mailnews/base/src/nsMsgKeyArray.cpp @@ -23,19 +23,19 @@ #include "nsMsgKeyArray.h" -MSG_ViewIndex nsMsgKeyArray::FindIndex(MessageKey key) +nsMsgViewIndex nsMsgKeyArray::FindIndex(nsMsgKey key) { - for (int i = 0; i < GetSize(); i++) + for (PRUint32 i = 0; i < GetSize(); i++) { - if ((MessageKey)(m_pData[i]) == key) + if ((nsMsgKey)(m_pData[i]) == key) { return i; } } - return MSG_VIEWINDEXNONE; + return nsMsgViewIndex_None; } -void nsMsgKeyArray::SetArray(MessageKey* pData, int numElements, int numAllocated) +void nsMsgKeyArray::SetArray(nsMsgKey* pData, int numElements, int numAllocated) { NS_ASSERTION(pData != NULL, "storage is NULL"); NS_ASSERTION(numElements >= 0, "negative number of elements"); diff --git a/mailnews/base/src/nsMsgKeyArray.h b/mailnews/base/src/nsMsgKeyArray.h index b9513d0510e..268a748aa3b 100644 --- a/mailnews/base/src/nsMsgKeyArray.h +++ b/mailnews/base/src/nsMsgKeyArray.h @@ -22,7 +22,7 @@ #define _nsMsgKeyArray_H_ ///////////////////////////////////////////////////////////////////////////// -// nsMsgKeyArray - Growable Array of MessageKeys's - Can contain up to uint - 1 ids. +// nsMsgKeyArray - Growable Array of nsMsgKeys's - Can contain up to uint - 1 ids. ///////////////////////////////////////////////////////////////////////////// #include "nsUInt32Array.h" #include "MailNewsTypes.h" @@ -33,48 +33,48 @@ class nsMsgKeyArray : public nsUInt32Array public: nsMsgKeyArray() : nsUInt32Array() {} -// Public Operations on the MessageKey array - typesafe overrides +// Public Operations on the nsMsgKey array - typesafe overrides public: - MessageKey operator[](PRUint32 nIndex) const { - return((MessageKey)nsUInt32Array::operator[](nIndex)); + nsMsgKey operator[](PRUint32 nIndex) const { + return((nsMsgKey)nsUInt32Array::operator[](nIndex)); } - MessageKey GetKeyFromIndex(PRUint32 nIndex) { + nsMsgKey GetKeyFromIndex(PRUint32 nIndex) { return(operator[](nIndex)); } - MessageKey GetAt(PRUint32 nIndex) const { + nsMsgKey GetAt(PRUint32 nIndex) const { return(operator[](nIndex)); } - void SetAt(PRUint32 nIndex, MessageKey key) { + void SetAt(PRUint32 nIndex, nsMsgKey key) { nsUInt32Array::SetAt(nIndex, (PRUint32)key); } - void SetAtGrow(PRUint32 nIndex, MessageKey key) { + void SetAtGrow(PRUint32 nIndex, nsMsgKey key) { nsUInt32Array::SetAtGrow(nIndex, (uint32)key); } - void InsertAt(PRUint32 nIndex, MessageKey key, int nCount = 1) { + void InsertAt(PRUint32 nIndex, nsMsgKey key, int nCount = 1) { nsUInt32Array::InsertAt(nIndex, (PRUint32)key, nCount); } void InsertAt(PRUint32 nIndex, const nsMsgKeyArray *idArray) { nsUInt32Array::InsertAt(nIndex, idArray); } - PRUint32 Add(MessageKey id) { + PRUint32 Add(nsMsgKey id) { return(nsUInt32Array::Add((uint32)id)); } - PRUint32 Add(MessageKey *elementPtr, PRUint32 numElements) { + PRUint32 Add(nsMsgKey *elementPtr, PRUint32 numElements) { return nsUInt32Array::Add((PRUint32 *) elementPtr, numElements); } void CopyArray(nsMsgKeyArray *oldA) { nsUInt32Array::CopyArray((nsUInt32Array*) oldA); } void CopyArray(nsMsgKeyArray &oldA) { nsUInt32Array::CopyArray(oldA); } // new operations public: - MSG_ViewIndex FindIndex(MessageKey key); // returns -1 if not found + nsMsgViewIndex FindIndex(nsMsgKey key); // returns -1 if not found // use these next two carefully - MessageKey* GetArray(void) { - return((MessageKey*)m_pData); // only valid until another function + nsMsgKey* GetArray(void) { + return((nsMsgKey*)m_pData); // only valid until another function // called on the array (like // GetBuffer() in CString) } - void SetArray(MessageKey* pData, int numElements, + void SetArray(nsMsgKey* pData, int numElements, int numAllocated); }; /////////////////////////////////////////////////////// diff --git a/mailnews/base/src/nsMsgLocalMailFolder.cpp b/mailnews/base/src/nsMsgLocalMailFolder.cpp index 16bf2bcfa06..c405ef4cb1d 100644 --- a/mailnews/base/src/nsMsgLocalMailFolder.cpp +++ b/mailnews/base/src/nsMsgLocalMailFolder.cpp @@ -22,9 +22,6 @@ #include "nsMsgFolderFlags.h" #include "prprf.h" -static NS_DEFINE_IID(kIMsgLocalMailFolderIID, NS_IMSGLOCALMAILFOLDER_IID); -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); - nsMsgLocalMailFolder::nsMsgLocalMailFolder(const char* uri) :nsMsgFolder(uri) { @@ -46,8 +43,8 @@ nsMsgLocalMailFolder::QueryInterface(REFNSIID iid, void** result) return NS_ERROR_NULL_POINTER; *result = nsnull; - if (iid.Equals(kIMsgLocalMailFolderIID) || - iid.Equals(kISupportsIID)) + if (iid.Equals(nsIMsgLocalMailFolder::IID()) || + iid.Equals(::nsISupports::IID())) { *result = NS_STATIC_CAST(nsIMsgLocalMailFolder*, this); AddRef(); @@ -365,7 +362,7 @@ nsMsgLocalMailFolder::FindChildNamed(const char *name, nsIMsgFolder ** aChild) supports = mSubFolders->ElementAt(i); if(folder) NS_RELEASE(folder); - if(NS_SUCCEEDED(supports->QueryInterface(kISupportsIID, (void**)&folder))) + if(NS_SUCCEEDED(supports->QueryInterface(::nsISupports::IID(), (void**)&folder))) { char *folderName; diff --git a/mailnews/base/src/nsMsgRDFFolder.cpp b/mailnews/base/src/nsMsgRDFFolder.cpp index 7bb8a7452ce..5dea5210bcc 100644 --- a/mailnews/base/src/nsMsgRDFFolder.cpp +++ b/mailnews/base/src/nsMsgRDFFolder.cpp @@ -23,13 +23,6 @@ #include "prmem.h" #include "plstr.h" - -static NS_DEFINE_IID(kIRDFResourceIID, NS_IRDFRESOURCE_IID); -static NS_DEFINE_IID(kIRDFNodeIID, NS_IRDFNODE_IID); -static NS_DEFINE_IID(kIRDFResourceFactoryIID, NS_IRDFRESOURCEFACTORY_IID); -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); -static NS_DEFINE_IID(kIMsgRDFFolderIID, NS_IMSGRDFFOLDER_IID); - nsMsgRDFFolder::nsMsgRDFFolder(const char* uri) { NS_INIT_REFCNT(); @@ -57,10 +50,10 @@ nsMsgRDFFolder::QueryInterface(REFNSIID iid, void** result) return NS_ERROR_NULL_POINTER; *result = nsnull; - if(iid.Equals(kIRDFResourceIID) || - iid.Equals(kIRDFNodeIID) || - iid.Equals(kIMsgRDFFolderIID) || - iid.Equals(kISupportsIID)) { + if(iid.Equals(nsIRDFResource::IID()) || + iid.Equals(nsIRDFNode::IID()) || + iid.Equals(nsIMsgRDFFolder::IID()) || + iid.Equals(::nsISupports::IID())) { *result = NS_STATIC_CAST(nsIMsgRDFFolder*, this); } @@ -77,7 +70,7 @@ NS_IMETHODIMP nsMsgRDFFolder::EqualsNode(nsIRDFNode* node, PRBool* result) const { nsresult rv; nsIRDFResource* resource; - if (NS_SUCCEEDED(node->QueryInterface(kIRDFResourceIID, (void**) &resource))) + if (NS_SUCCEEDED(node->QueryInterface(nsIRDFResource::IID(), (void**) &resource))) { rv = EqualsResource(resource, result); NS_RELEASE(resource); @@ -164,7 +157,7 @@ nsMsgFolderResourceFactoryImpl::~nsMsgFolderResourceFactoryImpl(void) { } -NS_IMPL_ISUPPORTS(nsMsgFolderResourceFactoryImpl, kIRDFResourceFactoryIID); +NS_IMPL_ISUPPORTS(nsMsgFolderResourceFactoryImpl, nsIRDFResourceFactory::IID()); NS_IMETHODIMP nsMsgFolderResourceFactoryImpl::CreateResource(const char* aURI, nsIRDFResource** aResult) @@ -176,7 +169,7 @@ nsMsgFolderResourceFactoryImpl::CreateResource(const char* aURI, nsIRDFResource* if (! folder) return NS_ERROR_OUT_OF_MEMORY; - folder->QueryInterface(kIRDFResourceIID, (void**)aResult); + folder->QueryInterface(nsIRDFResource::IID(), (void**)aResult); return NS_OK; } diff --git a/mailnews/base/src/nsMsgRFC822Parser.cpp b/mailnews/base/src/nsMsgRFC822Parser.cpp index 34513978cd3..7b50fa617b8 100644 --- a/mailnews/base/src/nsMsgRFC822Parser.cpp +++ b/mailnews/base/src/nsMsgRFC822Parser.cpp @@ -23,11 +23,6 @@ #include "nsMsgRFC822Parser.h" #include "libi18n.h" -/* use these macros to define a class IID for our component. Our object currently supports two interfaces - (nsISupports and nsIMsgRFC822Parser) so we want to define constants for these two interfaces */ -static NS_DEFINE_IID(kIMsgRFC822Parser, NS_IMSGRFC822PARSER_IID); -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); - // the following three functions are only here for test purposes.....because I18N stuff is not getting built // yet!!!! @@ -103,7 +98,7 @@ nsMsgRFC822Parser::~nsMsgRFC822Parser() /* the following macros actually implement addref, release and query interface for our component. */ NS_IMPL_ADDREF(nsMsgRFC822Parser) NS_IMPL_RELEASE(nsMsgRFC822Parser) -NS_IMPL_QUERY_INTERFACE(nsMsgRFC822Parser, kIMsgRFC822Parser); /* we need to pass in the interface ID of this interface */ +NS_IMPL_QUERY_INTERFACE(nsMsgRFC822Parser, nsIMsgRFC822Parser::IID()); /* we need to pass in the interface ID of this interface */ nsresult nsMsgRFC822Parser::ParseRFC822Addresses (const char *line, char **names, char **addresses, PRUint32& numAddresses) { @@ -271,7 +266,7 @@ nsresult NS_NewRFC822Parser(nsIMsgRFC822Parser** aInstancePtrResult) { nsMsgRFC822Parser* parser = new nsMsgRFC822Parser(); if (parser) - return parser->QueryInterface(kIMsgRFC822Parser, (void**) aInstancePtrResult); + return parser->QueryInterface(nsIMsgRFC822Parser::IID(), (void**) aInstancePtrResult); else return NS_ERROR_OUT_OF_MEMORY; /* we couldn't allocate the object */ } diff --git a/mailnews/base/tests/test.cpp b/mailnews/base/tests/test.cpp index 3e301a4bfe5..8743f8b9293 100644 --- a/mailnews/base/tests/test.cpp +++ b/mailnews/base/tests/test.cpp @@ -3,7 +3,6 @@ #include "nsMsgBaseCID.h" #include "nsIMsgRFC822Parser.h" -static NS_DEFINE_IID(kIMsgRFC822ParserIID, NS_IMSGRFC822PARSER_IID); static NS_DEFINE_CID(kMsgRFC822ParserCID, NS_MSGRFC822PARSER_CID); /* This is just a testing stub added by mscott. All I'm doing is loading a component, @@ -22,7 +21,7 @@ static NS_DEFINE_CID(kMsgRFC822ParserCID, NS_MSGRFC822PARSER_CID); nsresult res = nsRepository::CreateInstance(kMsgRFC822ParserCID, NULL, - kIMsgRFC822ParserIID, + nsIMsgRFC822Parser::IID(), (void **) &sample); if (res == NS_OK && sample) { diff --git a/mailnews/compose/build/nsMsgCompFactory.cpp b/mailnews/compose/build/nsMsgCompFactory.cpp index 8d8d5664cdf..bd8ff8bf7a9 100644 --- a/mailnews/compose/build/nsMsgCompFactory.cpp +++ b/mailnews/compose/build/nsMsgCompFactory.cpp @@ -25,11 +25,8 @@ #include "nsMsgComposeFact.h" #include "nsMsgCompFieldsFact.h" -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); -static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID); -static NS_DEFINE_IID(kCMsgComposeCID, NS_MSGCOMPOSE_CID); -static NS_DEFINE_IID(kCMsgCompFieldsCID, NS_MSGCOMPFIELDS_CID); - +static NS_DEFINE_CID(kCMsgComposeCID, NS_MSGCOMPOSE_CID); +static NS_DEFINE_CID(kCMsgCompFieldsCID, NS_MSGCOMPFIELDS_CID); //////////////////////////////////////////////////////////// // @@ -74,9 +71,9 @@ nsresult nsMsgFactory::QueryInterface(const nsIID &aIID, void **aResult) *aResult = NULL; // we support two interfaces....nsISupports and nsFactory..... - if (aIID.Equals(kISupportsIID)) + if (aIID.Equals(::nsISupports::IID())) *aResult = (void *)(nsISupports*)this; - else if (aIID.Equals(kIFactoryIID)) + else if (aIID.Equals(nsIFactory::IID())) *aResult = (void *)(nsIFactory*)this; if (*aResult == NULL) @@ -154,7 +151,7 @@ extern "C" NS_EXPORT nsresult NSGetFactory(const nsCID &aClass, *aFactory = new nsMsgFactory(aClass); if (aFactory) - return (*aFactory)->QueryInterface(kIFactoryIID, (void**)aFactory); // they want a Factory Interface so give it to them + return (*aFactory)->QueryInterface(nsIFactory::IID(), (void**)aFactory); // they want a Factory Interface so give it to them else return NS_ERROR_OUT_OF_MEMORY; } diff --git a/mailnews/compose/public/MsgCompGlue.h b/mailnews/compose/public/MsgCompGlue.h index 832bfbc2420..1fe64bfda8a 100644 --- a/mailnews/compose/public/MsgCompGlue.h +++ b/mailnews/compose/public/MsgCompGlue.h @@ -20,7 +20,7 @@ public: class MSG_Master { public: - GetFolderTree(void) {return 0;} + PRInt32 GetFolderTree(void) {return 0;} HJ97882 // msg_HostTable* GetHostTable() {return m_hosttable;} diff --git a/mailnews/compose/public/nsISmtpUrl.h b/mailnews/compose/public/nsISmtpUrl.h index d3e1f0e9bb0..939e1351f97 100644 --- a/mailnews/compose/public/nsISmtpUrl.h +++ b/mailnews/compose/public/nsISmtpUrl.h @@ -51,6 +51,8 @@ class nsISmtpUrl : public nsIURL { public: + static const nsIID& IID() { static nsIID iid = NS_ISMTPURL_IID; return iid; } + /////////////////////////////////////////////////////////////////////////////// // SMTP Parse specific getters --> retrieves portions from the url spec... /////////////////////////////////////////////////////////////////////////////// @@ -112,4 +114,4 @@ public: NS_IMETHOD GetErrorMessage (char ** errorMessage) const = 0; }; -#endif /* nsISmtpUrl_h___ */ \ No newline at end of file +#endif /* nsISmtpUrl_h___ */ diff --git a/mailnews/compose/src/nsMsgCompFields.cpp b/mailnews/compose/src/nsMsgCompFields.cpp index 22915a72abe..b59a9063866 100644 --- a/mailnews/compose/src/nsMsgCompFields.cpp +++ b/mailnews/compose/src/nsMsgCompFields.cpp @@ -32,14 +32,8 @@ #include "msgpane.h" JFD*/ -/* use these macros to define a class IID for our component. Our object currently supports two interfaces - (nsISupports and nsIMsgCompose) so we want to define constants for these two interfaces */ -static NS_DEFINE_IID(kIMsgCompFields, NS_IMSGCOMPFIELDS_IID); -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); -static NS_DEFINE_IID(kIMsgCompFieldsIID, NS_IMSGCOMPFIELDS_IID); - extern "C" { - extern int MK_OUT_OF_MEMORY; + extern int MK_OUT_OF_MEMORY; extern int MK_MSG_INVALID_NEWS_HEADER; extern int MK_MSG_CANT_POST_TO_MULTIPLE_NEWS_HOSTS; } @@ -54,7 +48,7 @@ nsresult NS_NewMsgCompFields(nsIMsgCompFields** aInstancePtrResult) { nsMsgCompFields* pCompFields = new nsMsgCompFields(); if (pCompFields) - return pCompFields->QueryInterface(kIMsgCompFields, (void**) aInstancePtrResult); + return pCompFields->QueryInterface(nsIMsgCompFields::IID(), (void**) aInstancePtrResult); else return NS_ERROR_OUT_OF_MEMORY; /* we couldn't allocate the object */ } @@ -64,7 +58,7 @@ nsresult NS_NewMsgCompFields(nsIMsgCompFields** aInstancePtrResult) /* the following macro actually implement addref, release and query interface for our component. */ -NS_IMPL_ISUPPORTS(nsMsgCompFields, kIMsgCompFieldsIID); +NS_IMPL_ISUPPORTS(nsMsgCompFields, nsIMsgCompFields::IID()); nsMsgCompFields::nsMsgCompFields() { @@ -408,12 +402,12 @@ nsresult nsMsgCompFields::GetDefaultBody(char **_retval) nsresult nsMsgCompFields::SetPriority(const char *value, PRInt32 *_retval) { - return SetHeader(MSG_PRIORITY_HEADER_MASK, value, _retval); + return SetHeader(nsMsgPriority_HEADER_MASK, value, _retval); } nsresult nsMsgCompFields::GetPriority(char **_retval) { - return GetHeader(MSG_PRIORITY_HEADER_MASK, _retval); + return GetHeader(nsMsgPriority_HEADER_MASK, _retval); } nsresult nsMsgCompFields::SetMessageEncoding(const char *value, PRInt32 *_retval) @@ -657,7 +651,7 @@ PRInt16 nsMsgCompFields::DecodeHeader(MSG_HEADER_SET header) case MSG_NEWSPOSTURL_HEADER_MASK: result = 13; break; - case MSG_PRIORITY_HEADER_MASK: + case nsMsgPriority_HEADER_MASK: result = 14; break; case MSG_NEWS_FCC_HEADER_MASK: diff --git a/mailnews/compose/src/nsMsgCompose.cpp b/mailnews/compose/src/nsMsgCompose.cpp index 4669ee11448..dc17bca88d1 100644 --- a/mailnews/compose/src/nsMsgCompose.cpp +++ b/mailnews/compose/src/nsMsgCompose.cpp @@ -20,12 +20,6 @@ #include "nsMsgComposeFact.h" #include "nsMsgCompose.h" -/* use these macros to define a class IID for our component. Our object currently supports two interfaces - (nsISupports and nsIMsgCompose) so we want to define constants for these two interfaces */ -static NS_DEFINE_IID(kIMsgCompose, NS_IMSGCOMPOSE_IID); -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); -static NS_DEFINE_IID(kIMsgComposeIID, NS_IMSGCOMPOSE_IID); - /*JFD #include "msg.h" #include "errcode.h" @@ -139,7 +133,7 @@ nsresult NS_NewMsgCompose(nsIMsgCompose** aInstancePtrResult) { nsMsgCompose* pCompose = new nsMsgCompose(); if (pCompose) - return pCompose->QueryInterface(kIMsgCompose, (void**) aInstancePtrResult); + return pCompose->QueryInterface(nsIMsgCompose::IID(), (void**) aInstancePtrResult); else return NS_ERROR_OUT_OF_MEMORY; /* we couldn't allocate the object */ } @@ -401,7 +395,7 @@ nsMsgCompose::~nsMsgCompose() } /* the following macro actually implement addref, release and query interface for our component. */ -NS_IMPL_ISUPPORTS(nsMsgCompose, kIMsgComposeIID); +NS_IMPL_ISUPPORTS(nsMsgCompose, nsIMsgCompose::IID()); #if 0 //JFD nsMsgCompose::MSG_CompositionPaneCreate(MWContext* context, @@ -684,7 +678,7 @@ nsMsgCompose::CheckForLosingFcc(const char* fcc) MsgERR nsMsgCompose::GetCommandStatus(MSG_CommandType command, - const MSG_ViewIndex* indices, + const nsMsgViewIndex* indices, PRInt32 numindices, PRBool *selectable_pP, MSG_COMMAND_CHECK_STATE *selected_pP, @@ -811,7 +805,7 @@ nsMsgCompose::GetCommandStatus(MSG_CommandType command, MsgERR -nsMsgCompose::DoCommand(MSG_CommandType command, MSG_ViewIndex* indices, +nsMsgCompose::DoCommand(MSG_CommandType command, nsMsgViewIndex* indices, PRInt32 numindices) { MsgERR status = 0; @@ -3402,14 +3396,14 @@ nsMsgCompose::SetPreloadedAttachments ( MWContext *context, } void -nsMsgCompose::SetIMAPMessageUID ( MessageKey key ) +nsMsgCompose::SetIMAPMessageUID ( nsMsgKey key ) { PR_ASSERT (m_deliver_mode == MSG_SaveAsDraft || m_deliver_mode == MSG_SaveAs || m_deliver_mode == MSG_SaveAsTemplate); - PR_ASSERT(key != MSG_MESSAGEKEYNONE); + PR_ASSERT(key != nsMsgKey_None); - if (key == MSG_MESSAGEKEYNONE) + if (key == nsMsgKey_None) return; /*JFD diff --git a/mailnews/compose/src/nsMsgCompose.h b/mailnews/compose/src/nsMsgCompose.h index 412f59b40b2..1657f3df89d 100644 --- a/mailnews/compose/src/nsMsgCompose.h +++ b/mailnews/compose/src/nsMsgCompose.h @@ -90,14 +90,14 @@ public: MSG_CommandType PreviousSaveCommand(); virtual MsgERR GetCommandStatus(MSG_CommandType command, - const MSG_ViewIndex* indices, + const nsMsgViewIndex* indices, PRInt32 numindices, PRBool *selectable_p, MSG_COMMAND_CHECK_STATE *selected_p, const char **display_string, PRBool * plural_p); virtual MsgERR DoCommand(MSG_CommandType command, - MSG_ViewIndex* indices, PRInt32 numindices); + nsMsgViewIndex* indices, PRInt32 numindices); const char* GetDefaultURL(); virtual void SetDefaultURL(const char *defaultUrl = NULL, @@ -164,7 +164,7 @@ public: struct MSG_AttachedFile *attachments, int attachments_count ); - virtual void SetIMAPMessageUID (MessageKey key); + virtual void SetIMAPMessageUID (nsMsgKey key); int RetrieveStandardHeaders(MSG_HeaderEntry ** return_list); int SetHeaderEntries(MSG_HeaderEntry * in_list,int count); diff --git a/mailnews/compose/src/nsSmtpProtocol.cpp b/mailnews/compose/src/nsSmtpProtocol.cpp index 65d1c1a67c9..c7d18f53ed2 100644 --- a/mailnews/compose/src/nsSmtpProtocol.cpp +++ b/mailnews/compose/src/nsSmtpProtocol.cpp @@ -36,10 +36,6 @@ #include "prprf.h" #include "nsEscape.h" -static NS_DEFINE_IID(kISmtpURLIID, NS_ISMTPURL_IID); -static NS_DEFINE_IID(kIStreamListenerIID, NS_ISTREAMLISTENER_IID); -static NS_DEFINE_IID(kIInputStreamIID, NS_IINPUTSTREAM_IID); - /* the output_buffer_size must be larger than the largest possible line * 2000 seems good for news * @@ -60,8 +56,8 @@ char *XP_AppCodeName = "Mozilla"; const char *XP_AppCodeName = "Mozilla"; #endif #define NET_IS_SPACE(x) ((((unsigned int) (x)) > 0x7f) ? 0 : isspace(x)) -typedef PRUint32 MessageKey; -const MessageKey MSG_MESSAGEKEYNONE = 0xffffffff; +typedef PRUint32 nsMsgKey; +const nsMsgKey nsMsgKey_None = 0xffffffff; /* * This function takes an error code and associated error data @@ -206,7 +202,7 @@ esmtp_value_encode(char *addr) /* the following macros actually implement addref, release and query interface for our component. */ NS_IMPL_ADDREF(nsSmtpProtocol) NS_IMPL_RELEASE(nsSmtpProtocol) -NS_IMPL_QUERY_INTERFACE(nsSmtpProtocol, kIStreamListenerIID); /* we need to pass in the interface ID of this interface */ +NS_IMPL_QUERY_INTERFACE(nsSmtpProtocol, nsIStreamListener::IID()); /* we need to pass in the interface ID of this interface */ nsSmtpProtocol::nsSmtpProtocol(nsIURL * aURL, nsITransport * transportLayer) { @@ -249,7 +245,7 @@ void nsSmtpProtocol::Initialize(nsIURL * aURL, nsITransport * transportLayer) if (aURL) { - nsresult rv = aURL->QueryInterface(kISmtpURLIID, (void **)&m_runningURL); + nsresult rv = aURL->QueryInterface(nsISmtpUrl::IID(), (void **)&m_runningURL); if (NS_SUCCEEDED(rv) && m_runningURL) { // okay, now fill in our event sinks...Note that each getter ref counts before @@ -429,7 +425,7 @@ PRInt32 nsSmtpProtocol::SendData(const char * dataBuffer) // notify the consumer that data has arrived // HACK ALERT: this should really be m_runningURL once we have NNTP url support... nsIInputStream *inputStream = NULL; - m_outputStream->QueryInterface(kIInputStreamIID , (void **) &inputStream); + m_outputStream->QueryInterface(nsIInputStream::IID() , (void **) &inputStream); if (inputStream) { m_outputConsumer->OnDataAvailable(m_runningURL, inputStream, writeCount); @@ -1260,7 +1256,7 @@ PRInt32 nsSmtpProtocol::LoadURL(nsIURL * aURL) if (aURL) { - rv = aURL->QueryInterface(kISmtpURLIID, (void **) &smtpUrl); + rv = aURL->QueryInterface(nsISmtpUrl::IID(), (void **) &smtpUrl); if (NS_SUCCEEDED(rv) && smtpUrl) { m_runningURL = smtpUrl; diff --git a/mailnews/compose/src/nsSmtpUrl.cpp b/mailnews/compose/src/nsSmtpUrl.cpp index 74a41ca7356..8da423d15b0 100644 --- a/mailnews/compose/src/nsSmtpUrl.cpp +++ b/mailnews/compose/src/nsSmtpUrl.cpp @@ -34,11 +34,6 @@ #include "nsCRT.h" #include "nsEscape.h" -static NS_DEFINE_IID(kIOutputStreamIID, NS_IOUTPUTSTREAM_IID); -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); -static NS_DEFINE_IID(kISmtpURLIID, NS_ISMTPURL_IID); -static NS_DEFINE_IID(kIURLIID, NS_IURL_IID); - nsSmtpUrl::nsSmtpUrl(nsISupports* aContainer, nsIURLGroup* aGroup) { NS_INIT_REFCNT(); @@ -110,18 +105,17 @@ nsresult nsSmtpUrl::QueryInterface(const nsIID &aIID, void** aInstancePtr) return NS_ERROR_NULL_POINTER; } - static NS_DEFINE_IID(kINetlibURLIID, NS_INETLIBURL_IID); - if (aIID.Equals(kISmtpURLIID) || aIID.Equals(kISupportsIID)) { + if (aIID.Equals(nsISmtpUrl::IID()) || aIID.Equals(::nsISupports::IID())) { *aInstancePtr = (void*) ((nsISmtpUrl*)this); AddRef(); return NS_OK; } - if (aIID.Equals(kIURLIID)) { + if (aIID.Equals(nsIURL::IID())) { *aInstancePtr = (void*) ((nsIURL*)this); AddRef(); return NS_OK; } - if (aIID.Equals(kINetlibURLIID)) { + if (aIID.Equals(nsINetlibURL::IID())) { *aInstancePtr = (void*) ((nsINetlibURL*)this); AddRef(); return NS_OK; @@ -759,7 +753,7 @@ PRBool nsSmtpUrl::Equals(const nsIURL* aURL) const NS_LOCK_INSTANCE(); // are they both Smtp urls?? if yes...for now just compare the pointers until // I figure out if we need to check any of the guts for equality.... - if (((nsIURL*)aURL)->QueryInterface(kISmtpURLIID, (void**)&other) == NS_OK) { + if (((nsIURL*)aURL)->QueryInterface(nsISmtpUrl::IID(), (void**)&other) == NS_OK) { bIsEqual = other == this; // compare the pointers... } else diff --git a/mailnews/compose/tests/compose/test.cpp b/mailnews/compose/tests/compose/test.cpp index bee02270378..98b4ae78bd8 100644 --- a/mailnews/compose/tests/compose/test.cpp +++ b/mailnews/compose/tests/compose/test.cpp @@ -4,10 +4,7 @@ #include "nsIMsgCompose.h" #include "nsIMsgCompFields.h" -static NS_DEFINE_IID(kIMsgComposeIID, NS_IMSGCOMPOSE_IID); static NS_DEFINE_CID(kMsgComposeCID, NS_MSGCOMPOSE_CID); - -static NS_DEFINE_CID(kIMsgCompFieldsIID, NS_IMSGCOMPFIELDS_IID); static NS_DEFINE_CID(kMsgCompFieldsCID, NS_MSGCOMPFIELDS_CID); /* This is just a testing stub added by mscott. All I'm doing is loading a component, @@ -28,9 +25,9 @@ static NS_DEFINE_CID(kMsgCompFieldsCID, NS_MSGCOMPFIELDS_CID); nsRepository::RegisterFactory(kMsgCompFieldsCID, "msgcompose.dll", PR_FALSE, PR_FALSE); res = nsRepository::CreateInstance(kMsgCompFieldsCID, - NULL, - kIMsgCompFieldsIID, - (void **) &pMsgCompFields); + NULL, + nsIMsgCompFields::IID(), + (void **) &pMsgCompFields); if (res == NS_OK && pMsgCompFields) { printf("We succesfully obtained a nsIMsgCompFields interface....\n"); @@ -66,7 +63,7 @@ static NS_DEFINE_CID(kMsgCompFieldsCID, NS_MSGCOMPFIELDS_CID); nsIMsgCompFields * pCopyFields; res = nsRepository::CreateInstance(kMsgCompFieldsCID, NULL, - kIMsgCompFieldsIID, + nsIMsgCompFields::IID(), (void **) &pCopyFields); if (res == NS_OK && pCopyFields) { @@ -116,7 +113,7 @@ static NS_DEFINE_CID(kMsgCompFieldsCID, NS_MSGCOMPFIELDS_CID); res = nsRepository::CreateInstance(kMsgComposeCID, NULL, - kIMsgComposeIID, + nsIMsgCompose::IID(), (void **) &pMsgCompose); if (res == NS_OK && pMsgCompose) { diff --git a/mailnews/compose/tests/smtp/smtpTest.cpp b/mailnews/compose/tests/smtp/smtpTest.cpp index 9480e39cbe1..a6c28ad678e 100644 --- a/mailnews/compose/tests/smtp/smtpTest.cpp +++ b/mailnews/compose/tests/smtp/smtpTest.cpp @@ -60,14 +60,9 @@ ///////////////////////////////////////////////////////////////////////////////// // Define keys for all of the interfaces we are going to require for this test ///////////////////////////////////////////////////////////////////////////////// -static NS_DEFINE_IID(kNetServiceCID, NS_NETSERVICE_CID); -static NS_DEFINE_IID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID); -static NS_DEFINE_IID(kIInputStreamIID, NS_IINPUTSTREAM_IID); -static NS_DEFINE_IID(kIURLIID, NS_IURL_IID); -static NS_DEFINE_IID(kISmtpUrlIID, NS_ISMTPURL_IID); - -static NS_DEFINE_IID(kIEventQueueServiceIID, NS_IEVENTQUEUESERVICE_IID); +static NS_DEFINE_CID(kNetServiceCID, NS_NETSERVICE_CID); +static NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID); ///////////////////////////////////////////////////////////////////////////////// // Define default values to be used to drive the test @@ -106,7 +101,7 @@ nsresult NS_NewSmtpUrl(nsISmtpUrl ** aResult, const nsString urlSpec) if (smtpUrl) { smtpUrl->ParseURL(urlSpec); // load the spec we were given... - rv = smtpUrl->QueryInterface(kISmtpUrlIID, (void **) aResult); + rv = smtpUrl->QueryInterface(nsISmtpUrl::IID(), (void **) aResult); } return rv; @@ -452,7 +447,7 @@ int main() // Create the Event Queue for this thread... nsIEventQueueService *pEventQService = nsnull; result = nsServiceManager::GetService(kEventQueueServiceCID, - kIEventQueueServiceIID, + nsIEventQueueService::IID(), (nsISupports **)&pEventQService); if (NS_SUCCEEDED(result)) { // XXX: What if this fails? diff --git a/mailnews/db/msgdb/public/Makefile.in b/mailnews/db/msgdb/public/Makefile.in index ec24fc10832..d00444f6514 100644 --- a/mailnews/db/msgdb/public/Makefile.in +++ b/mailnews/db/msgdb/public/Makefile.in @@ -30,6 +30,7 @@ EXPORTS= \ nsNewsDatabase.h \ nsDBFolderInfo.h \ nsIDBChangeListener.h \ + nsIMessage.h \ $(NULL) include $(topsrcdir)/config/config.mk diff --git a/mailnews/db/msgdb/public/makefile.win b/mailnews/db/msgdb/public/makefile.win index e44a1f10a63..63038bd96e7 100644 --- a/mailnews/db/msgdb/public/makefile.win +++ b/mailnews/db/msgdb/public/makefile.win @@ -30,6 +30,7 @@ EXPORTS = \ nsDBFolderInfo.h \ nsMsgHdr.h \ nsIDBChangeListener.h \ + nsIMessage.h \ $(NULL) MODULE=mailnews diff --git a/mailnews/db/msgdb/public/nsDBFolderInfo.h b/mailnews/db/msgdb/public/nsDBFolderInfo.h index cae7d173979..913dfe6e0a0 100644 --- a/mailnews/db/msgdb/public/nsDBFolderInfo.h +++ b/mailnews/db/msgdb/public/nsDBFolderInfo.h @@ -48,14 +48,14 @@ public: // create the appropriate table and row in a new db. nsresult AddToNewMDB(); // accessor methods. - void SetHighWater(MessageKey highWater, PRBool force = FALSE) ; - MessageKey GetHighWater() ; - void SetExpiredMark(MessageKey expiredKey); + void SetHighWater(nsMsgKey highWater, PRBool force = FALSE) ; + nsMsgKey GetHighWater() ; + void SetExpiredMark(nsMsgKey expiredKey); int GetDiskVersion(); - PRBool AddLaterKey(MessageKey key, time_t until); + PRBool AddLaterKey(nsMsgKey key, time_t *until); PRInt32 GetNumLatered(); - MessageKey GetLateredAt(PRInt32 laterIndex, time_t *pUntil); + nsMsgKey GetLateredAt(PRInt32 laterIndex, time_t *pUntil); void RemoveLateredAt(PRInt32 laterIndex); virtual void SetMailboxName(const char *newBoxName); @@ -91,8 +91,8 @@ public: void SetVersion(PRUint16 version) {m_version = version;} - MessageKey GetLastMessageLoaded(); - void SetLastMessageLoaded(MessageKey lastLoaded); + nsMsgKey GetLastMessageLoaded(); + void SetLastMessageLoaded(nsMsgKey lastLoaded); void SetFolderSize(PRUint32 size); void SetFolderDate(time_t date); @@ -111,7 +111,7 @@ public: PRInt32 m_folderSize; PRInt32 m_expungedBytes; // sum of size of deleted messages in folder time_t m_folderDate; - MessageKey m_highWaterMessageKey; // largest news article number or imap uid whose header we've seen + nsMsgKey m_highWaterMessageKey; // largest news article number or imap uid whose header we've seen // IMAP only PRInt32 m_ImapUidValidity; @@ -119,7 +119,7 @@ public: PRInt32 m_UnreadPendingMessages; // news only (for now) - MessageKey m_expiredMark; // Highest invalid article number in group - for expiring + nsMsgKey m_expiredMark; // Highest invalid article number in group - for expiring PRInt32 m_viewType; // for news, the last view type open on this db. nsMsgKeyArray m_lateredKeys; // list of latered messages @@ -137,7 +137,7 @@ protected: PRInt32 m_numMessages; // includes expunged and ignored messages PRInt32 m_flags; // folder specific flags. This holds things like re-use thread pane, // configured for off-line use, use default retrieval, purge article/header options - MessageKey m_lastMessageLoaded; // set by the FE's to remember the last loaded message + nsMsgKey m_lastMessageLoaded; // set by the FE's to remember the last loaded message // the db folder info will have to know what db and row it belongs to, since it is really // just a wrapper around the singleton folder info row in the mdb. diff --git a/mailnews/db/msgdb/public/nsIDBChangeListener.h b/mailnews/db/msgdb/public/nsIDBChangeListener.h index df894783e00..02db99dd268 100644 --- a/mailnews/db/msgdb/public/nsIDBChangeListener.h +++ b/mailnews/db/msgdb/public/nsIDBChangeListener.h @@ -12,7 +12,7 @@ class nsDBChangeAnnouncer; class nsIDBChangeListener : public nsISupports { public: - NS_IMETHOD OnKeyChange(MessageKey aKeyChanged, int32 aFlags, + NS_IMETHOD OnKeyChange(nsMsgKey aKeyChanged, int32 aFlags, nsIDBChangeListener * aInstigator) = 0; NS_IMETHOD OnAnnouncerGoingAway(nsDBChangeAnnouncer * instigator) ; }; diff --git a/mailnews/db/msgdb/public/nsIMessage.h b/mailnews/db/msgdb/public/nsIMessage.h new file mode 100644 index 00000000000..d70770bd8be --- /dev/null +++ b/mailnews/db/msgdb/public/nsIMessage.h @@ -0,0 +1,71 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- + * + * The contents of this file are subject to the Netscape Public License + * Version 1.0 (the "NPL"); you may not use this file except in + * compliance with the NPL. You may obtain a copy of the NPL at + * http://www.mozilla.org/NPL/ + * + * Software distributed under the NPL is distributed on an "AS IS" basis, + * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the NPL + * for the specific language governing rights and limitations under the + * NPL. + * + * The Initial Developer of this code under the NPL is Netscape + * Communications Corporation. Portions created by Netscape are + * Copyright (C) 1999 Netscape Communications Corporation. All Rights + * Reserved. + */ + +#ifndef nsIMessage_h__ +#define nsIMessage_h__ + +#include "MailNewsTypes.h" +#include "nsString.h" + +#define NS_IMESSAGE_IID \ +{ /* 4e994f60-c317-11d2-8cc9-0060b0fc14a3 */ \ + 0x4e994f60, \ + 0xc317, \ + 0x11d2, \ + {0x8c, 0xc9, 0x00, 0x60, 0xb0, 0xfc, 0x14, 0xa3} \ +} + +class nsIMessage : public nsISupports { +public: + static const nsIID& IID() { static nsIID iid = NS_IMESSAGE_IID; return iid; } + + NS_IMETHOD GetProperty(const char *propertyName, nsString &resultProperty) = 0; + NS_IMETHOD SetProperty(const char *propertyName, nsString &propertyStr) = 0; + NS_IMETHOD GetUint32Property(const char *propertyName, PRUint32 *pResult) = 0; + NS_IMETHOD SetUint32Property(const char *propertyName, PRUint32 propertyVal) = 0; + NS_IMETHOD GetNumReferences(PRUint16 *result) = 0; + NS_IMETHOD GetStringReference(PRInt32 refNum, nsString &resultReference) = 0; + NS_IMETHOD GetDate(time_t *result) = 0; + NS_IMETHOD SetDate(time_t date) = 0; + NS_IMETHOD SetMessageId(const char *messageId) = 0; + NS_IMETHOD SetReferences(const char *references) = 0; + NS_IMETHOD SetCCList(const char *ccList) = 0; + NS_IMETHOD SetRecipients(const char *recipients, PRBool recipientsIsNewsgroup) = 0; + NS_IMETHOD SetAuthor(const char *author) = 0; + NS_IMETHOD SetSubject(const char *subject) = 0; + NS_IMETHOD SetStatusOffset(PRUint32 statusOffset) = 0; + + // flag handling routines + NS_IMETHOD GetFlags(PRUint32 *result) = 0; + NS_IMETHOD SetFlags(PRUint32 flags) = 0; + NS_IMETHOD OrFlags(PRUint32 flags, PRUint32 *result) = 0; + NS_IMETHOD AndFlags(PRUint32 flags, PRUint32 *result) = 0; + + NS_IMETHOD GetMessageKey(nsMsgKey *result) = 0; + NS_IMETHOD GetThreadId(nsMsgKey *result) = 0; + NS_IMETHOD SetMessageKey(nsMsgKey inKey) = 0; + NS_IMETHOD GetMessageSize(PRUint32 *result) = 0; + NS_IMETHOD SetMessageSize(PRUint32 messageSize) = 0; + NS_IMETHOD SetLineCount(PRUint32 lineCount) = 0; + NS_IMETHOD SetPriority(nsMsgPriority priority) = 0; + NS_IMETHOD SetPriority(const char *priority) = 0; + NS_IMETHOD GetMessageOffset(PRUint32 *result) = 0; + NS_IMETHOD GetStatusOffset(PRUint32 *result) = 0; +}; + +#endif // nsIMessage_h__ diff --git a/mailnews/db/msgdb/public/nsMailDatabase.h b/mailnews/db/msgdb/public/nsMailDatabase.h index 06ad264ceaa..53db2b67869 100644 --- a/mailnews/db/msgdb/public/nsMailDatabase.h +++ b/mailnews/db/msgdb/public/nsMailDatabase.h @@ -45,7 +45,7 @@ public: virtual nsresult OnNewPath (nsFilePath &newPath); - virtual nsresult DeleteMessages(nsMsgKeyArray &messageKeys, nsIDBChangeListener *instigator); + virtual nsresult DeleteMessages(nsMsgKeyArray &nsMsgKeys, nsIDBChangeListener *instigator); // virtual int GetCurVersion() {return kMailDBVersion;} static nsresult SetFolderInfoValid(nsFilePath &pathname, int num, int numunread); @@ -62,10 +62,10 @@ public: // folders can cause these operations to be stored in local mail folders. nsresult ListAllOfflineOpIds(nsMsgKeyArray &outputIds); int ListAllOfflineDeletes(nsMsgKeyArray &outputIds); - nsresult GetOfflineOpForKey(MessageKey opKey, PRBool create, nsOfflineImapOperation **); + nsresult GetOfflineOpForKey(nsMsgKey opKey, PRBool create, nsOfflineImapOperation **); nsresult AddOfflineOp(nsOfflineImapOperation *op); - nsresult DeleteOfflineOp(MessageKey opKey); - nsresult SetSourceMailbox(nsOfflineImapOperation *op, const char *mailbox, MessageKey key); + nsresult DeleteOfflineOp(nsMsgKey opKey); + nsresult SetSourceMailbox(nsOfflineImapOperation *op, const char *mailbox, nsMsgKey key); virtual nsresult SetSummaryValid(PRBool valid = PR_TRUE); diff --git a/mailnews/db/msgdb/public/nsMsgDatabase.h b/mailnews/db/msgdb/public/nsMsgDatabase.h index 6285064af5c..e58924143b5 100644 --- a/mailnews/db/msgdb/public/nsMsgDatabase.h +++ b/mailnews/db/msgdb/public/nsMsgDatabase.h @@ -50,7 +50,7 @@ public: virtual PRBool RemoveListener(nsIDBChangeListener *listener); // convenience routines to notify all our ChangeListeners - void NotifyKeyChangeAll(MessageKey keyChanged, PRInt32 flags, + void NotifyKeyChangeAll(nsMsgKey keyChanged, PRInt32 flags, nsIDBChangeListener *instigator); void NotifyAnnouncerGoingAway(nsDBChangeAnnouncer *instigator); }; @@ -70,8 +70,8 @@ public: // This is to be used as an interchange object, to make creating nsMsgHeaders easier. typedef struct _MessageHdrStruct { - MessageKey m_threadId; - MessageKey m_messageKey; + nsMsgKey m_threadId; + nsMsgKey m_messageKey; nsString m_subject; // should be nsCString when it's impl nsString m_author; // should be nsCString when it's impl nsString m_messageId; // should be nsCString when it's impl @@ -82,7 +82,7 @@ typedef struct _MessageHdrStruct PRUint32 m_flags; PRInt16 m_numChildren; // for top-level threads PRInt16 m_numNewChildren; // for top-level threads - MSG_PRIORITY m_priority; + nsMsgPriority m_priority; } MessageHdrStruct; // I don't think this is going to be an interface, actually, since it's just @@ -106,11 +106,11 @@ public: // In 4.x, it was mainly used to remove corrupted databases. virtual nsresult ForceClosed(); // get a message header for the given key. Caller must release()! - virtual nsresult GetMsgHdrForKey(MessageKey messageKey, nsMsgHdr **msgHdr); + virtual nsresult GetMsgHdrForKey(nsMsgKey key, nsMsgHdr **msgHdr); // create a new message header from a hdrStruct. Caller must release resulting header, // after adding any extra properties they want. virtual nsresult CreateNewHdr(PRBool *newThread, MessageHdrStruct *hdrStruct, nsMsgHdr **newHdr, PRBool notify = FALSE); - virtual nsresult CreateNewHdr(MessageKey key, nsMsgHdr **newHdr); + virtual nsresult CreateNewHdr(nsMsgKey key, nsMsgHdr **newHdr); // extract info from an nsMsgHdr into a MessageHdrStruct virtual nsresult GetMsgHdrStructFromnsMsgHdr(nsMsgHdr *msgHdr, MessageHdrStruct &hdrStruct); @@ -130,63 +130,63 @@ public: virtual nsresult MarkHdrRead(nsMsgHdr *msgHdr, PRBool bRead, nsIDBChangeListener *instigator); // MDN support - virtual nsresult MarkMDNNeeded(MessageKey messageKey, PRBool bNeeded, + virtual nsresult MarkMDNNeeded(nsMsgKey key, PRBool bNeeded, nsIDBChangeListener *instigator = NULL); // MarkMDNneeded only used when mail server is a POP3 server // or when the IMAP server does not support user defined // PERMANENTFLAGS - virtual nsresult IsMDNNeeded(MessageKey messageKey, PRBool *isNeeded); + virtual nsresult IsMDNNeeded(nsMsgKey key, PRBool *isNeeded); - virtual nsresult MarkMDNSent(MessageKey messageKey, PRBool bNeeded, + virtual nsresult MarkMDNSent(nsMsgKey key, PRBool bNeeded, nsIDBChangeListener *instigator = NULL); - virtual nsresult IsMDNSent(MessageKey messageKey, PRBool *isSent); + virtual nsresult IsMDNSent(nsMsgKey key, PRBool *isSent); // methods to get and set docsets for ids. - virtual nsresult MarkRead(MessageKey messageKey, PRBool bRead, + virtual nsresult MarkRead(nsMsgKey key, PRBool bRead, nsIDBChangeListener *instigator = NULL); - virtual nsresult MarkReplied(MessageKey messageKey, PRBool bReplied, + virtual nsresult MarkReplied(nsMsgKey key, PRBool bReplied, nsIDBChangeListener *instigator = NULL); - virtual nsresult MarkForwarded(MessageKey messageKey, PRBool bForwarded, + virtual nsresult MarkForwarded(nsMsgKey key, PRBool bForwarded, nsIDBChangeListener *instigator = NULL); - virtual nsresult MarkHasAttachments(MessageKey messageKey, PRBool bHasAttachments, + virtual nsresult MarkHasAttachments(nsMsgKey key, PRBool bHasAttachments, nsIDBChangeListener *instigator = NULL); #ifdef WE_DO_THREADING_YET - virtual nsresult MarkThreadIgnored(nsThreadMessageHdr *thread, MessageKey threadKey, PRBool bIgnored, + virtual nsresult MarkThreadIgnored(nsThreadMessageHdr *thread, nsMsgKey threadKey, PRBool bIgnored, nsIDBChangeListener *instigator = NULL); - virtual nsresult MarkThreadWatched(nsThreadMessageHdr *thread, MessageKey threadKey, PRBool bWatched, + virtual nsresult MarkThreadWatched(nsThreadMessageHdr *thread, nsMsgKey threadKey, PRBool bWatched, nsIDBChangeListener *instigator = NULL); #endif - virtual nsresult IsRead(MessageKey messageKey, PRBool *pRead); - virtual nsresult IsIgnored(MessageKey messageKey, PRBool *pIgnored); - virtual nsresult IsMarked(MessageKey messageKey, PRBool *pMarked); - virtual nsresult HasAttachments(MessageKey messageKey, PRBool *pHasThem); + virtual nsresult IsRead(nsMsgKey key, PRBool *pRead); + virtual nsresult IsIgnored(nsMsgKey key, PRBool *pIgnored); + virtual nsresult IsMarked(nsMsgKey key, PRBool *pMarked); + virtual nsresult HasAttachments(nsMsgKey key, PRBool *pHasThem); virtual nsresult MarkAllRead(nsMsgKeyArray *thoseMarked); virtual nsresult MarkReadByDate (time_t startDate, time_t endDate, nsMsgKeyArray *markedIds); - virtual nsresult DeleteMessages(nsMsgKeyArray &messageKeys, nsIDBChangeListener *instigator); - virtual nsresult DeleteMessage(MessageKey messageKey, + virtual nsresult DeleteMessages(nsMsgKeyArray &nsMsgKeys, nsIDBChangeListener *instigator); + virtual nsresult DeleteMessage(nsMsgKey key, nsIDBChangeListener *instigator = NULL, PRBool commit = PR_TRUE); virtual nsresult DeleteHeader(nsMsgHdr *msgHdr, nsIDBChangeListener *instigator, PRBool commit, PRBool notify = TRUE); #ifdef WE_DO_UNDO virtual nsresult UndoDelete(nsMsgHdr *msgHdr); #endif - virtual nsresult MarkLater(MessageKey messageKey, time_t until); - virtual nsresult MarkMarked(MessageKey messageKey, PRBool mark, + virtual nsresult MarkLater(nsMsgKey key, time_t *until); + virtual nsresult MarkMarked(nsMsgKey key, PRBool mark, nsIDBChangeListener *instigator = NULL); - virtual nsresult MarkOffline(MessageKey messageKey, PRBool offline, + virtual nsresult MarkOffline(nsMsgKey key, PRBool offline, nsIDBChangeListener *instigator); #ifdef WE_DO_IMAP - virtual PRBool AllMessageKeysImapDeleted(const nsMsgKeyArray &keys); + virtual PRBool AllnsMsgKeysImapDeleted(const nsMsgKeyArray &keys); #endif - virtual nsresult MarkImapDeleted(MessageKey messageKey, PRBool deleted, + virtual nsresult MarkImapDeleted(nsMsgKey key, PRBool deleted, nsIDBChangeListener *instigator); - virtual MessageKey GetFirstNew(); + virtual nsMsgKey GetFirstNew(); virtual PRBool HasNew(); virtual void ClearNewList(PRBool notify = FALSE); @@ -235,7 +235,7 @@ protected: static int FindInCache(nsMsgDatabase* pMessageDB); PRBool MatchDbName(nsFilePath &dbName); // returns TRUE if they match - virtual nsresult SetKeyFlag(MessageKey messageKey, PRBool set, PRInt32 flag, + virtual nsresult SetKeyFlag(nsMsgKey key, PRBool set, PRInt32 flag, nsIDBChangeListener *instigator = NULL); virtual PRBool SetHdrFlag(nsMsgHdr *, PRBool bSet, MsgFlags flag); virtual nsresult IsHeaderRead(nsMsgHdr *hdr, PRBool *pRead); diff --git a/mailnews/db/msgdb/public/nsMsgHdr.h b/mailnews/db/msgdb/public/nsMsgHdr.h index 1fd43382af9..45e48773785 100644 --- a/mailnews/db/msgdb/public/nsMsgHdr.h +++ b/mailnews/db/msgdb/public/nsMsgHdr.h @@ -1,4 +1,4 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * The contents of this file are subject to the Netscape Public License * Version 1.0 (the "NPL"); you may not use this file except in @@ -19,6 +19,8 @@ #ifndef _nsMsgHdr_H #define _nsMsgHdr_H +#include "nsIMessage.h" +#include "nsRDFResource.h" #include "nsString.h" #include "MailNewsTypes.h" #include "xp.h" @@ -30,78 +32,76 @@ class nsMsgDatabase; // but I don't intend it to be a public interface. I'll just // declare AddRef and Release as methods.. -class nsMsgHdr -{ +class nsMsgHdr : public nsRDFResource, public nsIMessage { public: -// nsMsgHdr(); - nsMsgHdr(nsMsgDatabase *db, mdbRow *dbRow); - void Init(); - virtual ~nsMsgHdr(); - nsrefcnt AddRef(void); - nsrefcnt Release(void); - nsresult GetProperty(const char *propertyName, nsString &resultProperty); - nsresult SetProperty(const char *propertyName, nsString &propertyStr); - nsresult GetUint32Property(const char *propertyName, PRUint32 *pResult); - nsresult SetUint32Property(const char *propertyName, PRUint32 propertyVal); - uint16 GetNumReferences(); - nsresult GetStringReference(PRInt32 refNum, nsString &resultReference); - time_t GetDate(); - nsresult SetDate(time_t date); - void SetCSID(PRUint16 csid) {m_csID = csid;} - PRInt16 GetCSID(); - nsresult SetMessageId(const char *messageId); - nsresult SetReferences(const char *references); - nsresult SetCCList(const char *ccList); - // rfc822 is false when recipients is a newsgroup list - nsresult SetRecipients(const char *recipients, PRBool rfc822 = PR_TRUE); - nsresult SetAuthor(const char *author); - nsresult SetSubject(const char *subject); + //////////////////////////////////////////////////////////////////////////// + // nsIMessage 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); + NS_IMETHOD SetUint32Property(const char *propertyName, PRUint32 propertyVal); + NS_IMETHOD GetNumReferences(PRUint16 *result); + NS_IMETHOD GetStringReference(PRInt32 refNum, nsString &resultReference); + NS_IMETHOD GetDate(time_t *result); + NS_IMETHOD SetDate(time_t date); + NS_IMETHOD SetMessageId(const char *messageId); + NS_IMETHOD SetReferences(const char *references); + NS_IMETHOD SetCCList(const char *ccList); + NS_IMETHOD SetRecipients(const char *recipients, PRBool recipientsIsNewsgroup); + NS_IMETHOD SetAuthor(const char *author); + NS_IMETHOD SetSubject(const char *subject); + NS_IMETHOD SetStatusOffset(PRUint32 statusOffset); - nsresult SetStatusOffset(PRUint32 statusOffset); + // flag handling routines + NS_IMETHOD GetFlags(PRUint32 *result); + NS_IMETHOD SetFlags(PRUint32 flags); + NS_IMETHOD OrFlags(PRUint32 flags, PRUint32 *result); + NS_IMETHOD AndFlags(PRUint32 flags, PRUint32 *result); - // flag handling routines - virtual PRUint32 GetFlags() {return m_flags;} - void SetFlags(PRUint32 flags); - PRUint32 OrFlags(PRUint32 flags); - PRUint32 AndFlags(PRUint32 flags); + NS_IMETHOD GetMessageKey(nsMsgKey *result); + NS_IMETHOD GetThreadId(nsMsgKey *result); + NS_IMETHOD SetMessageKey(nsMsgKey inKey); + NS_IMETHOD GetMessageSize(PRUint32 *result); + NS_IMETHOD SetMessageSize(PRUint32 messageSize); + NS_IMETHOD SetLineCount(PRUint32 lineCount); + NS_IMETHOD SetPriority(nsMsgPriority priority); + NS_IMETHOD SetPriority(const char *priority); + NS_IMETHOD GetMessageOffset(PRUint32 *result); + NS_IMETHOD GetStatusOffset(PRUint32 *result); - MessageKey GetMessageKey(); - MessageKey GetThreadId(); - void SetMessageKey(MessageKey inKey) {m_messageKey = inKey;} - virtual PRUint32 GetMessageSize() {return m_messageSize;} - void SetMessageSize(PRUint32 messageSize); - void SetLineCount(PRUint32 lineCount); - void SetPriority(MSG_PRIORITY priority) { m_priority = priority;} - void SetPriority(const char *priority); - // this is almost always the m_messageKey, except for the first message. - // NeoAccess doesn't allow fID's of 0. - virtual PRUint32 GetMessageOffset() {return m_messageKey;} - virtual PRUint32 GetStatusOffset(); + //////////////////////////////////////////////////////////////////////////// + // nsMsgHdr methods: + nsMsgHdr(nsMsgDatabase *db, mdbRow *dbRow); + void Init(); - mdbRow *GetMDBRow() {return m_mdbRow;} + virtual ~nsMsgHdr(); + + NS_DECL_ISUPPORTS + + void SetCSID(PRUint16 csid) {m_csID = csid;} + PRInt16 GetCSID(); + mdbRow *GetMDBRow() {return m_mdbRow;} protected: - nsresult SetStringColumn(const char *str, mdb_token token); - nsresult SetUInt32Column(PRUint32 value, mdb_token token); - nsresult GetUInt32Column(mdb_token token, PRUint32 *pvalue); + nsresult SetStringColumn(const char *str, mdb_token token); + nsresult SetUInt32Column(PRUint32 value, mdb_token token); + nsresult GetUInt32Column(mdb_token token, PRUint32 *pvalue); - nsrefcnt mRefCnt; + nsMsgKey m_threadId; + nsMsgKey m_messageKey; //news: article number, mail mbox offset, imap uid... + time_t m_date; + PRUint32 m_messageSize; // lines for news articles, bytes for mail messages + PRUint32 m_statusOffset; // offset in a local mail message of the mozilla status hdr + PRUint32 m_flags; + PRUint16 m_numReferences; // x-ref header for threading + PRInt16 m_csID; // cs id of message + nsMsgPriority m_priority; - MessageKey m_threadId; - MessageKey m_messageKey; //news: article number, mail mbox offset, imap uid... - time_t m_date; - PRUint32 m_messageSize; // lines for news articles, bytes for mail messages - PRUint32 m_statusOffset; // offset in a local mail message of the mozilla status hdr - PRUint32 m_flags; - PRUint16 m_numReferences; // x-ref header for threading - PRInt16 m_csID; // cs id of message - MSG_PRIORITY m_priority; - - // nsMsgHdrs will have to know what db and row they belong to, since they are really -// just a wrapper around the msg row in the mdb. This could cause problems, -// though I hope not. - nsMsgDatabase *m_mdb; - mdbRow *m_mdbRow; + // nsMsgHdrs will have to know what db and row they belong to, since they are really + // just a wrapper around the msg row in the mdb. This could cause problems, + // though I hope not. + nsMsgDatabase *m_mdb; + mdbRow *m_mdbRow; }; #endif diff --git a/mailnews/db/msgdb/public/nsNewsDatabase.h b/mailnews/db/msgdb/public/nsNewsDatabase.h index a6fcc64c233..654c74ce1c1 100644 --- a/mailnews/db/msgdb/public/nsNewsDatabase.h +++ b/mailnews/db/msgdb/public/nsNewsDatabase.h @@ -39,19 +39,19 @@ public: // methods to get and set docsets for ids. virtual nsresult MarkHdrRead(nsMsgHdr *msgHdr, PRBool bRead, ChangeListener *instigator = NULL); - virtual nsresult IsRead(MessageKey messageKey, PRBool *pRead); - virtual PRBool IsArticleOffline(MessageKey messageKey); + virtual nsresult IsRead(nsMsgKey key, PRBool *pRead); + virtual PRBool IsArticleOffline(nsMsgKey key); virtual nsresult MarkAllRead(MWContext *context, IDArray *thoseMarked = NULL); - virtual nsresult AddHdrFromXOver(const char * line, MessageKey *msgId); + virtual nsresult AddHdrFromXOver(const char * line, nsMsgKey *msgId); virtual nsresult AddHdrToDB(nsMsgHdr *newHdr, PRBool *newThread, PRBool notify = PR_FALSE); virtual nsresult ListNextUnread(ListContext **pContext, nsMsgHdr **pResult); // return highest article number we've seen. - virtual MessageKey GetHighwaterArticleNum(); - virtual MessageKey GetLowWaterArticleNum(); + virtual nsMsgKey GetHighwaterArticleNum(); + virtual nsMsgKey GetLowWaterArticleNum(); - virtual nsresult ExpireUpTo(MessageKey expireKey); - virtual nsresult ExpireRange(MessageKey startRange, MessageKey endRange); + virtual nsresult ExpireUpTo(nsMsgKey expireKey); + virtual nsresult ExpireRange(nsMsgKey startRange, nsMsgKey endRange); msg_NewsArtSet *GetNewsArtSet() {return m_set;} virtual nsNewsDatabase *GetNewsDB() ; diff --git a/mailnews/db/msgdb/src/nsDBFolderInfo.cpp b/mailnews/db/msgdb/src/nsDBFolderInfo.cpp index ae2d4bc5a7c..3331d74f78a 100644 --- a/mailnews/db/msgdb/src/nsDBFolderInfo.cpp +++ b/mailnews/db/msgdb/src/nsDBFolderInfo.cpp @@ -39,6 +39,7 @@ static const char * kUnreadPendingMessagesColumnName = "unreadPendingMsgs"; static const char * kMailboxNameColumnName = "mailboxName"; nsDBFolderInfo::nsDBFolderInfo(nsMsgDatabase *mdb) + : m_folderDate() // now { m_mdbTable = NULL; m_mdbRow = NULL; @@ -50,7 +51,6 @@ nsDBFolderInfo::nsDBFolderInfo(nsMsgDatabase *mdb) // mail only (for now) m_folderSize = 0; m_expungedBytes = 0; // sum of size of deleted messages in folder - m_folderDate = 0; m_highWaterMessageKey = 0; // IMAP only @@ -182,7 +182,7 @@ nsresult nsDBFolderInfo::InitMDBInfo() return ret; } -void nsDBFolderInfo::SetHighWater(MessageKey highWater, PRBool force /* = FALSE */) +void nsDBFolderInfo::SetHighWater(nsMsgKey highWater, PRBool force /* = FALSE */) { if (force || m_highWaterMessageKey < highWater) { @@ -201,12 +201,12 @@ void nsDBFolderInfo::SetFolderDate(time_t folderDate) } -MessageKey nsDBFolderInfo::GetHighWater() +nsMsgKey nsDBFolderInfo::GetHighWater() { return m_highWaterMessageKey; } -void nsDBFolderInfo::SetExpiredMark(MessageKey expiredKey) +void nsDBFolderInfo::SetExpiredMark(nsMsgKey expiredKey) { } @@ -215,7 +215,7 @@ int nsDBFolderInfo::GetDiskVersion() return m_version; } -PRBool nsDBFolderInfo::AddLaterKey(MessageKey key, time_t until) +PRBool nsDBFolderInfo::AddLaterKey(nsMsgKey key, time_t *until) { return PR_FALSE; } @@ -225,9 +225,9 @@ PRInt32 nsDBFolderInfo::GetNumLatered() return 0; } -MessageKey nsDBFolderInfo::GetLateredAt(PRInt32 laterIndex, time_t *pUntil) +nsMsgKey nsDBFolderInfo::GetLateredAt(PRInt32 laterIndex, time_t *pUntil) { - return MSG_MESSAGEKEYNONE; + return nsMsgKey_None; } void nsDBFolderInfo::RemoveLateredAt(PRInt32 laterIndex) @@ -394,12 +394,12 @@ void nsDBFolderInfo::SetImapUidValidity(PRInt32 uidValidity) m_ImapUidValidity = uidValidity; } -MessageKey nsDBFolderInfo::GetLastMessageLoaded() +nsMsgKey nsDBFolderInfo::GetLastMessageLoaded() { return m_lastMessageLoaded; } -void nsDBFolderInfo::SetLastMessageLoaded(MessageKey lastLoaded) +void nsDBFolderInfo::SetLastMessageLoaded(nsMsgKey lastLoaded) { m_lastMessageLoaded = lastLoaded; } diff --git a/mailnews/db/msgdb/src/nsMailDatabase.cpp b/mailnews/db/msgdb/src/nsMailDatabase.cpp index df7e7aa06a3..5de14fff95a 100644 --- a/mailnews/db/msgdb/src/nsMailDatabase.cpp +++ b/mailnews/db/msgdb/src/nsMailDatabase.cpp @@ -1,4 +1,4 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * The contents of this file are subject to the Netscape Public License * Version 1.0 (the "NPL"); you may not use this file except in @@ -144,11 +144,11 @@ nsresult nsMailDatabase::OnNewPath (nsFilePath &newPath) return ret; } -nsresult nsMailDatabase::DeleteMessages(nsMsgKeyArray &messageKeys, nsIDBChangeListener *instigator) +nsresult nsMailDatabase::DeleteMessages(nsMsgKeyArray &nsMsgKeys, nsIDBChangeListener *instigator) { nsresult ret = NS_OK; m_folderStream = new nsIOFileStream(m_dbName); - ret = nsMsgDatabase::DeleteMessages(messageKeys, instigator); + ret = nsMsgDatabase::DeleteMessages(nsMsgKeys, instigator); if (m_folderStream) delete m_folderStream; m_folderStream = NULL; @@ -212,7 +212,9 @@ void nsMailDatabase::UpdateFolderFlag(nsMsgHdr *mailHdr, PRBool bSet, savedPosition = ftell(gIncorporateFID); // so we can restore it. } #endif // XP_MAC - if (mailHdr->GetStatusOffset() > 0) + PRUint32 offset; + (void)mailHdr->GetStatusOffset(&offset); + if (offset > 0) { if (fileStream == NULL) @@ -221,8 +223,10 @@ void nsMailDatabase::UpdateFolderFlag(nsMsgHdr *mailHdr, PRBool bSet, } if (fileStream) { - PRUint32 position = mailHdr->GetStatusOffset() + mailHdr->GetMessageOffset(); - PR_ASSERT(mailHdr->GetStatusOffset() < 10000); + PRUint32 msgOffset; + (void)mailHdr->GetMessageOffset(&msgOffset); + PRUint32 position = offset + msgOffset; + PR_ASSERT(offset < 10000); fileStream->seek(position); buf[0] = '\0'; if (fileStream->readline(buf, sizeof(buf))) @@ -231,7 +235,8 @@ void nsMailDatabase::UpdateFolderFlag(nsMsgHdr *mailHdr, PRBool bSet, strncmp(buf + X_MOZILLA_STATUS_LEN, ": ", 2) == 0 && strlen(buf) > X_MOZILLA_STATUS_LEN + 6) { - uint16 flags = mailHdr->GetFlags(); + PRUint32 flags; + (void)mailHdr->GetFlags(&flags); if (!(flags & MSG_FLAG_EXPUNGED)) { int i; @@ -241,9 +246,11 @@ void nsMailDatabase::UpdateFolderFlag(nsMsgHdr *mailHdr, PRBool bSet, { flags = (flags << 4) | msg_UnHex(*p); } + + PRUint32 curFlags; + (void)mailHdr->GetFlags(&curFlags); flags = (flags & MSG_FLAG_QUEUED) | - (mailHdr->GetFlags() & - ~MSG_FLAG_RUNTIME_ONLY); + (curFlags & ~MSG_FLAG_RUNTIME_ONLY); } else { @@ -263,7 +270,8 @@ void nsMailDatabase::UpdateFolderFlag(nsMsgHdr *mailHdr, PRBool bSet, strncmp(buf + X_MOZILLA_STATUS2_LEN, ": ", 2) == 0 && strlen(buf) > X_MOZILLA_STATUS2_LEN + 10) { - uint32 dbFlags = mailHdr->GetFlags(); + PRUint32 dbFlags; + (void)mailHdr->GetFlags(&dbFlags); dbFlags &= (MSG_FLAG_MDN_REPORT_NEEDED | MSG_FLAG_MDN_REPORT_SENT | MSG_FLAG_TEMPLATE); fileStream->seek(position + LINEBREAK_LEN); PR_snprintf(buf, sizeof(buf), X_MOZILLA_STATUS2_FORMAT, dbFlags); @@ -359,7 +367,7 @@ int nsMailDatabase::ListAllOfflineDeletes(nsMsgKeyArray &outputIds) nsresult ret = NS_OK; return ret; } -nsresult nsMailDatabase::GetOfflineOpForKey(MessageKey opKey, PRBool create, nsOfflineImapOperation **) +nsresult nsMailDatabase::GetOfflineOpForKey(nsMsgKey opKey, PRBool create, nsOfflineImapOperation **) { nsresult ret = NS_OK; return ret; @@ -371,13 +379,13 @@ nsresult nsMailDatabase::AddOfflineOp(nsOfflineImapOperation *op) return ret; } -nsresult DeleteOfflineOp(MessageKey opKey) +nsresult DeleteOfflineOp(nsMsgKey opKey) { nsresult ret = NS_OK; return ret; } -nsresult SetSourceMailbox(nsOfflineImapOperation *op, const char *mailbox, MessageKey key) +nsresult SetSourceMailbox(nsOfflineImapOperation *op, const char *mailbox, nsMsgKey key) { nsresult ret = NS_OK; return ret; diff --git a/mailnews/db/msgdb/src/nsMsgDatabase.cpp b/mailnews/db/msgdb/src/nsMsgDatabase.cpp index dc64035e958..6b70fca5c5d 100644 --- a/mailnews/db/msgdb/src/nsMsgDatabase.cpp +++ b/mailnews/db/msgdb/src/nsMsgDatabase.cpp @@ -1,4 +1,4 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * The contents of this file are subject to the Netscape Public License * Version 1.0 (the "NPL"); you may not use this file except in @@ -24,11 +24,10 @@ #include "nsNewsSet.h" #ifdef WE_HAVE_MDBINTERFACES -static NS_DEFINE_IID(kIMDBIID, NS_IMDB_IID); -static NS_DEFINE_IID(kIMBBCID, NS_IMBB_IID); +static NS_DEFINE_CID(kIMBBCID, NS_IMBB_IID); - nsresult rv = nsRepository::CreateInstance(kMDBCID, nsnull, kIMDBIID, (void **)&gMDBInterface); + nsresult rv = nsRepository::CreateInstance(kMDBCID, nsnull, nsIMDB::IID(), (void **)&gMDBInterface); if (nsnull != devSpec){ if (NS_OK == ((nsDeviceContextSpecMac *)devSpec)->Init(aQuiet)){ @@ -68,7 +67,7 @@ PRBool nsDBChangeAnnouncer::RemoveListener(nsIDBChangeListener *listener) } // change announcer methods - just broadcast to all listeners. -void nsDBChangeAnnouncer::NotifyKeyChangeAll(MessageKey keyChanged, PRInt32 flags, +void nsDBChangeAnnouncer::NotifyKeyChangeAll(nsMsgKey keyChanged, PRInt32 flags, nsIDBChangeListener *instigator) { @@ -466,7 +465,7 @@ nsresult nsMsgDatabase::InitMDBInfo() } // get a message header for the given key. Caller must release()! -nsresult nsMsgDatabase::GetMsgHdrForKey(MessageKey messageKey, nsMsgHdr **pmsgHdr) +nsresult nsMsgDatabase::GetMsgHdrForKey(nsMsgKey key, nsMsgHdr **pmsgHdr) { nsresult err = NS_OK; mdb_pos rowPos; @@ -477,7 +476,7 @@ nsresult nsMsgDatabase::GetMsgHdrForKey(MessageKey messageKey, nsMsgHdr **pmsgHd return NS_ERROR_NULL_POINTER; *pmsgHdr = NULL; - rowObjectId.mOid_Id = messageKey; + rowObjectId.mOid_Id = key; rowObjectId.mOid_Scope = m_hdrRowScopeToken; err = m_mdbAllMsgHeadersTable->HasOid(GetEnv(), &rowObjectId, &rowPos); if (err == NS_OK) @@ -499,12 +498,12 @@ nsresult nsMsgDatabase::GetMsgHdrForKey(MessageKey messageKey, nsMsgHdr **pmsgHd return err; } -nsresult nsMsgDatabase::DeleteMessage(MessageKey messageKey, nsIDBChangeListener *instigator, PRBool commit) +nsresult nsMsgDatabase::DeleteMessage(nsMsgKey key, nsIDBChangeListener *instigator, PRBool commit) { nsresult err = NS_OK; nsMsgHdr *msgHdr = NULL; - err = GetMsgHdrForKey(messageKey, &msgHdr); + err = GetMsgHdrForKey(key, &msgHdr); if (msgHdr == NULL) return NS_MSG_MESSAGE_NOT_FOUND; @@ -512,16 +511,16 @@ nsresult nsMsgDatabase::DeleteMessage(MessageKey messageKey, nsIDBChangeListene } -nsresult nsMsgDatabase::DeleteMessages(nsMsgKeyArray &messageKeys, nsIDBChangeListener *instigator) +nsresult nsMsgDatabase::DeleteMessages(nsMsgKeyArray &nsMsgKeys, nsIDBChangeListener *instigator) { nsresult err = NS_OK; - for (PRUint32 index = 0; index < messageKeys.GetSize(); index++) + for (PRUint32 index = 0; index < nsMsgKeys.GetSize(); index++) { - MessageKey messageKey = messageKeys.GetAt(index); + nsMsgKey key = nsMsgKeys.GetAt(index); nsMsgHdr *msgHdr = NULL; - err = GetMsgHdrForKey(messageKey, &msgHdr); + err = GetMsgHdrForKey(key, &msgHdr); if (msgHdr == NULL || err != NS_OK) { err = NS_MSG_MESSAGE_NOT_FOUND; @@ -538,29 +537,35 @@ nsresult nsMsgDatabase::DeleteMessages(nsMsgKeyArray &messageKeys, nsIDBChangeLi nsresult nsMsgDatabase::DeleteHeader(nsMsgHdr *msgHdr, nsIDBChangeListener *instigator, PRBool commit, PRBool notify /* = PR_TRUE */) { - MessageKey messageKey = msgHdr->GetMessageKey(); + nsMsgKey key; + (void)msgHdr->GetMessageKey(&key); // only need to do this for mail - will this speed up news expiration? // if (GetMailDB()) SetHdrFlag(msgHdr, PR_TRUE, MSG_FLAG_EXPUNGED); // tell mailbox (mail) if (m_newSet) // if it's in the new set, better get rid of it. - m_newSet->Remove(msgHdr->GetMessageKey()); + m_newSet->Remove(key); if (m_dbFolderInfo != NULL) { PRBool isRead; m_dbFolderInfo->ChangeNumMessages(-1); m_dbFolderInfo->ChangeNumVisibleMessages(-1); - IsRead(msgHdr->GetMessageKey(), &isRead); + IsRead(key, &isRead); if (!isRead) m_dbFolderInfo->ChangeNumNewMessages(-1); - m_dbFolderInfo->m_expungedBytes += msgHdr->GetMessageSize(); + PRUint32 size; + (void)msgHdr->GetMessageSize(&size); + m_dbFolderInfo->m_expungedBytes += size; } - if (notify) - NotifyKeyChangeAll(messageKey, msgHdr->GetFlags(), instigator); // tell listeners + if (notify) { + PRUint32 flags; + (void)msgHdr->GetFlags(&flags); + NotifyKeyChangeAll(key, flags, instigator); // tell listeners + } // if (!onlyRemoveFromThread) // to speed up expiration, try this. But really need to do this in RemoveHeaderFromDB RemoveHeaderFromDB(msgHdr); @@ -581,12 +586,12 @@ nsresult nsMsgDatabase::RemoveHeaderFromDB(nsMsgHdr *msgHdr) return ret; } -nsresult nsMsgDatabase::IsRead(MessageKey messageKey, PRBool *pRead) +nsresult nsMsgDatabase::IsRead(nsMsgKey key, PRBool *pRead) { nsresult err = NS_OK; nsMsgHdr *msgHdr; - err = GetMsgHdrForKey(messageKey, &msgHdr); + err = GetMsgHdrForKey(key, &msgHdr); if (err == NS_OK && msgHdr != NULL) { err = IsHeaderRead(msgHdr, pRead); @@ -601,12 +606,15 @@ nsresult nsMsgDatabase::IsRead(MessageKey messageKey, PRBool *pRead) PRUint32 nsMsgDatabase::GetStatusFlags(nsMsgHdr *msgHdr) { - PRUint32 statusFlags = msgHdr->GetFlags(); + PRUint32 statusFlags; + (void)msgHdr->GetFlags(&statusFlags); PRBool isRead; - if (m_newSet && m_newSet->IsMember(msgHdr->GetMessageKey())) + nsMsgKey key; + (void)msgHdr->GetMessageKey(&key); + if (m_newSet && m_newSet->IsMember(key)) statusFlags |= MSG_FLAG_NEW; - if (IsRead(msgHdr->GetMessageKey(), &isRead) == NS_OK && isRead) + if (IsRead(key, &isRead) == NS_OK && isRead) statusFlags |= MSG_FLAG_READ; return statusFlags; } @@ -616,19 +624,23 @@ nsresult nsMsgDatabase::IsHeaderRead(nsMsgHdr *hdr, PRBool *pRead) if (!hdr) return NS_MSG_MESSAGE_NOT_FOUND; - *pRead = (hdr->GetFlags() & MSG_FLAG_READ) != 0; + PRUint32 flags; + (void)hdr->GetFlags(&flags); + *pRead = (flags & MSG_FLAG_READ) != 0; return NS_OK; } -nsresult nsMsgDatabase::IsMarked(MessageKey messageKey, PRBool *pMarked) +nsresult nsMsgDatabase::IsMarked(nsMsgKey key, PRBool *pMarked) { nsresult err = NS_OK; nsMsgHdr *msgHdr; - err = GetMsgHdrForKey(messageKey, &msgHdr); + err = GetMsgHdrForKey(key, &msgHdr); if (err == NS_OK && msgHdr != NULL) { - *pMarked = (msgHdr->GetFlags() & MSG_FLAG_MARKED) == MSG_FLAG_MARKED; + PRUint32 flags; + (void)msgHdr->GetFlags(&flags); + *pMarked = (flags & MSG_FLAG_MARKED) == MSG_FLAG_MARKED; msgHdr->Release(); return err; } @@ -638,13 +650,13 @@ nsresult nsMsgDatabase::IsMarked(MessageKey messageKey, PRBool *pMarked) } } -nsresult nsMsgDatabase::IsIgnored(MessageKey messageKey, PRBool *pIgnored) +nsresult nsMsgDatabase::IsIgnored(nsMsgKey key, PRBool *pIgnored) { PR_ASSERT(pIgnored != NULL); if (!pIgnored) return NS_ERROR_NULL_POINTER; #ifdef WE_DO_THREADING_YET - nsThreadMessageHdr *threadHdr = GetnsThreadHdrForMsgID(messageKey); + nsThreadMessageHdr *threadHdr = GetnsThreadHdrForMsgID(nsMsgKey); // This should be very surprising, but we leave that up to the caller // to determine for now. if (threadHdr == NULL) @@ -655,7 +667,7 @@ nsresult nsMsgDatabase::IsIgnored(MessageKey messageKey, PRBool *pIgnored) return NS_OK; } -nsresult nsMsgDatabase::HasAttachments(MessageKey messageKey, PRBool *pHasThem) +nsresult nsMsgDatabase::HasAttachments(nsMsgKey key, PRBool *pHasThem) { nsresult ret; @@ -665,10 +677,12 @@ nsresult nsMsgDatabase::HasAttachments(MessageKey messageKey, PRBool *pHasThem) nsMsgHdr *msgHdr; - ret = GetMsgHdrForKey(messageKey, &msgHdr); + ret = GetMsgHdrForKey(key, &msgHdr); if (ret == NS_OK && msgHdr != NULL) { - *pHasThem = (msgHdr->GetFlags() & MSG_FLAG_ATTACHMENT) ? PR_TRUE : PR_FALSE; + PRUint32 flags; + (void)msgHdr->GetFlags(&flags); + *pHasThem = (flags & MSG_FLAG_ATTACHMENT) ? PR_TRUE : PR_FALSE; msgHdr->Release(); } return ret; @@ -677,9 +691,11 @@ nsresult nsMsgDatabase::HasAttachments(MessageKey messageKey, PRBool *pHasThem) void nsMsgDatabase::MarkHdrReadInDB(nsMsgHdr *msgHdr, PRBool bRead, nsIDBChangeListener *instigator) { + nsMsgKey key; + (void)msgHdr->GetMessageKey(&key); SetHdrFlag(msgHdr, bRead, MSG_FLAG_READ); if (m_newSet) - m_newSet->Remove(msgHdr->GetMessageKey()); + m_newSet->Remove(key); if (m_dbFolderInfo != NULL) { if (bRead) @@ -688,16 +704,18 @@ void nsMsgDatabase::MarkHdrReadInDB(nsMsgHdr *msgHdr, PRBool bRead, m_dbFolderInfo->ChangeNumNewMessages(1); } - NotifyKeyChangeAll(msgHdr->GetMessageKey(), msgHdr->GetFlags(), instigator); + PRUint32 flags; + (void)msgHdr->GetFlags(&flags); + NotifyKeyChangeAll(key, flags, instigator); } -nsresult nsMsgDatabase::MarkRead(MessageKey messageKey, PRBool bRead, +nsresult nsMsgDatabase::MarkRead(nsMsgKey key, PRBool bRead, nsIDBChangeListener *instigator) { nsresult err; nsMsgHdr *msgHdr; - err = GetMsgHdrForKey(messageKey, &msgHdr); + err = GetMsgHdrForKey(key, &msgHdr); if (err != NS_OK || msgHdr == NULL) return NS_MSG_MESSAGE_NOT_FOUND; @@ -706,58 +724,60 @@ nsresult nsMsgDatabase::MarkRead(MessageKey messageKey, PRBool bRead, return err; } -nsresult nsMsgDatabase::MarkReplied(MessageKey messageKey, PRBool bReplied, +nsresult nsMsgDatabase::MarkReplied(nsMsgKey key, PRBool bReplied, nsIDBChangeListener *instigator /* = NULL */) { - return SetKeyFlag(messageKey, bReplied, MSG_FLAG_REPLIED, instigator); + return SetKeyFlag(key, bReplied, MSG_FLAG_REPLIED, instigator); } -nsresult nsMsgDatabase::MarkForwarded(MessageKey messageKey, PRBool bForwarded, +nsresult nsMsgDatabase::MarkForwarded(nsMsgKey key, PRBool bForwarded, nsIDBChangeListener *instigator /* = NULL */) { - return SetKeyFlag(messageKey, bForwarded, MSG_FLAG_FORWARDED, instigator); + return SetKeyFlag(key, bForwarded, MSG_FLAG_FORWARDED, instigator); } -nsresult nsMsgDatabase::MarkHasAttachments(MessageKey messageKey, PRBool bHasAttachments, +nsresult nsMsgDatabase::MarkHasAttachments(nsMsgKey key, PRBool bHasAttachments, nsIDBChangeListener *instigator) { - return SetKeyFlag(messageKey, bHasAttachments, MSG_FLAG_ATTACHMENT, instigator); + return SetKeyFlag(key, bHasAttachments, MSG_FLAG_ATTACHMENT, instigator); } -nsresult nsMsgDatabase::MarkMarked(MessageKey messageKey, PRBool mark, +nsresult nsMsgDatabase::MarkMarked(nsMsgKey key, PRBool mark, nsIDBChangeListener *instigator) { - return SetKeyFlag(messageKey, mark, MSG_FLAG_MARKED, instigator); + return SetKeyFlag(key, mark, MSG_FLAG_MARKED, instigator); } -nsresult nsMsgDatabase::MarkOffline(MessageKey messageKey, PRBool offline, +nsresult nsMsgDatabase::MarkOffline(nsMsgKey key, PRBool offline, nsIDBChangeListener *instigator) { - return SetKeyFlag(messageKey, offline, MSG_FLAG_OFFLINE, instigator); + return SetKeyFlag(key, offline, MSG_FLAG_OFFLINE, instigator); } -nsresult nsMsgDatabase::MarkImapDeleted(MessageKey messageKey, PRBool deleted, +nsresult nsMsgDatabase::MarkImapDeleted(nsMsgKey key, PRBool deleted, nsIDBChangeListener *instigator) { - return SetKeyFlag(messageKey, deleted, MSG_FLAG_IMAP_DELETED, instigator); + return SetKeyFlag(key, deleted, MSG_FLAG_IMAP_DELETED, instigator); } -nsresult nsMsgDatabase::MarkMDNNeeded(MessageKey messageKey, PRBool bNeeded, +nsresult nsMsgDatabase::MarkMDNNeeded(nsMsgKey key, PRBool bNeeded, nsIDBChangeListener *instigator /* = NULL */) { - return SetKeyFlag(messageKey, bNeeded, MSG_FLAG_MDN_REPORT_NEEDED, instigator); + return SetKeyFlag(key, bNeeded, MSG_FLAG_MDN_REPORT_NEEDED, instigator); } -nsresult nsMsgDatabase::IsMDNNeeded(MessageKey messageKey, PRBool *pNeeded) +nsresult nsMsgDatabase::IsMDNNeeded(nsMsgKey key, PRBool *pNeeded) { nsresult err = NS_OK; nsMsgHdr *msgHdr ; - err = GetMsgHdrForKey(messageKey, &msgHdr); + err = GetMsgHdrForKey(key, &msgHdr); if (err == NS_OK && msgHdr != NULL && pNeeded) { - *pNeeded = ((msgHdr->GetFlags() & MSG_FLAG_MDN_REPORT_NEEDED) == MSG_FLAG_MDN_REPORT_NEEDED); + PRUint32 flags; + (void)msgHdr->GetFlags(&flags); + *pNeeded = ((flags & MSG_FLAG_MDN_REPORT_NEEDED) == MSG_FLAG_MDN_REPORT_NEEDED); msgHdr->Release(); return err; } @@ -768,22 +788,24 @@ nsresult nsMsgDatabase::IsMDNNeeded(MessageKey messageKey, PRBool *pNeeded) } -nsresult nsMsgDatabase::MarkMDNSent(MessageKey messageKey, PRBool bSent, +nsresult nsMsgDatabase::MarkMDNSent(nsMsgKey key, PRBool bSent, nsIDBChangeListener *instigator /* = NULL */) { - return SetKeyFlag(messageKey, bSent, MSG_FLAG_MDN_REPORT_SENT, instigator); + return SetKeyFlag(key, bSent, MSG_FLAG_MDN_REPORT_SENT, instigator); } -nsresult nsMsgDatabase::IsMDNSent(MessageKey messageKey, PRBool *pSent) +nsresult nsMsgDatabase::IsMDNSent(nsMsgKey key, PRBool *pSent) { nsresult err = NS_OK; nsMsgHdr *msgHdr; - err = GetMsgHdrForKey(messageKey, &msgHdr); + err = GetMsgHdrForKey(key, &msgHdr); if (err == NS_OK && msgHdr != NULL && pSent) { - *pSent = msgHdr->GetFlags() & MSG_FLAG_MDN_REPORT_SENT; + PRUint32 flags; + (void)msgHdr->GetFlags(&flags); + *pSent = flags & MSG_FLAG_MDN_REPORT_SENT; msgHdr->Release(); return err; } @@ -794,19 +816,21 @@ nsresult nsMsgDatabase::IsMDNSent(MessageKey messageKey, PRBool *pSent) } -nsresult nsMsgDatabase::SetKeyFlag(MessageKey messageKey, PRBool set, PRInt32 flag, +nsresult nsMsgDatabase::SetKeyFlag(nsMsgKey key, PRBool set, PRInt32 flag, nsIDBChangeListener *instigator) { nsresult err = NS_OK; nsMsgHdr *msgHdr; - err = GetMsgHdrForKey(messageKey, &msgHdr); + err = GetMsgHdrForKey(key, &msgHdr); if (err != NS_OK || msgHdr == NULL) return NS_MSG_MESSAGE_NOT_FOUND; SetHdrFlag(msgHdr, set, flag); - NotifyKeyChangeAll(msgHdr->GetMessageKey(), msgHdr->GetFlags(), instigator); + PRUint32 flags; + (void)msgHdr->GetFlags(&flags); + NotifyKeyChangeAll(key, flags, instigator); msgHdr->Release(); return err; @@ -822,13 +846,14 @@ PRBool nsMsgDatabase::SetHdrFlag(nsMsgHdr *msgHdr, PRBool bSet, MsgFlags flag) if ((flagAlreadySet && !bSet) || (!flagAlreadySet && bSet)) { + PRUint32 resultFlags; if (bSet) { - msgHdr->OrFlags(flag); + msgHdr->OrFlags(flag, &resultFlags); } else { - msgHdr->AndFlags(~flag); + msgHdr->AndFlags(~flag, &resultFlags); } return PR_TRUE; } @@ -877,8 +902,11 @@ nsresult nsMsgDatabase::MarkAllRead(nsMsgKeyArray *thoseMarked) break; } - if (thoseMarked) - thoseMarked->Add(pHeader->GetMessageKey()); + if (thoseMarked) { + nsMsgKey key; + (void)pHeader->GetMessageKey(&key); + thoseMarked->Add(key); + } dbErr = MarkHdrRead(pHeader, PR_TRUE, NULL); // ### dmb - blow off error? numChanged++; pHeader->Release(); @@ -913,16 +941,19 @@ nsresult nsMsgDatabase::MarkReadByDate (time_t startDate, time_t endDate, nsMsgK } else if (dbErr != NS_OK) break; - time_t headerDate = pHeader->GetDate(); + time_t headerDate; + (void)pHeader->GetDate(&headerDate); if (headerDate > startDate && headerDate <= endDate) { PRBool isRead; - IsRead(pHeader->GetMessageKey(), &isRead); + nsMsgKey key; + (void)pHeader->GetMessageKey(&key); + IsRead(key, &isRead); if (!isRead) { numChanged++; if (markedIds) - markedIds->Add(pHeader->GetMessageKey()); + markedIds->Add(key); MarkHdrRead(pHeader, PR_TRUE, NULL); // ### dmb - blow off error? } } @@ -933,12 +964,12 @@ nsresult nsMsgDatabase::MarkReadByDate (time_t startDate, time_t endDate, nsMsgK return dbErr; } -nsresult nsMsgDatabase::MarkLater(MessageKey messageKey, time_t until) +nsresult nsMsgDatabase::MarkLater(nsMsgKey key, time_t *until) { PR_ASSERT(m_dbFolderInfo); if (m_dbFolderInfo != NULL) { - m_dbFolderInfo->AddLaterKey(messageKey, until); + m_dbFolderInfo->AddLaterKey(key, until); } return NS_OK; } @@ -958,7 +989,11 @@ void nsMsgDatabase::ClearNewList(PRBool notify /* = FALSE */) err = GetMsgHdrForKey(firstMember, &msgHdr); if (err == NS_OK && msgHdr != NULL) { - NotifyKeyChangeAll(msgHdr->GetMessageKey(), msgHdr->GetFlags(), NULL); + nsMsgKey key; + (void)msgHdr->GetMessageKey(&key); + PRUint32 flags; + (void)msgHdr->GetFlags(&flags); + NotifyKeyChangeAll(key, flags, NULL); msgHdr->Release(); } } @@ -973,14 +1008,14 @@ PRBool nsMsgDatabase::HasNew() return m_newSet && m_newSet->getLength() > 0; } -MessageKey nsMsgDatabase::GetFirstNew() +nsMsgKey nsMsgDatabase::GetFirstNew() { // even though getLength is supposedly for debugging only, it's the only // way I can tell if the set is empty (as opposed to having a member 0. if (HasNew()) return m_newSet->GetFirstMember(); else - return MSG_MESSAGEKEYNONE; + return nsMsgKey_None; } @@ -1110,7 +1145,7 @@ nsresult nsMsgDatabase::ListNextUnread(ListContext **pContext, nsMsgHdr **pResul return dbErr; } -nsresult nsMsgDatabase::CreateNewHdr(MessageKey key, nsMsgHdr **pnewHdr) +nsresult nsMsgDatabase::CreateNewHdr(nsMsgKey key, nsMsgHdr **pnewHdr) { nsresult err = NS_OK; mdbRow *hdrRow; @@ -1200,7 +1235,9 @@ nsresult nsMsgDatabase::GetMsgHdrStructFromnsMsgHdr(nsMsgHdr *msgHdr, MessageHdr err = RowCellColumnTonsString(msgHdr->GetMDBRow(), m_referencesColumnToken, hdrStruct.m_references); err = RowCellColumnTonsString(msgHdr->GetMDBRow(), m_recipientsColumnToken, hdrStruct.m_recipients); err = RowCellColumnToUInt32(msgHdr->GetMDBRow(), m_messageSizeColumnToken, &hdrStruct.m_messageSize); - hdrStruct.m_messageKey = msgHdr->GetMessageKey(); + nsMsgKey key; + (void)msgHdr->GetMessageKey(&key); + hdrStruct.m_messageKey = key; } return err; } diff --git a/mailnews/db/msgdb/src/nsMsgHdr.cpp b/mailnews/db/msgdb/src/nsMsgHdr.cpp index e37c6ed67af..22085b3df07 100644 --- a/mailnews/db/msgdb/src/nsMsgHdr.cpp +++ b/mailnews/db/msgdb/src/nsMsgHdr.cpp @@ -1,4 +1,4 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * The contents of this file are subject to the Netscape Public License * Version 1.0 (the "NPL"); you may not use this file except in @@ -20,9 +20,29 @@ #include "nsMsgHdr.h" #include "nsMsgDatabase.h" -nsMsgHdr::nsMsgHdr(nsMsgDatabase *db, mdbRow *dbRow) +NS_IMPL_ADDREF(nsMsgHdr) +NS_IMPL_RELEASE(nsMsgHdr) + +NS_IMETHODIMP +nsMsgHdr::QueryInterface(REFNSIID iid, void** result) { - mRefCnt = 1; + if (! result) + return NS_ERROR_NULL_POINTER; + + *result = nsnull; + if(iid.Equals(nsIMessage::IID()) || + iid.Equals(::nsISupports::IID())) { + *result = NS_STATIC_CAST(nsIMessage*, this); + AddRef(); + return NS_OK; + } + return nsRDFResource::QueryInterface(iid, result); +} + +nsMsgHdr::nsMsgHdr(nsMsgDatabase *db, mdbRow *dbRow) + : nsRDFResource(nsnull) +{ + NS_INIT_REFCNT(); m_mdb = db; m_mdbRow = dbRow; Init(); @@ -31,7 +51,7 @@ nsMsgHdr::nsMsgHdr(nsMsgDatabase *db, mdbRow *dbRow) void nsMsgHdr::Init() { m_statusOffset = -1; - m_messageKey = MSG_MESSAGEKEYNONE; + m_messageKey = nsMsgKey_None; m_csID = 0; } @@ -47,57 +67,59 @@ nsMsgHdr::~nsMsgHdr() } } -// ref counting methods - if we inherit from nsISupports, we won't need these, -// and we can take advantage of the nsISupports ref-counting tracing methods -nsrefcnt nsMsgHdr::AddRef(void) +NS_IMETHODIMP nsMsgHdr::GetMessageKey(nsMsgKey *result) { - return ++mRefCnt; -} - -nsrefcnt nsMsgHdr::Release(void) -{ - NS_PRECONDITION(0 != mRefCnt, "dup release"); - if (--mRefCnt == 0) - { - delete this; - return 0; - } - return mRefCnt; -} - -MessageKey nsMsgHdr::GetMessageKey() -{ - if (m_messageKey == MSG_MESSAGEKEYNONE && m_mdbRow != NULL) + if (m_messageKey == nsMsgKey_None && m_mdbRow != NULL) { mdbOid outOid; if (m_mdbRow->GetOid(m_mdb->GetEnv(), &outOid) == NS_OK) m_messageKey = outOid.mOid_Id; } - return m_messageKey; + *result = m_messageKey; + return NS_OK; } -void nsMsgHdr::SetFlags(PRUint32 flags) +NS_IMETHODIMP nsMsgHdr::GetThreadId(nsMsgKey *result) +{ + return NS_ERROR_NOT_IMPLEMENTED; +} + +NS_IMETHODIMP nsMsgHdr::SetMessageKey(nsMsgKey value) +{ + return NS_ERROR_NOT_IMPLEMENTED; +} + +NS_IMETHODIMP nsMsgHdr::GetFlags(PRUint32 *result) +{ + *result = m_flags; + return NS_OK; +} + +NS_IMETHODIMP nsMsgHdr::SetFlags(PRUint32 flags) { m_flags = flags; SetUInt32Column(m_mdb->m_flagsColumnToken, m_flags); + return NS_OK; } -PRUint32 nsMsgHdr::OrFlags(PRUint32 flags) +NS_IMETHODIMP nsMsgHdr::OrFlags(PRUint32 flags, PRUint32 *result) { if ((m_flags & flags) != flags) SetFlags (m_flags | flags); - return m_flags; + *result = m_flags; + return NS_OK; } -PRUint32 nsMsgHdr::AndFlags(PRUint32 flags) +NS_IMETHODIMP nsMsgHdr::AndFlags(PRUint32 flags, PRUint32 *result) { if ((m_flags & flags) != m_flags) SetFlags (m_flags & flags); - return m_flags; + *result = m_flags; + return NS_OK; } -nsresult nsMsgHdr::GetProperty(const char *propertyName, nsString &resultProperty) +NS_IMETHODIMP nsMsgHdr::GetProperty(const char *propertyName, nsString &resultProperty) { nsresult err = NS_OK; mdb_token property_token; @@ -109,7 +131,7 @@ nsresult nsMsgHdr::GetProperty(const char *propertyName, nsString &resultPropert return err; } -nsresult nsMsgHdr::SetProperty(const char *propertyName, nsString &propertyStr) +NS_IMETHODIMP nsMsgHdr::SetProperty(const char *propertyName, nsString &propertyStr) { nsresult err = NS_OK; mdb_token property_token; @@ -126,7 +148,7 @@ nsresult nsMsgHdr::SetProperty(const char *propertyName, nsString &propertyStr) return err; } -nsresult nsMsgHdr::GetUint32Property(const char *propertyName, PRUint32 *pResult) +NS_IMETHODIMP nsMsgHdr::GetUint32Property(const char *propertyName, PRUint32 *pResult) { nsresult err = NS_OK; mdb_token property_token; @@ -138,88 +160,110 @@ nsresult nsMsgHdr::GetUint32Property(const char *propertyName, PRUint32 *pResult return err; } - -uint16 nsMsgHdr::GetNumReferences() +NS_IMETHODIMP nsMsgHdr::SetUint32Property(const char *propertyName, PRUint32 value) { - return 0; + return NS_ERROR_NOT_IMPLEMENTED; } -nsresult nsMsgHdr::GetStringReference(PRInt32 refNum, nsString &resultReference) + +NS_IMETHODIMP nsMsgHdr::GetNumReferences(PRUint16 *result) +{ + *result = 0; + return NS_OK; +} + +NS_IMETHODIMP nsMsgHdr::GetStringReference(PRInt32 refNum, nsString &resultReference) { nsresult err = NS_OK; return err; } -time_t nsMsgHdr::GetDate() +NS_IMETHODIMP nsMsgHdr::GetDate(time_t *result) { - return m_date; + *result = m_date; + return NS_OK; } -nsresult nsMsgHdr::SetMessageId(const char *messageId) +NS_IMETHODIMP nsMsgHdr::SetMessageId(const char *messageId) { return SetStringColumn(messageId, m_mdb->m_messageIdColumnToken); } -nsresult nsMsgHdr::SetSubject(const char *subject) +NS_IMETHODIMP nsMsgHdr::SetSubject(const char *subject) { return SetStringColumn(subject, m_mdb->m_subjectColumnToken); } -nsresult nsMsgHdr::SetAuthor(const char *author) +NS_IMETHODIMP nsMsgHdr::SetAuthor(const char *author) { return SetStringColumn(author, m_mdb->m_senderColumnToken); } -nsresult nsMsgHdr::SetReferences(const char *references) +NS_IMETHODIMP nsMsgHdr::SetReferences(const char *references) { return SetStringColumn(references, m_mdb->m_referencesColumnToken); } -nsresult nsMsgHdr::SetRecipients(const char *recipients, PRBool rfc822 /* = PR_TRUE */) +NS_IMETHODIMP nsMsgHdr::SetRecipients(const char *recipients, PRBool rfc822 /* = PR_TRUE */) { // need to put in rfc822 address parsing code here (or make caller do it...) return SetStringColumn(recipients, m_mdb->m_recipientsColumnToken); } -nsresult nsMsgHdr::SetCCList(const char *ccList) +NS_IMETHODIMP nsMsgHdr::SetCCList(const char *ccList) { return SetStringColumn(ccList, m_mdb->m_ccListColumnToken); } -void nsMsgHdr::SetMessageSize(PRUint32 messageSize) +NS_IMETHODIMP nsMsgHdr::SetMessageSize(PRUint32 messageSize) { SetUInt32Column(m_mdb->m_messageSizeColumnToken, messageSize); + return NS_OK; } -void nsMsgHdr::SetLineCount(PRUint32 lineCount) +NS_IMETHODIMP nsMsgHdr::SetLineCount(PRUint32 lineCount) { SetUInt32Column(m_mdb->m_numLinesColumnToken, lineCount); + return NS_OK; } -nsresult nsMsgHdr::SetStatusOffset(PRUint32 statusOffset) +NS_IMETHODIMP nsMsgHdr::SetStatusOffset(PRUint32 statusOffset) { return SetUInt32Column(m_mdb->m_statusOffsetColumnToken, statusOffset); } -nsresult nsMsgHdr::SetDate(time_t date) +NS_IMETHODIMP nsMsgHdr::SetDate(time_t date) { - return SetUInt32Column(m_mdb->m_dateColumnToken, (PRUint32) date); + return SetUInt32Column(m_mdb->m_dateColumnToken, (PRUint32) date); } -PRUint32 nsMsgHdr::GetStatusOffset() +NS_IMETHODIMP nsMsgHdr::GetStatusOffset(PRUint32 *result) { PRUint32 offset; nsresult res = GetUInt32Column(m_mdb->m_statusOffsetColumnToken, &offset); - return offset; + *result = offset; + return res; } -void nsMsgHdr::SetPriority(const char *priority) +NS_IMETHODIMP nsMsgHdr::SetPriority(nsMsgPriority priority) +{ + m_priority = priority; + return NS_OK; +} + +NS_IMETHODIMP nsMsgHdr::GetMessageOffset(PRUint32 *result) +{ + *result = m_messageKey; + return NS_OK; +} + +NS_IMETHODIMP nsMsgHdr::SetPriority(const char *priority) { // ### TODO // m_priority = MSG_GetPriorityFromString(priority); - m_priority = MSG_NormalPriority; + return SetPriority(nsMsgPriority_Normal); } nsresult nsMsgHdr::SetStringColumn(const char *str, mdb_token token) diff --git a/mailnews/local/src/nsMSGFolderDataSource.cpp b/mailnews/local/src/nsMSGFolderDataSource.cpp index a296d0448a6..63e0d561253 100644 --- a/mailnews/local/src/nsMSGFolderDataSource.cpp +++ b/mailnews/local/src/nsMSGFolderDataSource.cpp @@ -37,20 +37,8 @@ #include "nsFileSpec.h" #include "nsMsgFolderFlags.h" -static NS_DEFINE_IID(kIRDFMSGFolderDataSourceIID, NS_IRDFMSGFOLDERDATASOURCE_IID); -static NS_DEFINE_IID(kIRDFDataSourceIID, NS_IRDFDATASOURCE_IID); -static NS_DEFINE_IID(kIRDFServiceIID, NS_IRDFSERVICE_IID); -static NS_DEFINE_IID(kIRDFResourceFactoryIID, NS_IRDFRESOURCEFACTORY_IID); static NS_DEFINE_CID(kRDFServiceCID, NS_RDFSERVICE_CID); static NS_DEFINE_CID(kRDFInMemoryDataSourceCID, NS_RDFINMEMORYDATASOURCE_CID); -static NS_DEFINE_IID(kIMsgFolderIID, NS_IMSGFOLDER_IID); -static NS_DEFINE_IID(kIMsgLocalMailFolderIID, NS_IMSGLOCALMAILFOLDER_IID); -static NS_DEFINE_IID(kIRDFArcsOutCursorIID, NS_IRDFARCSOUTCURSOR_IID); -static NS_DEFINE_IID(kIRDFAssertionCursorIID, NS_IRDFASSERTIONCURSOR_IID); -static NS_DEFINE_IID(kIRDFCursorIID, NS_IRDFCURSOR_IID); -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); -static NS_DEFINE_IID(kIRDFNodeIID, NS_IRDFNODE_IID); - nsIRDFResource* nsMSGFolderDataSource::kNC_Child; nsIRDFResource* nsMSGFolderDataSource::kNC_Folder; @@ -146,7 +134,7 @@ nsMSGFolderDataSource::nsMSGFolderDataSource() mObservers = nsnull; nsresult rv = nsServiceManager::GetService(kRDFServiceCID, - kIRDFServiceIID, + nsIRDFService::IID(), (nsISupports**) &gRDFService); PR_ASSERT(NS_SUCCEEDED(rv)); @@ -179,7 +167,7 @@ nsMSGFolderDataSource::~nsMSGFolderDataSource (void) } -NS_IMPL_ISUPPORTS(nsMSGFolderDataSource, kIRDFMSGFolderDataSourceIID); +NS_IMPL_ISUPPORTS(nsMSGFolderDataSource, nsIRDFMSGFolderDataSource::IID()); // nsIRDFDataSource methods NS_IMETHODIMP nsMSGFolderDataSource::Init(const char* uri) @@ -192,8 +180,6 @@ NS_IMETHODIMP nsMSGFolderDataSource::Init(const char* uri) nsresult rv; - nsIRDFResourceFactory *folderFactory; - if (! kNC_Child) { gRDFService->GetResource(kURINC_child, &kNC_Child); gRDFService->GetResource(kURINC_Folder, &kNC_Folder); @@ -203,7 +189,7 @@ NS_IMETHODIMP nsMSGFolderDataSource::Init(const char* uri) //create the folder for the root folder nsIMsgFolder *rootFolder; - if(NS_SUCCEEDED(kNC_MSGFolderRoot->QueryInterface(kIMsgFolderIID, (void**)&rootFolder))) + if(NS_SUCCEEDED(kNC_MSGFolderRoot->QueryInterface(nsIMsgFolder::IID(), (void**)&rootFolder))) { if(rootFolder) { @@ -246,7 +232,7 @@ NS_IMETHODIMP nsMSGFolderDataSource::GetTarget(nsIRDFResource* source, return NS_ERROR_RDF_NO_VALUE; nsIMsgFolder* folder; - if (NS_SUCCEEDED(source->QueryInterface(kIMsgFolderIID, (void**) &folder))) + if (NS_SUCCEEDED(source->QueryInterface(nsIMsgFolder::IID(), (void**) &folder))) { nsresult rv; @@ -286,7 +272,7 @@ NS_IMETHODIMP nsMSGFolderDataSource::GetTargets(nsIRDFResource* source, nsresult rv = NS_ERROR_FAILURE; nsIMsgFolder* folder; - if(NS_SUCCEEDED(source->QueryInterface(kIMsgFolderIID, (void**)&folder))) + if(NS_SUCCEEDED(source->QueryInterface(nsIMsgFolder::IID(), (void**)&folder))) { if (peq(kNC_Child, property)) @@ -456,7 +442,7 @@ nsMSGFolderDataSource::InitLocalFolders(nsIMsgFolder* aParentFolder, nsNativeFil PR_Free(fileurl); - if(NS_SUCCEEDED(resource->QueryInterface(kIMsgFolderIID, (void**)&folder))) + if(NS_SUCCEEDED(resource->QueryInterface(nsIMsgFolder::IID(), (void**)&folder))) { char * folderName; @@ -464,7 +450,7 @@ nsMSGFolderDataSource::InitLocalFolders(nsIMsgFolder* aParentFolder, nsNativeFil folder->SetName(folderName); nsIMsgLocalMailFolder *mailFolder; - if(NS_SUCCEEDED(folder->QueryInterface(kIMsgLocalMailFolderIID, (void**)&mailFolder))) + if(NS_SUCCEEDED(folder->QueryInterface(nsIMsgLocalMailFolder::IID(), (void**)&mailFolder))) { mailFolder->SetPathName(pathStr); NS_IF_RELEASE(mailFolder); @@ -495,14 +481,14 @@ nsMSGFolderDataSource::InitLocalFolders(nsIMsgFolder* aParentFolder, nsNativeFil PR_Free(fileurl); - if(NS_SUCCEEDED(resource->QueryInterface(kIMsgFolderIID, (void**)&folder))) + if(NS_SUCCEEDED(resource->QueryInterface(nsIMsgFolder::IID(), (void**)&folder))) { char * folderName; folder->GetNameFromPathName(pathStr, &folderName); folder->SetName(folderName); nsIMsgLocalMailFolder *mailFolder; - if(NS_SUCCEEDED(folder->QueryInterface(kIMsgLocalMailFolderIID, (void**)&mailFolder))) + if(NS_SUCCEEDED(folder->QueryInterface(nsIMsgLocalMailFolder::IID(), (void**)&mailFolder))) { mailFolder->SetPathName(pathStr); NS_IF_RELEASE(mailFolder); @@ -682,7 +668,7 @@ SingletonMsgFolderCursor::GetTruthValue(PRBool* aTruthValue) } -NS_IMPL_ISUPPORTS(SingletonMsgFolderCursor, kIRDFAssertionCursorIID); +NS_IMPL_ISUPPORTS(SingletonMsgFolderCursor, nsIRDFAssertionCursor::IID()); ArrayMsgFolderCursor::ArrayMsgFolderCursor(nsIRDFResource* u, nsIRDFResource* s, @@ -781,9 +767,9 @@ ArrayMsgFolderCursor::QueryInterface(REFNSIID iid, void** result) return NS_ERROR_NULL_POINTER; *result = nsnull; - if (iid.Equals(kIRDFAssertionCursorIID) || - iid.Equals(kIRDFCursorIID) || - iid.Equals(kISupportsIID)) { + if (iid.Equals(nsIRDFAssertionCursor::IID()) || + iid.Equals(::nsIRDFCursor::IID()) || + iid.Equals(::nsISupports::IID())) { *result = NS_STATIC_CAST(nsIRDFAssertionCursor*, this); AddRef(); return NS_OK; @@ -869,9 +855,9 @@ MsgFolderArcsOutCursor::QueryInterface(REFNSIID iid, void** result) return NS_ERROR_NULL_POINTER; *result = nsnull; - if (iid.Equals(kIRDFCursorIID) || - iid.Equals(kIRDFArcsOutCursorIID) || - iid.Equals(kISupportsIID)) { + if (iid.Equals(nsIRDFCursor::IID()) || + iid.Equals(nsIRDFArcsOutCursor::IID()) || + iid.Equals(::nsISupports::IID())) { *result = NS_STATIC_CAST(nsIRDFArcsOutCursor*, this); AddRef(); return NS_OK; diff --git a/mailnews/local/src/nsMailboxProtocol.cpp b/mailnews/local/src/nsMailboxProtocol.cpp index 161406cd341..04434deb208 100644 --- a/mailnews/local/src/nsMailboxProtocol.cpp +++ b/mailnews/local/src/nsMailboxProtocol.cpp @@ -31,10 +31,6 @@ #include "prerror.h" #include "prprf.h" -static NS_DEFINE_IID(kIMailboxUrlIID, NS_IMAILBOXURL_IID); -static NS_DEFINE_IID(kIStreamListenerIID, NS_ISTREAMLISTENER_IID); -static NS_DEFINE_IID(kIInputStreamIID, NS_IINPUTSTREAM_IID); - /* the output_buffer_size must be larger than the largest possible line * 2000 seems good for news * @@ -57,7 +53,7 @@ static NS_DEFINE_IID(kIInputStreamIID, NS_IINPUTSTREAM_IID); /* the following macros actually implement addref, release and query interface for our component. */ NS_IMPL_ADDREF(nsMailboxProtocol) NS_IMPL_RELEASE(nsMailboxProtocol) -NS_IMPL_QUERY_INTERFACE(nsMailboxProtocol, kIStreamListenerIID); /* we need to pass in the interface ID of this interface */ +NS_IMPL_QUERY_INTERFACE(nsMailboxProtocol, nsIStreamListener::IID()); /* we need to pass in the interface ID of this interface */ nsMailboxProtocol::nsMailboxProtocol(nsIURL * aURL, nsITransport * transportLayer) { @@ -97,7 +93,7 @@ void nsMailboxProtocol::Initialize(nsIURL * aURL, nsITransport * transportLayer) if (aURL) { - nsresult rv = aURL->QueryInterface(kIMailboxUrlIID, (void **)&m_runningUrl); + nsresult rv = aURL->QueryInterface(nsIMailboxUrl::IID(), (void **)&m_runningUrl); if (NS_SUCCEEDED(rv) && m_runningUrl) { // okay, now fill in our event sinks...Note that each getter ref counts before @@ -251,7 +247,7 @@ PRInt32 nsMailboxProtocol::SendData(const char * dataBuffer) // notify the consumer that data has arrived // HACK ALERT: this should really be m_runningUrl once we have NNTP url support... nsIInputStream *inputStream = NULL; - m_outputStream->QueryInterface(kIInputStreamIID , (void **) &inputStream); + m_outputStream->QueryInterface(nsIInputStream::IID() , (void **) &inputStream); if (inputStream) { m_outputConsumer->OnDataAvailable(m_runningUrl, inputStream, writeCount); @@ -283,7 +279,7 @@ PRInt32 nsMailboxProtocol::LoadURL(nsIURL * aURL) rv = aURL->GetProtocol(&protocol); NS_ASSERTION(protocol && PL_strcmp(protocol, "mailbox") == 0, "this is not a mailbox url!"); - rv = aURL->QueryInterface(kIMailboxUrlIID, (void **) &mailboxUrl); + rv = aURL->QueryInterface(nsIMailboxUrl::IID(), (void **) &mailboxUrl); if (NS_SUCCEEDED(rv) && mailboxUrl) { NS_IF_RELEASE(m_runningUrl); diff --git a/mailnews/local/src/nsMailboxUrl.cpp b/mailnews/local/src/nsMailboxUrl.cpp index 0ca978d9be3..f2faf1ff072 100644 --- a/mailnews/local/src/nsMailboxUrl.cpp +++ b/mailnews/local/src/nsMailboxUrl.cpp @@ -34,11 +34,6 @@ #include "prprf.h" #include "nsCRT.h" -static NS_DEFINE_IID(kIOutputStreamIID, NS_IOUTPUTSTREAM_IID); -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); -static NS_DEFINE_IID(kIMailboxURLIID, NS_IMAILBOXURL_IID); -static NS_DEFINE_IID(kIURLIID, NS_IURL_IID); - nsMailboxUrl::nsMailboxUrl(nsISupports* aContainer, nsIURLGroup* aGroup) { NS_INIT_REFCNT(); @@ -93,18 +88,17 @@ nsresult nsMailboxUrl::QueryInterface(const nsIID &aIID, void** aInstancePtr) return NS_ERROR_NULL_POINTER; } - static NS_DEFINE_IID(kINetlibURLIID, NS_INETLIBURL_IID); - if (aIID.Equals(kIMailboxURLIID) || aIID.Equals(kISupportsIID)) { + if (aIID.Equals(nsIMailboxUrl::IID()) || aIID.Equals(::nsISupports::IID())) { *aInstancePtr = (void*) ((nsIMailboxUrl*)this); NS_ADDREF_THIS(); return NS_OK; } - if (aIID.Equals(kIURLIID)) { + if (aIID.Equals(nsIURL::IID())) { *aInstancePtr = (void*) ((nsIURL*)this); NS_ADDREF_THIS(); return NS_OK; } - if (aIID.Equals(kINetlibURLIID)) { + if (aIID.Equals(nsINetlibURL::IID())) { *aInstancePtr = (void*) ((nsINetlibURL*)this); NS_ADDREF_THIS(); return NS_OK; @@ -489,7 +483,7 @@ PRBool nsMailboxUrl::Equals(const nsIURL* aURL) const NS_LOCK_INSTANCE(); // are they both mailbox urls?? if yes...for now just compare the pointers until // I figure out if we need to check any of the guts for equality.... - if (((nsIURL*)aURL)->QueryInterface(kIMailboxURLIID, (void**)&other) == NS_OK) { + if (((nsIURL*)aURL)->QueryInterface(nsIMailboxUrl::IID(), (void**)&other) == NS_OK) { bIsEqual = other == this; // compare the pointers... } else diff --git a/mailnews/local/src/nsParseMailbox.cpp b/mailnews/local/src/nsParseMailbox.cpp index 045fe0bf597..07d7a8be491 100644 --- a/mailnews/local/src/nsParseMailbox.cpp +++ b/mailnews/local/src/nsParseMailbox.cpp @@ -1,4 +1,4 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- * * The contents of this file are subject to the Netscape Public License * Version 1.0 (the "NPL"); you may not use this file except in @@ -27,14 +27,10 @@ #include "libi18n.h" #include "nsIMailboxUrl.h" -static NS_DEFINE_IID(kIStreamListenerIID, NS_ISTREAMLISTENER_IID); -static NS_DEFINE_IID(kIInputStreamIID, NS_IINPUTSTREAM_IID); -static NS_DEFINE_IID(kIMailboxURLIID, NS_IMAILBOXURL_IID); - /* the following macros actually implement addref, release and query interface for our component. */ NS_IMPL_ADDREF(nsMsgMailboxParser) NS_IMPL_RELEASE(nsMsgMailboxParser) -NS_IMPL_QUERY_INTERFACE(nsMsgMailboxParser, kIStreamListenerIID); /* we need to pass in the interface ID of this interface */ +NS_IMPL_QUERY_INTERFACE(nsMsgMailboxParser, nsIStreamListener::IID()); /* we need to pass in the interface ID of this interface */ NS_BEGIN_EXTERN_C @@ -45,7 +41,7 @@ nsresult NS_NewMsgParser(nsIStreamListener ** aInstancePtr) { nsMsgMailboxParser * parser = new nsMsgMailboxParser(); if (parser) - rv =parser->QueryInterface(kIStreamListenerIID, (void **) aInstancePtr); + rv =parser->QueryInterface(nsIStreamListener::IID(), (void **) aInstancePtr); } return rv; @@ -71,7 +67,7 @@ NS_IMETHODIMP nsMsgMailboxParser::OnStartBinding(nsIURL* aURL, const char *aCont nsIMailboxUrl *runningUrl; printf("\n+++ nsMsgMailboxParserStub::OnStartBinding: URL: %p, Content type: %s\n", aURL, aContentType); - nsresult rv = aURL->QueryInterface(kIMailboxURLIID, (void **)&runningUrl); + nsresult rv = aURL->QueryInterface(nsIMailboxUrl::IID(), (void **)&runningUrl); if (NS_SUCCEEDED(rv) && runningUrl) { // okay, now fill in our event sinks...Note that each getter ref counts before @@ -238,11 +234,15 @@ PRInt32 nsMsgMailboxParser::PublishMsgHeader() if (m_newMsgHdr) { FolderTypeSpecificTweakMsgHeader(m_newMsgHdr); - - if (m_newMsgHdr->GetFlags() & MSG_FLAG_EXPUNGED) + + PRUint32 flags; + (void)m_newMsgHdr->GetFlags(&flags); + if (flags & MSG_FLAG_EXPUNGED) { nsDBFolderInfo *folderInfo = m_mailDB->GetDBFolderInfo(); - folderInfo->m_expungedBytes += m_newMsgHdr->GetMessageSize(); + PRUint32 size; + (void)m_newMsgHdr->GetMessageSize(&size); + folderInfo->m_expungedBytes += size; if (m_newMsgHdr) { m_newMsgHdr->Release();; @@ -557,7 +557,7 @@ void nsParseMailMessageState::GetAggregateHeader (nsVoidArray &list, struct mess { header = (struct message_header*) list.ElementAt(i); length += (header->length + 1); //+ for "," - NS_ASSERTION(header->length == XP_STRLEN(header->value), "header corrupted"); + NS_ASSERTION(header->length == (PRInt32)XP_STRLEN(header->value), "header corrupted"); } if (length > 0) @@ -865,7 +865,9 @@ int nsParseMailMessageState::InternSubject (struct message_header *header) /* strip "Re: " */ if (msg_StripRE((const char **) &key, &L)) { - m_newMsgHdr->SetFlags(m_newMsgHdr->GetFlags() | MSG_FLAG_HAS_RE); + PRUint32 flags; + (void)m_newMsgHdr->GetFlags(&flags); + m_newMsgHdr->SetFlags(flags | MSG_FLAG_HAS_RE); } // if (!*key) return 0; /* To catch a subject of "Re:" */ @@ -932,7 +934,7 @@ int nsParseMailMessageState::FinalizeHeaders() const char *s; PRUint32 flags = 0; PRUint32 delta = 0; - MSG_PRIORITY priorityFlags = MSG_PriorityNotSet; + nsMsgPriority priorityFlags = nsMsgPriority_NotSet; if (!m_mailDB) // if we don't have a valid db, skip the header. return 0; @@ -974,7 +976,7 @@ int nsParseMailMessageState::FinalizeHeaders() } // strip off and remember priority bits. flags &= ~MSG_FLAG_RUNTIME_ONLY; - priorityFlags = (MSG_PRIORITY) ((flags & MSG_FLAG_PRIORITIES) >> 13); + priorityFlags = (nsMsgPriority) ((flags & MSG_FLAG_PRIORITIES) >> 13); flags &= ~MSG_FLAG_PRIORITIES; /* We trust the X-Mozilla-Status line to be the smartest in almost all things. One exception, however, is the HAS_RE flag. Since @@ -1004,24 +1006,29 @@ int nsParseMailMessageState::FinalizeHeaders() nsresult ret = m_mailDB->CreateNewHdr(m_envelope_pos, &m_newMsgHdr); if (ret == NS_OK && m_newMsgHdr) { - if (m_newMsgHdr->GetFlags() & MSG_FLAG_HAS_RE) + PRUint32 origFlags; + (void)m_newMsgHdr->GetFlags(&origFlags); + if (origFlags & MSG_FLAG_HAS_RE) flags |= MSG_FLAG_HAS_RE; else flags &= ~MSG_FLAG_HAS_RE; - if (mdn_dnt && !(m_newMsgHdr->GetFlags() & MSG_FLAG_READ) && - !(m_newMsgHdr->GetFlags() & MSG_FLAG_MDN_REPORT_SENT)) + if (mdn_dnt && !(origFlags & MSG_FLAG_READ) && + !(origFlags & MSG_FLAG_MDN_REPORT_SENT)) flags |= MSG_FLAG_MDN_REPORT_NEEDED; m_newMsgHdr->SetFlags(flags); - if (priorityFlags != MSG_PriorityNotSet) + if (priorityFlags != nsMsgPriority_NotSet) m_newMsgHdr->SetPriority(priorityFlags); if (delta < 0xffff) { /* Only use if fits in 16 bits. */ m_newMsgHdr->SetStatusOffset((PRUint16) delta); - if (!m_IgnoreXMozillaStatus) // imap doesn't care about X-MozillaStatus - NS_ASSERTION(m_newMsgHdr->GetStatusOffset() < 10000, "invalid status offset"); /* ### Debugging hack */ + if (!m_IgnoreXMozillaStatus) { // imap doesn't care about X-MozillaStatus + PRUint32 offset; + (void)m_newMsgHdr->GetStatusOffset(&offset); + NS_ASSERTION(offset < 10000, "invalid status offset"); /* ### Debugging hack */ + } } m_newMsgHdr->SetAuthor(sender->value); if (recipient == &m_newsgroups) @@ -1089,26 +1096,28 @@ int nsParseMailMessageState::FinalizeHeaders() if (!mozstatus && statush) { /* Parse a little bit of the Berkeley Mail status header. */ - for (s = statush->value; *s; s++) - switch (*s) - { - case 'R': case 'r': - m_newMsgHdr->SetFlags(m_newMsgHdr->GetFlags() | MSG_FLAG_READ); - break; - case 'D': case 'd': - /* msg->flags |= MSG_FLAG_EXPUNGED; ### Is this reasonable? */ - break; - case 'N': case 'n': - case 'U': case 'u': - m_newMsgHdr->SetFlags(m_newMsgHdr->GetFlags() & ~MSG_FLAG_READ); - break; - } + for (s = statush->value; *s; s++) { + PRUint32 flags; + (void)m_newMsgHdr->GetFlags(&flags); + switch (*s) + { + case 'R': case 'r': + m_newMsgHdr->SetFlags(flags | MSG_FLAG_READ); + break; + case 'D': case 'd': + /* msg->flags |= MSG_FLAG_EXPUNGED; ### Is this reasonable? */ + break; + case 'N': case 'n': + case 'U': case 'u': + m_newMsgHdr->SetFlags(flags & ~MSG_FLAG_READ); + break; + } + } } if (references != NULL) m_newMsgHdr->SetReferences(references->value); - if (date) - { + if (date) { time_t resDate = 0; PRTime resultTime, intermediateResult, microSecondsPerSecond; PRStatus status = PR_ParseTimeString (date->value, PR_FALSE, &resultTime); @@ -1125,8 +1134,8 @@ int nsParseMailMessageState::FinalizeHeaders() } if (priority) m_newMsgHdr->SetPriority(priority->value); - else if (priorityFlags == MSG_PriorityNotSet) - m_newMsgHdr->SetPriority(MSG_NoPriority); + else if (priorityFlags == nsMsgPriority_NotSet) + m_newMsgHdr->SetPriority(nsMsgPriority_None); } } else @@ -1667,7 +1676,7 @@ void ParseNewMailState::ApplyFilters(PRBool *pMoved) msgHdr->OrFlags(kWatched); break; case acChangePriority: - m_mailDB->SetPriority(msgHdr, * ((MSG_PRIORITY *) &value)); + m_mailDB->SetPriority(msgHdr, * ((nsMsgPriority *) &value)); break; default: break; @@ -1849,7 +1858,7 @@ int ParseIMAPMailboxState::MoveIncorporatedMessage(nsMsgHdr *mailHdr, MSG_FolderInfoMail *destMailFolder = destinationFolder->GetMailFolderInfo(); // put the header into the source db, since it needs to be there when we copy it // and we need a valid header to pass to StartAsyncCopyMessagesInto - MessageKey keyToFilter = mailHdr->GetMessageKey(); + nsMsgKey keyToFilter = mailHdr->GetMessageKey(); if (sourceDB && destMailFolder) { diff --git a/mailnews/local/src/nsPop3Protocol.cpp b/mailnews/local/src/nsPop3Protocol.cpp index 069557ea68d..191623880e0 100644 --- a/mailnews/local/src/nsPop3Protocol.cpp +++ b/mailnews/local/src/nsPop3Protocol.cpp @@ -26,10 +26,6 @@ #include "plstr.h" #include "MailNewsTypes.h" -static NS_DEFINE_IID(kIInputStreamIID, NS_IINPUTSTREAM_IID); -static NS_DEFINE_IID(kIStreamListenerIID, NS_ISTREAMLISTENER_IID); -static NS_DEFINE_IID(kIPop3URLIID, NS_IPOP3URL_IID); - #if 1 // This is a temporary thing. @@ -368,7 +364,7 @@ void KillPopData(char* data) NS_IMPL_ADDREF(nsPop3Protocol) NS_IMPL_RELEASE(nsPop3Protocol) -NS_IMPL_QUERY_INTERFACE(nsPop3Protocol, kIStreamListenerIID) +NS_IMPL_QUERY_INTERFACE(nsPop3Protocol, nsIStreamListener::IID()) NS_IMETHODIMP nsPop3Protocol::OnDataAvailable(nsIURL* aURL, nsIInputStream* aInputStream, @@ -492,7 +488,7 @@ nsPop3Protocol::Load(nsIURL* aURL) if (aURL) { - rv = aURL->QueryInterface(kIPop3URLIID, (void **) &pop3URL); + rv = aURL->QueryInterface(nsIPop3URL::IID(), (void **) &pop3URL); if (NS_SUCCEEDED(rv) && pop3URL) { // replace our old url with the new one... @@ -800,7 +796,7 @@ nsPop3Protocol::SendCommand(const char * command) if (NS_SUCCEEDED(rv) && write_count == PL_strlen(command)) { nsIInputStream *inputStream = NULL; - m_outputStream->QueryInterface(kIInputStreamIID, (void **) + m_outputStream->QueryInterface(nsIInputStream::IID(), (void **) &inputStream); if (inputStream) { diff --git a/mailnews/local/src/nsPop3Sink.cpp b/mailnews/local/src/nsPop3Sink.cpp index 88c2b6a7807..980b1776925 100644 --- a/mailnews/local/src/nsPop3Sink.cpp +++ b/mailnews/local/src/nsPop3Sink.cpp @@ -39,9 +39,7 @@ # endif /* XP_WIN */ #endif /* XP_MAC */ -static NS_DEFINE_IID(kIPop3SinkIID, NS_IPOP3SINK_IID); - -NS_IMPL_ISUPPORTS(nsPop3Sink, kIPop3SinkIID); +NS_IMPL_ISUPPORTS(nsPop3Sink, nsIPop3Sink::IID()); nsPop3Sink::nsPop3Sink() { diff --git a/mailnews/local/src/nsPop3URL.cpp b/mailnews/local/src/nsPop3URL.cpp index 2b7fb4e61c9..f0c6cd85dbd 100644 --- a/mailnews/local/src/nsPop3URL.cpp +++ b/mailnews/local/src/nsPop3URL.cpp @@ -33,11 +33,6 @@ #include "prprf.h" #include "nsCRT.h" -static NS_DEFINE_IID(kIOutputStreamIID, NS_IOUTPUTSTREAM_IID); -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); -static NS_DEFINE_IID(kIPop3URLIID, NS_IPOP3URL_IID); -static NS_DEFINE_IID(kIURLIID, NS_IURL_IID); - nsPop3URL::nsPop3URL(nsISupports* aContainer, nsIURLGroup* aGroup) { NS_INIT_REFCNT(); @@ -91,18 +86,17 @@ nsresult nsPop3URL::QueryInterface(const nsIID &aIID, void** aInstancePtr) return NS_ERROR_NULL_POINTER; } - static NS_DEFINE_IID(kINetlibURLIID, NS_INETLIBURL_IID); - if (aIID.Equals(kIPop3URLIID) || aIID.Equals(kISupportsIID)) { + if (aIID.Equals(nsIPop3URL::IID()) || aIID.Equals(::nsISupports::IID())) { *aInstancePtr = (void*) ((nsIPop3URL*)this); AddRef(); return NS_OK; } - if (aIID.Equals(kIURLIID)) { + if (aIID.Equals(nsIURL::IID())) { *aInstancePtr = (void*) ((nsIURL*)this); AddRef(); return NS_OK; } - if (aIID.Equals(kINetlibURLIID)) { + if (aIID.Equals(nsINetlibURL::IID())) { *aInstancePtr = (void*) ((nsINetlibURL*)this); AddRef(); return NS_OK; @@ -563,7 +557,7 @@ PRBool nsPop3URL::Equals(const nsIURL* aURL) const NS_LOCK_INSTANCE(); // are they both Pop3 urls?? if yes...for now just compare the pointers until // I figure out if we need to check any of the guts for equality.... - if (((nsIURL*)aURL)->QueryInterface(kIPop3URLIID, (void**)&other) == NS_OK) { + if (((nsIURL*)aURL)->QueryInterface(nsIPop3URL::IID(), (void**)&other) == NS_OK) { bIsEqual = other == this; // compare the pointers... } else diff --git a/mailnews/local/tests/pop3/pop3Test.cpp b/mailnews/local/tests/pop3/pop3Test.cpp index 01af7603f56..f37d631fc36 100644 --- a/mailnews/local/tests/pop3/pop3Test.cpp +++ b/mailnews/local/tests/pop3/pop3Test.cpp @@ -72,15 +72,9 @@ ///////////////////////////////////////////////////////////////////////////////// // Define keys for all of the interfaces we are going to require for this test ///////////////////////////////////////////////////////////////////////////////// -static NS_DEFINE_IID(kNetServiceCID, NS_NETSERVICE_CID); -static NS_DEFINE_IID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID); -static NS_DEFINE_IID(kIInputStreamIID, NS_IINPUTSTREAM_IID); -static NS_DEFINE_IID(kIURLIID, NS_IURL_IID); -static NS_DEFINE_IID(kIPop3UrlIID, NS_IPOP3URL_IID); -static NS_DEFINE_IID(kIPop3SinkIID, NS_IPOP3SINK_IID); - -static NS_DEFINE_IID(kIEventQueueServiceIID, NS_IEVENTQUEUESERVICE_IID); +static NS_DEFINE_CID(kNetServiceCID, NS_NETSERVICE_CID); +static NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID); ///////////////////////////////////////////////////////////////////////////////// // Define default values to be used to drive the test @@ -404,7 +398,7 @@ nsresult NS_NewPop3URL(nsIPop3URL ** aResult, const nsString urlSpec) if (pop3URL) { pop3URL->ParseURL(urlSpec); // load the spec we were given... - rv = pop3URL->QueryInterface(kIPop3UrlIID, (void **) aResult); + rv = pop3URL->QueryInterface(nsIPop3URL::IID(), (void **) aResult); } return rv; @@ -820,7 +814,7 @@ int main() // Create the Event Queue for this thread... nsIEventQueueService *pEventQService = nsnull; result = nsServiceManager::GetService(kEventQueueServiceCID, - kIEventQueueServiceIID, + nsIEventQueueService::IID(), (nsISupports **)&pEventQService); if (NS_SUCCEEDED(result)) { // XXX: What if this fails? diff --git a/mailnews/mime/cthandlers/calendar/mimexpcom.cpp b/mailnews/mime/cthandlers/calendar/mimexpcom.cpp index 7a9a0b81422..d841868b59e 100644 --- a/mailnews/mime/cthandlers/calendar/mimexpcom.cpp +++ b/mailnews/mime/cthandlers/calendar/mimexpcom.cpp @@ -18,7 +18,6 @@ #include "nsRepository.h" #include "nsMimeObjectClassAccess.h" -static NS_DEFINE_IID(kIMimeObjectClassAccessIID, NS_IMIME_OBJECT_CLASS_ACCESS_IID); static NS_DEFINE_CID(kMimeObjectClassAccessCID, NS_MIME_OBJECT_CLASS_ACCESS_CID); /* @@ -32,7 +31,7 @@ COM_GetmimeInlineTextClass(void) void *ptr = NULL; int res = nsRepository::CreateInstance(kMimeObjectClassAccessCID, - NULL, kIMimeObjectClassAccessIID, + NULL, nsIMimeObjectClassAccess::IID(), (void **) &objAccess); if (res == NS_OK && objAccess) { @@ -50,7 +49,7 @@ COM_GetmimeLeafClass(void) void *ptr = NULL; int res = nsRepository::CreateInstance(kMimeObjectClassAccessCID, - NULL, kIMimeObjectClassAccessIID, + NULL, nsIMimeObjectClassAccess::IID(), (void **) &objAccess); if (res == NS_OK && objAccess) { @@ -68,7 +67,7 @@ COM_GetmimeObjectClass(void) void *ptr = NULL; int res = nsRepository::CreateInstance(kMimeObjectClassAccessCID, - NULL, kIMimeObjectClassAccessIID, + NULL, nsIMimeObjectClassAccess::IID(), (void **) &objAccess); if (res == NS_OK && objAccess) { @@ -86,7 +85,7 @@ COM_GetmimeContainerClass(void) void *ptr = NULL; int res = nsRepository::CreateInstance(kMimeObjectClassAccessCID, - NULL, kIMimeObjectClassAccessIID, + NULL, nsIMimeObjectClassAccess::IID(), (void **) &objAccess); if (res == NS_OK && objAccess) { @@ -104,7 +103,7 @@ COM_GetmimeMultipartClass(void) void *ptr = NULL; int res = nsRepository::CreateInstance(kMimeObjectClassAccessCID, - NULL, kIMimeObjectClassAccessIID, + NULL, nsIMimeObjectClassAccess::IID(), (void **) &objAccess); if (res == NS_OK && objAccess) { @@ -122,7 +121,7 @@ COM_GetmimeMultipartSignedClass(void) void *ptr = NULL; int res = nsRepository::CreateInstance(kMimeObjectClassAccessCID, - NULL, kIMimeObjectClassAccessIID, + NULL, nsIMimeObjectClassAccess::IID(), (void **) &objAccess); if (res == NS_OK && objAccess) { @@ -141,7 +140,7 @@ COM_MimeObject_write(void *mimeObject, char *data, PRInt32 length, int rc = -1; int res = nsRepository::CreateInstance(kMimeObjectClassAccessCID, - NULL, kIMimeObjectClassAccessIID, + NULL, nsIMimeObjectClassAccess::IID(), (void **) &objAccess); if (res == NS_OK && objAccess) { @@ -170,4 +169,4 @@ COM_MimeObject_write(void *mimeObject, char *data, PRInt32 length, "mime.dll", PR_FALSE, PR_FALSE); -*/ \ No newline at end of file +*/ diff --git a/mailnews/mime/cthandlers/glue/mimexpcom.cpp b/mailnews/mime/cthandlers/glue/mimexpcom.cpp index 7a9a0b81422..d841868b59e 100644 --- a/mailnews/mime/cthandlers/glue/mimexpcom.cpp +++ b/mailnews/mime/cthandlers/glue/mimexpcom.cpp @@ -18,7 +18,6 @@ #include "nsRepository.h" #include "nsMimeObjectClassAccess.h" -static NS_DEFINE_IID(kIMimeObjectClassAccessIID, NS_IMIME_OBJECT_CLASS_ACCESS_IID); static NS_DEFINE_CID(kMimeObjectClassAccessCID, NS_MIME_OBJECT_CLASS_ACCESS_CID); /* @@ -32,7 +31,7 @@ COM_GetmimeInlineTextClass(void) void *ptr = NULL; int res = nsRepository::CreateInstance(kMimeObjectClassAccessCID, - NULL, kIMimeObjectClassAccessIID, + NULL, nsIMimeObjectClassAccess::IID(), (void **) &objAccess); if (res == NS_OK && objAccess) { @@ -50,7 +49,7 @@ COM_GetmimeLeafClass(void) void *ptr = NULL; int res = nsRepository::CreateInstance(kMimeObjectClassAccessCID, - NULL, kIMimeObjectClassAccessIID, + NULL, nsIMimeObjectClassAccess::IID(), (void **) &objAccess); if (res == NS_OK && objAccess) { @@ -68,7 +67,7 @@ COM_GetmimeObjectClass(void) void *ptr = NULL; int res = nsRepository::CreateInstance(kMimeObjectClassAccessCID, - NULL, kIMimeObjectClassAccessIID, + NULL, nsIMimeObjectClassAccess::IID(), (void **) &objAccess); if (res == NS_OK && objAccess) { @@ -86,7 +85,7 @@ COM_GetmimeContainerClass(void) void *ptr = NULL; int res = nsRepository::CreateInstance(kMimeObjectClassAccessCID, - NULL, kIMimeObjectClassAccessIID, + NULL, nsIMimeObjectClassAccess::IID(), (void **) &objAccess); if (res == NS_OK && objAccess) { @@ -104,7 +103,7 @@ COM_GetmimeMultipartClass(void) void *ptr = NULL; int res = nsRepository::CreateInstance(kMimeObjectClassAccessCID, - NULL, kIMimeObjectClassAccessIID, + NULL, nsIMimeObjectClassAccess::IID(), (void **) &objAccess); if (res == NS_OK && objAccess) { @@ -122,7 +121,7 @@ COM_GetmimeMultipartSignedClass(void) void *ptr = NULL; int res = nsRepository::CreateInstance(kMimeObjectClassAccessCID, - NULL, kIMimeObjectClassAccessIID, + NULL, nsIMimeObjectClassAccess::IID(), (void **) &objAccess); if (res == NS_OK && objAccess) { @@ -141,7 +140,7 @@ COM_MimeObject_write(void *mimeObject, char *data, PRInt32 length, int rc = -1; int res = nsRepository::CreateInstance(kMimeObjectClassAccessCID, - NULL, kIMimeObjectClassAccessIID, + NULL, nsIMimeObjectClassAccess::IID(), (void **) &objAccess); if (res == NS_OK && objAccess) { @@ -170,4 +169,4 @@ COM_MimeObject_write(void *mimeObject, char *data, PRInt32 length, "mime.dll", PR_FALSE, PR_FALSE); -*/ \ No newline at end of file +*/ diff --git a/mailnews/mime/cthandlers/vcard/mimexpcom.cpp b/mailnews/mime/cthandlers/vcard/mimexpcom.cpp index 7a9a0b81422..d841868b59e 100644 --- a/mailnews/mime/cthandlers/vcard/mimexpcom.cpp +++ b/mailnews/mime/cthandlers/vcard/mimexpcom.cpp @@ -18,7 +18,6 @@ #include "nsRepository.h" #include "nsMimeObjectClassAccess.h" -static NS_DEFINE_IID(kIMimeObjectClassAccessIID, NS_IMIME_OBJECT_CLASS_ACCESS_IID); static NS_DEFINE_CID(kMimeObjectClassAccessCID, NS_MIME_OBJECT_CLASS_ACCESS_CID); /* @@ -32,7 +31,7 @@ COM_GetmimeInlineTextClass(void) void *ptr = NULL; int res = nsRepository::CreateInstance(kMimeObjectClassAccessCID, - NULL, kIMimeObjectClassAccessIID, + NULL, nsIMimeObjectClassAccess::IID(), (void **) &objAccess); if (res == NS_OK && objAccess) { @@ -50,7 +49,7 @@ COM_GetmimeLeafClass(void) void *ptr = NULL; int res = nsRepository::CreateInstance(kMimeObjectClassAccessCID, - NULL, kIMimeObjectClassAccessIID, + NULL, nsIMimeObjectClassAccess::IID(), (void **) &objAccess); if (res == NS_OK && objAccess) { @@ -68,7 +67,7 @@ COM_GetmimeObjectClass(void) void *ptr = NULL; int res = nsRepository::CreateInstance(kMimeObjectClassAccessCID, - NULL, kIMimeObjectClassAccessIID, + NULL, nsIMimeObjectClassAccess::IID(), (void **) &objAccess); if (res == NS_OK && objAccess) { @@ -86,7 +85,7 @@ COM_GetmimeContainerClass(void) void *ptr = NULL; int res = nsRepository::CreateInstance(kMimeObjectClassAccessCID, - NULL, kIMimeObjectClassAccessIID, + NULL, nsIMimeObjectClassAccess::IID(), (void **) &objAccess); if (res == NS_OK && objAccess) { @@ -104,7 +103,7 @@ COM_GetmimeMultipartClass(void) void *ptr = NULL; int res = nsRepository::CreateInstance(kMimeObjectClassAccessCID, - NULL, kIMimeObjectClassAccessIID, + NULL, nsIMimeObjectClassAccess::IID(), (void **) &objAccess); if (res == NS_OK && objAccess) { @@ -122,7 +121,7 @@ COM_GetmimeMultipartSignedClass(void) void *ptr = NULL; int res = nsRepository::CreateInstance(kMimeObjectClassAccessCID, - NULL, kIMimeObjectClassAccessIID, + NULL, nsIMimeObjectClassAccess::IID(), (void **) &objAccess); if (res == NS_OK && objAccess) { @@ -141,7 +140,7 @@ COM_MimeObject_write(void *mimeObject, char *data, PRInt32 length, int rc = -1; int res = nsRepository::CreateInstance(kMimeObjectClassAccessCID, - NULL, kIMimeObjectClassAccessIID, + NULL, nsIMimeObjectClassAccess::IID(), (void **) &objAccess); if (res == NS_OK && objAccess) { @@ -170,4 +169,4 @@ COM_MimeObject_write(void *mimeObject, char *data, PRInt32 length, "mime.dll", PR_FALSE, PR_FALSE); -*/ \ No newline at end of file +*/ diff --git a/mailnews/mime/src/nsMimeFactory.cpp b/mailnews/mime/src/nsMimeFactory.cpp index 92a93bed214..3e566b52b96 100644 --- a/mailnews/mime/src/nsMimeFactory.cpp +++ b/mailnews/mime/src/nsMimeFactory.cpp @@ -21,18 +21,15 @@ #include "nsISupports.h" #include "nsRepository.h" -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); -static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID); - /* * Include all of the headers/defines for interfaces the libmime factory can * generate components for */ #include "nsRFC822toHTMLStreamConverter.h" -static NS_DEFINE_IID(kCMimeRFC822HTMLConverterCID, NS_RFC822_HTML_STREAM_CONVERTER_CID); +static NS_DEFINE_CID(kCMimeRFC822HTMLConverterCID, NS_RFC822_HTML_STREAM_CONVERTER_CID); #include "nsMimeObjectClassAccess.h" -static NS_DEFINE_IID(kCMimeMimeObjectClassAccessCID, NS_MIME_OBJECT_CLASS_ACCESS_CID); +static NS_DEFINE_CID(kCMimeMimeObjectClassAccessCID, NS_MIME_OBJECT_CLASS_ACCESS_CID); //////////////////////////////////////////////////////////// // @@ -79,9 +76,9 @@ nsresult nsMimeFactory::QueryInterface(const nsIID &aIID, void **aResult) *aResult = NULL; // we support two interfaces....nsISupports and nsFactory..... - if (aIID.Equals(kISupportsIID)) + if (aIID.Equals(::nsISupports::IID())) *aResult = (void *)(nsISupports*)this; - else if (aIID.Equals(kIFactoryIID)) + else if (aIID.Equals(nsIFactory::IID())) *aResult = (void *)(nsIFactory*)this; if (*aResult == NULL) @@ -163,7 +160,7 @@ extern "C" NS_EXPORT nsresult NSGetFactory(const nsCID &aClass, *aFactory = new nsMimeFactory(aClass); if (aFactory) - return (*aFactory)->QueryInterface(kIFactoryIID, (void**)aFactory); // they want a Factory Interface so give it to them + return (*aFactory)->QueryInterface(nsIFactory::IID(), (void**)aFactory); // they want a Factory Interface so give it to them else return NS_ERROR_OUT_OF_MEMORY; } diff --git a/mailnews/mime/src/nsMimeObjectClassAccess.cpp b/mailnews/mime/src/nsMimeObjectClassAccess.cpp index 3a65044b368..0076dd84982 100644 --- a/mailnews/mime/src/nsMimeObjectClassAccess.cpp +++ b/mailnews/mime/src/nsMimeObjectClassAccess.cpp @@ -22,11 +22,6 @@ #include "nsISupports.h" #include "nsMimeObjectClassAccess.h" -/* - * These macros are used to define a class IID for our component. - */ -static NS_DEFINE_IID(kIMimeObjectClassAccess, NS_IMIME_OBJECT_CLASS_ACCESS_IID); - /* * This function will be used by the factory to generate an * mime object class object.... @@ -41,7 +36,7 @@ nsresult NS_NewMimeObjectClassAccess(nsIMimeObjectClassAccess ** aInstancePtrRes { nsMimeObjectClassAccess *obj = new nsMimeObjectClassAccess(); if (obj) - return obj->QueryInterface(kIMimeObjectClassAccess, (void**) aInstancePtrResult); + return obj->QueryInterface(nsIMimeObjectClassAccess::IID(), (void**) aInstancePtrResult); else return NS_ERROR_OUT_OF_MEMORY; /* we couldn't allocate the object */ } @@ -55,7 +50,7 @@ nsresult NS_NewMimeObjectClassAccess(nsIMimeObjectClassAccess ** aInstancePtrRes */ NS_IMPL_ADDREF(nsMimeObjectClassAccess) NS_IMPL_RELEASE(nsMimeObjectClassAccess) -NS_IMPL_QUERY_INTERFACE(nsMimeObjectClassAccess, kIMimeObjectClassAccess); /* we need to pass in the interface ID of this interface */ +NS_IMPL_QUERY_INTERFACE(nsMimeObjectClassAccess, nsIMimeObjectClassAccess::IID()); /* we need to pass in the interface ID of this interface */ /* * nsMimeObjectClassAccess definitions.... diff --git a/mailnews/mime/src/nsRFC822toHTMLStreamConverter.cpp b/mailnews/mime/src/nsRFC822toHTMLStreamConverter.cpp index e746d9ff04e..ce3e694cd4a 100644 --- a/mailnews/mime/src/nsRFC822toHTMLStreamConverter.cpp +++ b/mailnews/mime/src/nsRFC822toHTMLStreamConverter.cpp @@ -20,13 +20,6 @@ #include "nsIStreamConverter.h" #include "nsRFC822toHTMLStreamConverter.h" -/* - * These macros are used to define a class IID for our component. Our - * object currently supports the nsRFC822toHTMLStreamConverter so we want - * to define constants for these two interfaces - */ -static NS_DEFINE_IID(kIStreamConverter, NS_ISTREAM_CONVERTER_IID); - /* * This function will be used by the factory to generate an * RFC822 Converter.... @@ -40,7 +33,7 @@ nsresult NS_NewRFC822HTMLConverter(nsIStreamConverter** aInstancePtrResult) { nsRFC822toHTMLStreamConverter *converter = new nsRFC822toHTMLStreamConverter(); if (converter) - return converter->QueryInterface(kIStreamConverter, (void**) aInstancePtrResult); + return converter->QueryInterface(nsIStreamConverter::IID(), (void**) aInstancePtrResult); else return NS_ERROR_OUT_OF_MEMORY; /* we couldn't allocate the object */ } @@ -55,7 +48,7 @@ nsresult NS_NewRFC822HTMLConverter(nsIStreamConverter** aInstancePtrResult) */ NS_IMPL_ADDREF(nsRFC822toHTMLStreamConverter) NS_IMPL_RELEASE(nsRFC822toHTMLStreamConverter) -NS_IMPL_QUERY_INTERFACE(nsRFC822toHTMLStreamConverter, kIStreamConverter); /* we need to pass in the interface ID of this interface */ +NS_IMPL_QUERY_INTERFACE(nsRFC822toHTMLStreamConverter, nsIStreamConverter::IID()); /* we need to pass in the interface ID of this interface */ /* * nsRFC822toHTMLStreamConverter definitions.... diff --git a/mailnews/mime/tests/xpcomtest/test.cpp b/mailnews/mime/tests/xpcomtest/test.cpp index ff2a3226d03..419ad26fe42 100644 --- a/mailnews/mime/tests/xpcomtest/test.cpp +++ b/mailnews/mime/tests/xpcomtest/test.cpp @@ -3,10 +3,7 @@ #include "nsRFC822toHTMLStreamConverter.h" #include "nsMimeObjectClassAccess.h" -static NS_DEFINE_IID(kIStreamConverterIID, NS_ISTREAM_CONVERTER_IID); static NS_DEFINE_CID(kRFC822toHTMLStreamConverterCID, NS_RFC822_HTML_STREAM_CONVERTER_CID); - -static NS_DEFINE_IID(kIMimeObjectClassAccessIID, NS_IMIME_OBJECT_CLASS_ACCESS_IID); static NS_DEFINE_CID(kMimeObjectClassAccessCID, NS_MIME_OBJECT_CLASS_ACCESS_CID); /* @@ -25,7 +22,7 @@ int main(int argc, char *argv[]) "mime.dll", PR_FALSE, PR_FALSE); nsresult res = nsRepository::CreateInstance(kRFC822toHTMLStreamConverterCID, - NULL, kIStreamConverterIID, (void **) &sample); + NULL, nsIStreamConverter::IID(), (void **) &sample); if (res == NS_OK && sample) { void *stream; @@ -38,7 +35,7 @@ int main(int argc, char *argv[]) printf("Time for try the nsMimeObjectClassAccess class...\n"); res = nsRepository::CreateInstance(kMimeObjectClassAccessCID, - NULL, kIMimeObjectClassAccessIID, + NULL, nsIMimeObjectClassAccess::IID(), (void **) &objAccess); if (res == NS_OK && objAccess) { diff --git a/mailnews/news/src/nsNNTPArticleList.cpp b/mailnews/news/src/nsNNTPArticleList.cpp index 9c9e8ebd7c7..3f08b1f787d 100644 --- a/mailnews/news/src/nsNNTPArticleList.cpp +++ b/mailnews/news/src/nsNNTPArticleList.cpp @@ -24,7 +24,7 @@ /* XXX - temporary hack so this will compile */ -typedef PRUint32 MessageKey; +typedef PRUint32 nsMsgKey; class nsNNTPArticleList : nsINNTPArticleList #ifdef HAVE_CHANGELISTENER @@ -63,7 +63,7 @@ protected: #endif #endif PRInt32 m_dbIndex; - MessageKey m_highwater; + nsMsgKey m_highwater; }; NS_IMPL_ISUPPORTS(nsNNTPArticleList, IID()) @@ -92,7 +92,7 @@ nsNNTPArticleList::Init(nsINNTPHost * newsHost, nsINNTPNewsgroup *newsFolder = m_pane->GetMaster()->FindNewsFolder(host, groupName, PR_FALSE); if (newsFolder) { - char *url = newsFolder->BuildUrl(NULL, MSG_MESSAGEKEYNONE); + char *url = newsFolder->BuildUrl(NULL, nsMsgKey_None); #ifdef HAVE_NEWSDB if (url) NewsGroupDB::Open(url, m_pane->GetMaster(), &m_newsDB); diff --git a/mailnews/news/src/nsNNTPHost.cpp b/mailnews/news/src/nsNNTPHost.cpp index 2bfa30412bb..bd5349f00b3 100644 --- a/mailnews/news/src/nsNNTPHost.cpp +++ b/mailnews/news/src/nsNNTPHost.cpp @@ -74,8 +74,6 @@ extern int msg_LineBuffer (const char *net_buffer, PRInt32 net_buffer_size, void *closure); -static NS_DEFINE_IID(kINNTPHostIID, NS_INNTPHOST_IID); - class nsNNTPHost : public nsINNTPHost { public: #ifdef HAVE_MASTER @@ -2964,7 +2962,7 @@ nsNNTPHost::GroupNotFound(const char *groupName, PRBool opening) #ifdef HAVE_MASTER m_master->BroadcastFolderDeleted (newsInfo); #else - ; + ; #endif if (newsInfo) @@ -3014,7 +3012,7 @@ int nsNNTPHost::ReorderGroup (nsINNTPNewsgroup *groupToMove, nsINNTPNewsgroup *g infoList->ElementAt(idxInHostInfo); nsIMsgFolder *groupInHostInfo=NULL; - rv = hostInfoSupports->QueryInterface(nsISupports::IID(), + rv = hostInfoSupports->QueryInterface(::nsISupports::IID(), (void **)&groupInHostInfo); #ifdef HAVE_PANE if (group->CanBeInFolderPane()) @@ -3036,7 +3034,7 @@ int nsNNTPHost::ReorderGroup (nsINNTPNewsgroup *groupToMove, nsINNTPNewsgroup *g { m_groups->InsertElementAt(groupToMove, idxInData); // the index has to be the same, right? nsISupports* groupSupports; - groupToMove->QueryInterface(nsISupports::IID(), + groupToMove->QueryInterface(::nsISupports::IID(), (void **)&groupSupports); infoList->InsertElementAt (groupSupports, idxInHostInfo); NS_RELEASE(groupSupports); @@ -3089,8 +3087,8 @@ nsNNTPHost::GetNewsgroupAndNumberOfID(const char *message_id, MessageDBView *view = pane->GetMsgView(); if (!view || !view->GetDB()) return NS_ERROR_NOT_INITIALIZED; - messageKey = view->GetDB()->GetMessageKeyForID(message_id); - *messageNumber = (messageKey == MSG_MESSAGEKEYNONE) ? 0 : messageKey; + nsMsgKey = view->GetDB()->GetMessageKeyForID(message_id); + *messageNumber = (nsMsgKey == nsMsgKey_None) ? 0 : nsMsgKey; #endif /* Why are we always choosing the current pane's folder? */ diff --git a/mailnews/news/src/nsNNTPNewsgroupList.cpp b/mailnews/news/src/nsNNTPNewsgroupList.cpp index bd268b55f45..75b565d1d4e 100644 --- a/mailnews/news/src/nsNNTPNewsgroupList.cpp +++ b/mailnews/news/src/nsNNTPNewsgroupList.cpp @@ -25,6 +25,7 @@ */ #include "msgCore.h" // precompiled header... +#include "MailNewsTypes.h" #ifdef HAVE_PANES class MSG_Master; @@ -62,11 +63,6 @@ class MessageDBView; #include "msgpane.h" #endif -static NS_DEFINE_IID(kINNTPNewsgroupListIID, NS_INNTPNEWSGROUPLIST_IID); - -/* temporary hack until MessageKey is defined */ -typedef PRUint32 MessageKey; - extern "C" { extern int MK_OUT_OF_MEMORY; @@ -160,9 +156,9 @@ protected: MSG_Master *m_master; #endif - MessageKey m_lastProcessedNumber; - MessageKey m_firstMsgNumber; - MessageKey m_lastMsgNumber; + nsMsgKey m_lastProcessedNumber; + nsMsgKey m_firstMsgNumber; + nsMsgKey m_lastMsgNumber; PRInt32 m_firstMsgToDownload; PRInt32 m_lastMsgToDownload; @@ -185,7 +181,7 @@ nsNNTPNewsgroupList::~nsNNTPNewsgroupList() { } -NS_IMPL_ISUPPORTS(nsNNTPNewsgroupList, kINNTPNewsgroupListIID); +NS_IMPL_ISUPPORTS(nsNNTPNewsgroupList, nsINNTPNewsgroupList::IID()); nsresult nsNNTPNewsgroupList::InitNewsgroupList(const char *url, const char *groupName) diff --git a/mailnews/news/src/nsNNTPNewsgroupPost.cpp b/mailnews/news/src/nsNNTPNewsgroupPost.cpp index f2ff12a1e4f..55cd6df0f86 100644 --- a/mailnews/news/src/nsNNTPNewsgroupPost.cpp +++ b/mailnews/news/src/nsNNTPNewsgroupPost.cpp @@ -27,8 +27,6 @@ // for CRLF #include "fe_proto.h" -static NS_DEFINE_IID(kINNTPNewsgroupPostIID, NS_INNTPNEWSGROUPPOST_IID); - #define HEADER_FROM 0 #define HEADER_NEWSGROUPS 1 #define HEADER_SUBJECT 2 @@ -141,7 +139,7 @@ const char* nsNNTPNewsgroupPost::m_headerName[HEADER_LAST+1]= "Message-ID: ", }; -NS_IMPL_ISUPPORTS(nsNNTPNewsgroupPost, kINNTPNewsgroupPostIID); +NS_IMPL_ISUPPORTS(nsNNTPNewsgroupPost, nsINNTPNewsgroupPost::IID()); nsNNTPNewsgroupPost::nsNNTPNewsgroupPost() { @@ -305,7 +303,7 @@ nsresult NS_NewNewsgroupPost(nsINNTPNewsgroupPost **aPost) { if (!aPost) return NS_ERROR_NULL_POINTER; nsNNTPNewsgroupPost *post = new nsNNTPNewsgroupPost(); - return post->QueryInterface(kINNTPNewsgroupPostIID, + return post->QueryInterface(nsINNTPNewsgroupPost::IID(), (void **)aPost); } diff --git a/mailnews/news/src/nsNNTPProtocol.cpp b/mailnews/news/src/nsNNTPProtocol.cpp index 58f226a4367..565acbf460e 100644 --- a/mailnews/news/src/nsNNTPProtocol.cpp +++ b/mailnews/news/src/nsNNTPProtocol.cpp @@ -255,10 +255,6 @@ static char * last_username_hostname=0; /* end of globals I'd like to move somewhere else */ -static NS_DEFINE_IID(kINntpURLIID, NS_INNTPURL_IID); -static NS_DEFINE_IID(kIStreamListenerIID, NS_ISTREAMLISTENER_IID); -static NS_DEFINE_IID(kIInputStreamIID, NS_IINPUTSTREAM_IID); - nsNNTPProtocol::nsNNTPProtocol(nsIURL * aURL, nsITransport * transportLayer) { /* the following macro is used to initialize the ref counting data */ @@ -312,7 +308,7 @@ void nsNNTPProtocol::Initialize(nsIURL * aURL, nsITransport * transportLayer) if (aURL) { - nsresult rv = aURL->QueryInterface(kINntpURLIID, (void **)&m_runningURL); + nsresult rv = aURL->QueryInterface(nsINntpUrl::IID(), (void **)&m_runningURL); if (NS_SUCCEEDED(rv) && m_runningURL) { // okay, now fill in our event sinks...Note that each getter ref counts before @@ -395,7 +391,7 @@ PRInt32 nsNNTPProtocol::LoadURL(nsIURL * aURL) nsINntpUrl * nntpUrl = NULL; if (aURL) { - rv = aURL->QueryInterface(kINntpURLIID, (void **) &nntpUrl); + rv = aURL->QueryInterface(nsINntpUrl::IID(), (void **) &nntpUrl); if (NS_SUCCEEDED(rv) && nntpUrl) { // replace our old url with the new one... @@ -888,7 +884,7 @@ PRInt32 nsNNTPProtocol::ParseURL(nsIURL * aURL, char ** aHostAndPort, PRBool * b /* the following macros actually implement addref, release and query interface for our component. */ NS_IMPL_ADDREF(nsNNTPProtocol) NS_IMPL_RELEASE(nsNNTPProtocol) -NS_IMPL_QUERY_INTERFACE(nsNNTPProtocol, kIStreamListenerIID); /* we need to pass in the interface ID of this interface */ +NS_IMPL_QUERY_INTERFACE(nsNNTPProtocol, nsIStreamListener::IID()); /* we need to pass in the interface ID of this interface */ // Whenever data arrives from the connection, core netlib notifices the protocol by calling // OnDataAvailable. We then read and process the incoming data from the input stream. @@ -937,8 +933,8 @@ char *XP_AppCodeName = "Mozilla"; const char *XP_AppCodeName = "Mozilla"; #endif #define NET_IS_SPACE(x) ((((unsigned int) (x)) > 0x7f) ? 0 : isspace(x)) -typedef PRUint32 MessageKey; -const MessageKey MSG_MESSAGEKEYNONE = 0xffffffff; +typedef PRUint32 nsMsgKey; +const nsMsgKey nsMsgKey_None = 0xffffffff; /* * This function takes an error code and associated error data @@ -1112,7 +1108,7 @@ PRInt32 nsNNTPProtocol::SendData(const char * dataBuffer) // notify the consumer that data has arrived // HACK ALERT: this should really be m_runningURL once we have NNTP url support... nsIInputStream *inputStream = NULL; - m_outputStream->QueryInterface(kIInputStreamIID , (void **) &inputStream); + m_outputStream->QueryInterface(nsIInputStream::IID() , (void **) &inputStream); if (inputStream) { m_outputConsumer->OnDataAvailable(m_runningURL, inputStream, writeCount); @@ -3935,7 +3931,7 @@ PRInt32 nsNNTPProtocol::ListGroupResponse(nsIInputStream * inputStream, PRUint32 { if (line[0] != '.') { - long found_id = MSG_MESSAGEKEYNONE; + long found_id = nsMsgKey_None; nsresult rv; sscanf(line, "%ld", &found_id); diff --git a/mailnews/news/src/nsNntpUrl.cpp b/mailnews/news/src/nsNntpUrl.cpp index 0a89c53b012..bcd704fb0eb 100644 --- a/mailnews/news/src/nsNntpUrl.cpp +++ b/mailnews/news/src/nsNntpUrl.cpp @@ -33,11 +33,6 @@ #include "prprf.h" #include "nsCRT.h" -static NS_DEFINE_IID(kIOutputStreamIID, NS_IOUTPUTSTREAM_IID); -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); -static NS_DEFINE_IID(kINntpURLIID, NS_INNTPURL_IID); -static NS_DEFINE_IID(kIURLIID, NS_IURL_IID); - nsNntpUrl::nsNntpUrl(nsISupports* aContainer, nsIURLGroup* aGroup) { NS_INIT_REFCNT(); @@ -100,18 +95,17 @@ nsresult nsNntpUrl::QueryInterface(const nsIID &aIID, void** aInstancePtr) return NS_ERROR_NULL_POINTER; } - static NS_DEFINE_IID(kINetlibURLIID, NS_INETLIBURL_IID); - if (aIID.Equals(kINntpURLIID) || aIID.Equals(kISupportsIID)) { + if (aIID.Equals(nsINntpUrl::IID()) || aIID.Equals(::nsISupports::IID())) { *aInstancePtr = (void*) ((nsINntpUrl*)this); NS_ADDREF_THIS(); return NS_OK; } - if (aIID.Equals(kIURLIID)) { + if (aIID.Equals(nsIURL::IID())) { *aInstancePtr = (void*) ((nsIURL*)this); NS_ADDREF_THIS(); return NS_OK; } - if (aIID.Equals(kINetlibURLIID)) { + if (aIID.Equals(nsINetlibURL::IID())) { *aInstancePtr = (void*) ((nsINetlibURL*)this); NS_ADDREF_THIS(); return NS_OK; @@ -673,7 +667,7 @@ PRBool nsNntpUrl::Equals(const nsIURL* aURL) const NS_LOCK_INSTANCE(); // are they both Nntp urls?? if yes...for now just compare the pointers until // I figure out if we need to check any of the guts for equality.... - if (((nsIURL*)aURL)->QueryInterface(kINntpURLIID, (void**)&other) == NS_OK) { + if (((nsIURL*)aURL)->QueryInterface(nsINntpUrl::IID(), (void**)&other) == NS_OK) { bIsEqual = other == this; // compare the pointers... } else diff --git a/mailnews/news/tests/nntpTest.cpp b/mailnews/news/tests/nntpTest.cpp index 4067d5bbf01..f47c3d2e13f 100644 --- a/mailnews/news/tests/nntpTest.cpp +++ b/mailnews/news/tests/nntpTest.cpp @@ -74,14 +74,9 @@ ///////////////////////////////////////////////////////////////////////////////// // Define keys for all of the interfaces we are going to require for this test ///////////////////////////////////////////////////////////////////////////////// -static NS_DEFINE_IID(kNetServiceCID, NS_NETSERVICE_CID); -static NS_DEFINE_IID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID); -static NS_DEFINE_IID(kIInputStreamIID, NS_IINPUTSTREAM_IID); -static NS_DEFINE_IID(kIURLIID, NS_IURL_IID); -static NS_DEFINE_IID(kINntpUrlIID, NS_INNTPURL_IID); - -static NS_DEFINE_IID(kIEventQueueServiceIID, NS_IEVENTQUEUESERVICE_IID); +static NS_DEFINE_CID(kNetServiceCID, NS_NETSERVICE_CID); +static NS_DEFINE_CID(kEventQueueServiceCID, NS_EVENTQUEUESERVICE_CID); ///////////////////////////////////////////////////////////////////////////////// // Define default values to be used to drive the test @@ -114,7 +109,7 @@ nsresult NS_NewNntpUrl(nsINntpUrl ** aResult, const nsString urlSpec) if (nntpUrl) { nntpUrl->ParseURL(urlSpec); // load the spec we were given... - rv = nntpUrl->QueryInterface(kINntpUrlIID, (void **) aResult); + rv = nntpUrl->QueryInterface(nsINntpUrl::IID(), (void **) aResult); } return rv; @@ -683,7 +678,7 @@ int main() // Create the Event Queue for this thread... nsIEventQueueService *pEventQService = nsnull; result = nsServiceManager::GetService(kEventQueueServiceCID, - kIEventQueueServiceIID, + nsIEventQueueService::IID(), (nsISupports **)&pEventQService); if (NS_SUCCEEDED(result)) { // XXX: What if this fails? diff --git a/mailnews/news/tests/nsNNTPCategoryContainerStub.cpp b/mailnews/news/tests/nsNNTPCategoryContainerStub.cpp index d595e69a15f..14943381cd0 100644 --- a/mailnews/news/tests/nsNNTPCategoryContainerStub.cpp +++ b/mailnews/news/tests/nsNNTPCategoryContainerStub.cpp @@ -28,9 +28,6 @@ #include "prmem.h" #include -static NS_DEFINE_IID(kINNTPCategoryContainerIID, NS_INNTPCATEGORYCONTAINER_IID); - - class nsNNTPCategoryContainerStub : public nsISupports { public: nsNNTPCategoryContainerStub(); @@ -45,7 +42,7 @@ class nsNNTPCategoryContainerStub : public nsISupports { }; -NS_IMPL_ISUPPORTS(nsNNTPCategoryContainerStub, kINNTPCategoryContainerIID); +NS_IMPL_ISUPPORTS(nsNNTPCategoryContainerStub, nsINNTPCategoryContainer::IID()); nsNNTPCategoryContainerStub::nsNNTPCategoryContainerStub() { @@ -95,7 +92,7 @@ nsresult NS_NewCategoryContainerFromNewsgroup(nsINNTPCategoryContainer ** aInsta { stub = new nsNNTPCategoryContainerStub(); stub->SetRootCategory(group); - rv = stub->QueryInterface(kINNTPCategoryContainerIID, (void **) aInstancePtr); + rv = stub->QueryInterface(nsINNTPCategoryContainer::IID(), (void **) aInstancePtr); } return rv; diff --git a/mailnews/news/tests/nsNNTPHostStub.cpp b/mailnews/news/tests/nsNNTPHostStub.cpp index 4fcfbb8cd41..9cdc9816c89 100644 --- a/mailnews/news/tests/nsNNTPHostStub.cpp +++ b/mailnews/news/tests/nsNNTPHostStub.cpp @@ -33,9 +33,6 @@ #include "nsNNTPNewsgroupList.h" #include "nsNNTPNewsgroup.h" -static NS_DEFINE_IID(kINNTPHostIID, NS_INNTPHOST_IID); -static NS_DEFINE_IID(kINNTPNewsgroupIID, NS_INNTPNEWSGROUP_IID); - class nsNNTPHostStub : public nsINNTPHost { public: @@ -246,7 +243,7 @@ protected: }; -NS_IMPL_ISUPPORTS(nsNNTPHostStub, kINNTPHostIID); +NS_IMPL_ISUPPORTS(nsNNTPHostStub, nsINNTPHost::IID()); nsNNTPHostStub::nsNNTPHostStub(const char * name, PRInt32 port) { @@ -479,7 +476,7 @@ nsresult nsNNTPHostStub::GetFirstGroupNeedingCounts(char ** aFirstGroup) if (groupToBe) { nsINNTPNewsgroup * group = nsnull; - groupToBe->QueryInterface(kINNTPNewsgroupIID, (void **) &group); + groupToBe->QueryInterface(nsINNTPNewsgroup::IID(), (void **) &group); if (group) { group->GetName(aFirstGroup); @@ -617,7 +614,7 @@ nsresult nsNNTPHostStub::FindGroup(const char * name, nsINNTPNewsgroup ** retVal if (elem) { nsINNTPNewsgroup * group = nsnull; - elem->QueryInterface(kINNTPNewsgroupIID, (void **) &group); + elem->QueryInterface(nsINNTPNewsgroup::IID(), (void **) &group); if (group) { char * groupName = nsnull; @@ -708,7 +705,7 @@ nsresult NS_NewNNTPHost(nsINNTPHost ** aInstancePtr, const char * name, PRUint32 { nsNNTPHostStub * host = new nsNNTPHostStub(name, port); if (host) - rv =host->QueryInterface(kINNTPHostIID, (void **) aInstancePtr); + rv =host->QueryInterface(nsINNTPHost::IID(), (void **) aInstancePtr); } return rv; diff --git a/mailnews/news/tests/nsNNTPNewsgroupListStub.cpp b/mailnews/news/tests/nsNNTPNewsgroupListStub.cpp index fb94eea79ac..e0d83319321 100644 --- a/mailnews/news/tests/nsNNTPNewsgroupListStub.cpp +++ b/mailnews/news/tests/nsNNTPNewsgroupListStub.cpp @@ -33,10 +33,7 @@ #include "nsNNTPArticleSet.h" #include "nsNNTPNewsgroupList.h" -/* temporary hack until MessageKey is defined */ -typedef PRUint32 MessageKey; - -static NS_DEFINE_IID(kINNTPNewsgroupListIID, NS_INNTPNEWSGROUPLIST_IID); +#include "MailNewsTypes.h" class nsNNTPNewsgroupListStub : public nsINNTPNewsgroupList { @@ -76,9 +73,9 @@ class nsNNTPNewsgroupListStub : public nsINNTPNewsgroupList { nsINNTPHost *m_host; nsINNTPNewsgroup * m_group; - MessageKey m_lastProcessedNumber; - MessageKey m_firstMsgNumber; - MessageKey m_lastMsgNumber; + nsMsgKey m_lastProcessedNumber; + nsMsgKey m_firstMsgNumber; + nsMsgKey m_lastMsgNumber; PRInt32 m_firstMsgToDownload; PRInt32 m_lastMsgToDownload; @@ -87,7 +84,7 @@ class nsNNTPNewsgroupListStub : public nsINNTPNewsgroupList { }; -NS_IMPL_ISUPPORTS(nsNNTPNewsgroupListStub, kINNTPNewsgroupListIID); +NS_IMPL_ISUPPORTS(nsNNTPNewsgroupListStub, nsINNTPNewsgroupList::IID()); nsNNTPNewsgroupListStub::nsNNTPNewsgroupListStub(nsINNTPHost* host, nsINNTPNewsgroup *newsgroup) @@ -361,6 +358,6 @@ extern "C" nsresult NS_NewNewsgroupList(nsINNTPNewsgroupList **aInstancePtrResul { nsNNTPNewsgroupListStub * stub = nsnull; stub = new nsNNTPNewsgroupListStub(newsHost, newsgroup); - nsresult rv = stub->QueryInterface(kINNTPNewsgroupListIID, (void **) aInstancePtrResult); + nsresult rv = stub->QueryInterface(nsINNTPNewsgroupList::IID(), (void **) aInstancePtrResult); return rv; } diff --git a/mailnews/news/tests/nsNNTPNewsgroupStub.cpp b/mailnews/news/tests/nsNNTPNewsgroupStub.cpp index db35b9e8dc9..8d8c71138d4 100644 --- a/mailnews/news/tests/nsNNTPNewsgroupStub.cpp +++ b/mailnews/news/tests/nsNNTPNewsgroupStub.cpp @@ -29,8 +29,6 @@ #include "nsINNTPNewsgroup.h" #include "nsNNTPArticleSet.h" -static NS_DEFINE_IID(kINNTPNewsgroupIID, NS_INNTPNEWSGROUP_IID); - class nsNNTPNewsgroupStub : public nsINNTPNewsgroup { @@ -107,7 +105,7 @@ nsNNTPNewsgroupStub::~nsNNTPNewsgroupStub() PR_FREEIF(m_prettyName); } -NS_IMPL_ISUPPORTS(nsNNTPNewsgroupStub, kINNTPNewsgroupIID); +NS_IMPL_ISUPPORTS(nsNNTPNewsgroupStub, nsINNTPNewsgroup::IID()); nsresult nsNNTPNewsgroupStub::GetName(char ** aName) { @@ -328,7 +326,7 @@ nsresult NS_NewNewsgroup(nsINNTPNewsgroup **info, if (group) { group->SetSubscribed(subscribed); - rv = group->QueryInterface(kINNTPNewsgroupIID, (void **) info); + rv = group->QueryInterface(nsINNTPNewsgroup::IID(), (void **) info); } return rv; diff --git a/mailnews/public/MailNewsTypes.h b/mailnews/public/MailNewsTypes.h index 1f9474d086c..d7f3104d36b 100644 --- a/mailnews/public/MailNewsTypes.h +++ b/mailnews/public/MailNewsTypes.h @@ -22,90 +22,72 @@ #include "msgCore.h" #include "prtypes.h" -/* MessageKey is a unique ID for a particular message in a folder. If you want +/* nsMsgKey is a unique ID for a particular message in a folder. If you want a handle to a message that will remain valid even after resorting the folder or otherwise changing their indices, you want one of these rather than a - MSG_ViewIndex. MessageKeys don't survive local mail folder compression, however. + nsMsgViewIndex. nsMsgKeys don't survive local mail folder compression, however. */ -typedef PRUint32 MessageKey; -const MessageKey MSG_MESSAGEKEYNONE = 0xffffffff; +typedef PRUint32 nsMsgKey; +const nsMsgKey nsMsgKey_None = 0xffffffff; -/* XP_Index +/* nsMsgViewIndex * - * A generic index type from which other index types are derived. All XP_Index + * A generic index type from which other index types are derived. All nsMsgViewIndex * derived types are zero based. * * The following index types are currently supported: - * - MSG_ViewIndex - an index into the list of messages or folders or groups, + * - nsMsgViewIndex - an index into the list of messages or folders or groups, * where zero is the first one to show, one is the second, etc... * - AB_SelectionIndex * - AB_NameCompletionIndex */ -/* I'm not sure it's correct to carry these over into Mozilla, but we can always take them out */ -typedef enum _XP_IndexType -{ - kViewIndex = 0, - kSelectionIndex, - kNameCompletionIndex -} XP_IndexType; +typedef PRUint32 nsMsgViewIndex; -typedef uint32 XP_Index; -typedef XP_Index MSG_ViewIndex; -typedef MSG_ViewIndex MsgViewIndex; - -/* XP_INDEXNONE and MSG_VIEWINDEXNONE are used to indicate an invalid or - * non-existent index. - */ -const XP_Index XP_INDEXNONE = 0xFFFFFFFF; -const MSG_ViewIndex MSG_VIEWINDEXNONE = 0xFFFFFFFF; +const nsMsgViewIndex nsMsgViewIndex_None = 0xFFFFFFFF; /* Message priorities as determined by X-Priority hdr, or Priority header? */ -typedef enum -{ - MSG_PriorityNotSet = 0, - MSG_NoPriority = 1, - MSG_LowestPriority, - MSG_LowPriority, - MSG_NormalPriority, - MSG_HighPriority, - MSG_HighestPriority -} MSG_PRIORITY; +enum nsMsgPriority { + nsMsgPriority_NotSet = 0, + nsMsgPriority_None = 1, + nsMsgPriority_Lowest, + nsMsgPriority_Low, + nsMsgPriority_Normal, + nsMsgPriority_High, + nsMsgPriority_Highest +}; // The following enums are all persistent in databases, so don't go changing the values! -enum nsMsgSortOrder -{ - nsMSG_SortTypeNone = 0, - nsMSG_SortTypeAscending = 1, - nsMSG_SortTypeDescending = 2 +enum nsMsgSortOrder { + nsMsgSortOrder_None = 0, + nsMsgSortOrder_Ascending = 1, + nsMsgSortOrder_Descending = 2 }; // We should be using the property name we're sorting by instead of these types. -enum nsMsgSortType -{ - nsMSG_SortByDate = 0x12, - nsMSG_SortBySubject = 0x13, - nsMSG_SortByAuthor = 0x14, - nsMSG_SortById = 0x15, - nsMSG_SortByThread = 0x16, - nsMSG_SortByPriority = 0x17, - nsMSG_SortByStatus = 0x18, - nsMSG_SortBySize = 0x19, - nsMSG_SortByFlagged = 0x1a, - nsMSG_SortByUnread = 0x1b, - nsMSG_SortByRecipient +enum nsMsgSortType { + nsMsgSortType_Date = 0x12, + nsMsgSortType_Subject = 0x13, + nsMsgSortType_Author = 0x14, + nsMsgSortType_Id = 0x15, + nsMsgSortType_Thread = 0x16, + nsMsgSortType_Priority = 0x17, + nsMsgSortType_Status = 0x18, + nsMsgSortType_Size = 0x19, + nsMsgSortType_Flagged = 0x1a, + nsMsgSortType_Unread = 0x1b, + nsMsgSortType_Recipient }; -enum nsMsgViewType -{ - nsMSG_ViewAny = 0, // this view type matches any other view type, - // for the purpose of matching cached views. - // Else, it's equivalent to ViewAllThreads - nsMSG_ViewAllThreads = 1, // default view, no killed threads - nsMSG_ViewOnlyThreadsWithNew = 2, - nsMSG_ViewOnlyNewHeaders = 4, - nsMSG_ViewWatchedThreadsWithNew = 5, - nsMSG_ViewCacheless // this would be for cacheless imap +enum nsMsgViewType { + nsMsgViewType_Any = 0, // this view type matches any other view type, + // for the purpose of matching cached views. + // Else, it's equivalent to ViewAllThreads + nsMsgViewType_AllThreads = 1, // default view, no killed threads + nsMsgViewType_OnlyThreadsWithNew = 2, + nsMsgViewType_OnlyNewHeaders = 4, + nsMsgViewType_WatchedThreadsWithNew = 5, + nsMsgViewType_Cacheless // this would be for cacheless imap }; diff --git a/mailnews/ui/messenger/src/nsJSMsgAppCore.cpp b/mailnews/ui/messenger/src/nsJSMsgAppCore.cpp index 520db86d6a1..f0cb6156b3b 100644 --- a/mailnews/ui/messenger/src/nsJSMsgAppCore.cpp +++ b/mailnews/ui/messenger/src/nsJSMsgAppCore.cpp @@ -38,12 +38,6 @@ #include "nsJSMsgAppCore.h" -static NS_DEFINE_IID(kIScriptObjectOwnerIID, NS_ISCRIPTOBJECTOWNER_IID); -static NS_DEFINE_IID(kIJSScriptObjectIID, NS_IJSSCRIPTOBJECT_IID); -static NS_DEFINE_IID(kIScriptGlobalObjectIID, NS_ISCRIPTGLOBALOBJECT_IID); -static NS_DEFINE_IID(kIMsgAppCoreIID, NS_IDOMMSGAPPCORE_IID); -static NS_DEFINE_IID(kIWindowIID, NS_IDOMWINDOW_IID); - NS_DEF_PTR(nsIDOMMsgAppCore); NS_DEF_PTR(nsIDOMWindow); @@ -290,7 +284,7 @@ MsgAppCoreSetWindow(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval if (argc >= 1) { if (JS_FALSE == nsJSUtils::nsConvertJSValToObject((nsISupports **)&b0, - kIWindowIID, + nsIWindow::IID(), "Window", cx, argv[0])) { @@ -369,8 +363,6 @@ MsgAppCore(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) nsIDOMMsgAppCore *nativeThis; nsIScriptObjectOwner *owner = nsnull; - static NS_DEFINE_IID(kIDOMMsgAppCoreIID, NS_IDOMMSGAPPCORE_IID); - result = context->GetNameSpaceManager(&manager); if (NS_OK != result) { return JS_FALSE; @@ -384,7 +376,7 @@ MsgAppCore(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) result = nsRepository::CreateInstance(classID, nsnull, - kIDOMMsgAppCoreIID, + nsIDOMMsgAppCore::IID(), (void **)&nativeThis); if (NS_OK != result) { return JS_FALSE; @@ -392,7 +384,7 @@ MsgAppCore(JSContext *cx, JSObject *obj, uintN argc, jsval *argv, jsval *rval) // XXX We should be calling Init() on the instance - result = nativeThis->QueryInterface(kIScriptObjectOwnerIID, (void **)&owner); + result = nativeThis->QueryInterface(nsIScriptObjectOwner::IID(), (void **)&owner); if (NS_OK != result) { NS_RELEASE(nativeThis); return JS_FALSE; @@ -471,7 +463,7 @@ extern "C" NS_DOM nsresult NS_NewScriptMsgAppCore(nsIScriptContext *aContext, ns if (nsnull == aParent) { parent = nsnull; } - else if (NS_OK == aParent->QueryInterface(kIScriptObjectOwnerIID, (void**)&owner)) { + else if (NS_OK == aParent->QueryInterface(nsIScriptObjectOwner::IID(), (void**)&owner)) { if (NS_OK != owner->GetScriptObject(aContext, (void **)&parent)) { NS_RELEASE(owner); return NS_ERROR_FAILURE; @@ -486,7 +478,7 @@ extern "C" NS_DOM nsresult NS_NewScriptMsgAppCore(nsIScriptContext *aContext, ns return NS_ERROR_FAILURE; } - result = aSupports->QueryInterface(kIMsgAppCoreIID, (void **)&aMsgAppCore); + result = aSupports->QueryInterface(nsIMsgAppCore::IID(), (void **)&aMsgAppCore); if (NS_OK != result) { return result; } diff --git a/mailnews/ui/messenger/src/nsMessengerFactory.cpp b/mailnews/ui/messenger/src/nsMessengerFactory.cpp index f23ea239e7d..2bf69b9091d 100644 --- a/mailnews/ui/messenger/src/nsMessengerFactory.cpp +++ b/mailnews/ui/messenger/src/nsMessengerFactory.cpp @@ -25,9 +25,7 @@ #include "pratom.h" -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); -static NS_DEFINE_IID(kIFactoryIID, NS_IFACTORY_IID); -static NS_DEFINE_IID(kCMsgAppCoreCID, NS_MSGAPPCORE_CID); +static NS_DEFINE_CID(kCMsgAppCoreCID, NS_MSGAPPCORE_CID); static PRInt32 g_InstanceCount = 0; static PRInt32 g_LockCount = 0; @@ -75,9 +73,9 @@ nsMessengerFactory::QueryInterface(const nsIID &aIID, void **aResult) *aResult = NULL; // we support two interfaces....nsISupports and nsFactory..... - if (aIID.Equals(kISupportsIID)) + if (aIID.Equals(::nsISupports::IID())) *aResult = (void *)(nsISupports*)this; - else if (aIID.Equals(kIFactoryIID)) + else if (aIID.Equals(nsIFactory::IID())) *aResult = (void *)(nsIFactory*)this; if (*aResult == NULL) @@ -142,7 +140,7 @@ NSGetFactory(const nsCID &aClass, *aFactory = new nsMessengerFactory(aClass); if (aFactory) - return (*aFactory)->QueryInterface(kIFactoryIID, (void**)aFactory); // they want a Factory Interface so give it to them + return (*aFactory)->QueryInterface(nsIFactory::IID(), (void**)aFactory); // they want a Factory Interface so give it to them else return NS_ERROR_OUT_OF_MEMORY; } diff --git a/mailnews/ui/messenger/src/nsMessengerFactory.o b/mailnews/ui/messenger/src/nsMessengerFactory.o index c8c58fbfcd9..e69de29bb2d 100644 Binary files a/mailnews/ui/messenger/src/nsMessengerFactory.o and b/mailnews/ui/messenger/src/nsMessengerFactory.o differ diff --git a/mailnews/ui/messenger/src/nsMsgAppCore.cpp b/mailnews/ui/messenger/src/nsMsgAppCore.cpp index dee282c44ff..b48c6bf1117 100644 --- a/mailnews/ui/messenger/src/nsMsgAppCore.cpp +++ b/mailnews/ui/messenger/src/nsMsgAppCore.cpp @@ -33,11 +33,6 @@ #include "nsIServiceManager.h" #include "nsIURL.h" -static NS_DEFINE_IID(kIMsgAppCoreIID, NS_IDOMMSGAPPCORE_IID); -static NS_DEFINE_IID(kIScriptObjectOwnerIID, NS_ISCRIPTOBJECTOWNER_IID); -static NS_DEFINE_IID(kIDOMBaseAppCoreIID, NS_IDOMBASEAPPCORE_IID); -static NS_DEFINE_IID(kISupportsIID, NS_ISUPPORTS_IID); - class nsMsgAppCore : public nsIDOMMsgAppCore, public nsIScriptObjectOwner { @@ -99,22 +94,22 @@ nsMsgAppCore::QueryInterface(REFNSIID aIID,void** aInstancePtr) // Always NULL result, in case of failure *aInstancePtr = NULL; - if ( aIID.Equals(kIScriptObjectOwnerIID)) { + if ( aIID.Equals(nsIScriptObjectOwner::IID())) { *aInstancePtr = (void*) ((nsIScriptObjectOwner*)this); AddRef(); return NS_OK; } - if ( aIID.Equals(kIDOMBaseAppCoreIID)) { + if ( aIID.Equals(nsIDOMBaseAppCore::IID())) { *aInstancePtr = (void*) ((nsIDOMBaseAppCore*)this); AddRef(); return NS_OK; } - else if ( aIID.Equals(kIMsgAppCoreIID) ) { + else if ( aIID.Equals(nsIMsgAppCore::IID()) ) { *aInstancePtr = (void*)(nsISupports*)(nsIScriptObjectOwner*)this; AddRef(); return NS_OK; } - else if ( aIID.Equals(kISupportsIID) ) { + else if ( aIID.Equals(::nsISupports::IID()) ) { *aInstancePtr = (void*)(nsISupports*)(nsIScriptObjectOwner*)this; AddRef(); return NS_OK; @@ -174,8 +169,7 @@ nsMsgAppCore::GetId(nsString& aId) NS_IMETHODIMP nsMsgAppCore::Open3PaneWindow() { - static NS_DEFINE_IID(kAppShellServiceCID, NS_APPSHELL_SERVICE_CID); - static NS_DEFINE_IID(kIAppShellServiceIID, NS_IAPPSHELL_SERVICE_IID); + static NS_DEFINE_CID(kAppShellServiceCID, NS_APPSHELL_SERVICE_CID); nsIAppShellService* appShell; char * urlstr=nsnull; @@ -184,7 +178,7 @@ nsMsgAppCore::Open3PaneWindow() urlstr = "resource:/res/samples/messenger.html"; rv = nsServiceManager::GetService(kAppShellServiceCID, - kIAppShellServiceIID, + nsIAppShellService::IID(), (nsISupports**)&appShell); nsIURL* url; nsIWidget* newWindow; @@ -219,7 +213,7 @@ NS_NewMsgAppCore(nsIDOMMsgAppCore **aResult) nsMsgAppCore *appcore = new nsMsgAppCore(); if (appcore) { - return appcore->QueryInterface(kIMsgAppCoreIID, + return appcore->QueryInterface(nsIMsgAppCore::IID(), (void **)aResult); }