diff --git a/mailnews/news/public/nsINNTPHost.h b/mailnews/news/public/nsINNTPHost.h index df90694cfb07..0b3e313e654b 100644 --- a/mailnews/news/public/nsINNTPHost.h +++ b/mailnews/news/public/nsINNTPHost.h @@ -7,18 +7,12 @@ #include "nsISupports.h" /* interface nsISupports */ #include "nsINNTPNewsgroup.h" /* interface nsINNTPNewsgroup */ +#include "nsID.h" /* interface nsID */ #include "nsINNTPNewsgroupList.h" /* interface nsINNTPNewsgroupList */ #ifdef XPIDL_JS_STUBS #include "jsapi.h" #endif -#include "nsDebug.h" -#include "nsTraceRefcnt.h" -#include "nsID.h" -#include "nsIID.h" -#include "nsError.h" -#include "nsISupportsUtils.h" - /* starting interface nsINNTPHost */ @@ -40,10 +34,10 @@ class nsINNTPHost : public nsISupports { NS_IMETHOD SetSupportsExtensions(PRBool aSupportsExtensions) = 0; /* void AddExtension (in string extension); */ - NS_IMETHOD AddExtension(char *extension) = 0; + NS_IMETHOD AddExtension(const char *extension) = 0; /* boolean QueryExtension (in string extension); */ - NS_IMETHOD QueryExtension(char *extension, PRBool *_retval) = 0; + NS_IMETHOD QueryExtension(const char *extension, PRBool *_retval) = 0; /* attribute boolean postingAllowed; */ NS_IMETHOD GetPostingAllowed(PRBool *aPostingAllowed) = 0; @@ -58,43 +52,43 @@ class nsINNTPHost : public nsISupports { NS_IMETHOD SetLastUpdatedTime(PRInt64 aLastUpdatedTime) = 0; /* nsINNTPNewsgroupList GetNewsgroupList (in string groupname); */ - NS_IMETHOD GetNewsgroupList(char *groupname, nsINNTPNewsgroupList **_retval) = 0; + NS_IMETHOD GetNewsgroupList(const char *groupname, nsINNTPNewsgroupList **_retval) = 0; /* nsINNTPNewsgroup FindNewsgroup (in string groupname, in boolean create); */ - NS_IMETHOD FindNewsgroup(char *groupname, PRBool create, nsINNTPNewsgroup **_retval) = 0; + NS_IMETHOD FindNewsgroup(const char *groupname, PRBool create, nsINNTPNewsgroup **_retval) = 0; /* void AddPropertyForGet (in string name, in string value); */ - NS_IMETHOD AddPropertyForGet(char *name, char *value) = 0; + NS_IMETHOD AddPropertyForGet(const char *name, const char *value) = 0; /* string QueryPropertyForGet (in string name); */ - NS_IMETHOD QueryPropertyForGet(char *name, char **_retval) = 0; + NS_IMETHOD QueryPropertyForGet(const char *name, char **_retval) = 0; /* void AddSearchableGroup (in string groupname); */ - NS_IMETHOD AddSearchableGroup(char *groupname) = 0; + NS_IMETHOD AddSearchableGroup(const char *groupname) = 0; /* boolean QuerySearchableGroup (in string groupname); */ - NS_IMETHOD QuerySearchableGroup(char *groupname, PRBool *_retval) = 0; + NS_IMETHOD QuerySearchableGroup(const char *groupname, PRBool *_retval) = 0; /* void AddVirtualGroup (in string responseText); */ - NS_IMETHOD AddVirtualGroup(char *responseText) = 0; + NS_IMETHOD AddVirtualGroup(const char *responseText) = 0; /* void SetIsVirtualGroup (in string groupname, in boolean isVirtual); */ - NS_IMETHOD SetIsVirtualGroup(char *groupname, PRBool isVirtual) = 0; + NS_IMETHOD SetIsVirtualGroup(const char *groupname, PRBool isVirtual) = 0; /* boolean GetIsVirtualGroup (in string groupname); */ - NS_IMETHOD GetIsVirtualGroup(char *groupname, PRBool *_retval) = 0; + NS_IMETHOD GetIsVirtualGroup(const char *groupname, PRBool *_retval) = 0; /* void AddSearchableHeader (in string headerName); */ - NS_IMETHOD AddSearchableHeader(char *headerName) = 0; + NS_IMETHOD AddSearchableHeader(const char *headerName) = 0; /* boolean QuerySearchableHeader (in string headerName); */ - NS_IMETHOD QuerySearchableHeader(char *headerName, PRBool *_retval) = 0; + NS_IMETHOD QuerySearchableHeader(const char *headerName, PRBool *_retval) = 0; /* void GroupNotFound (in string group, in boolean opening); */ - NS_IMETHOD GroupNotFound(char *group, PRBool opening) = 0; + NS_IMETHOD GroupNotFound(const char *group, PRBool opening) = 0; /* void AddNewNewsgroup (in string groupname, in long first, in long last, in string flags, in boolean xactiveFlags); */ - NS_IMETHOD AddNewNewsgroup(char *groupname, PRInt32 first, PRInt32 last, char *flags, PRBool xactiveFlags) = 0; + NS_IMETHOD AddNewNewsgroup(const char *groupname, PRInt32 first, PRInt32 last, const char *flags, PRBool xactiveFlags) = 0; /* long GetNumGroupsNeedingCounts (); */ NS_IMETHOD GetNumGroupsNeedingCounts(PRInt32 *_retval) = 0; @@ -103,19 +97,19 @@ class nsINNTPHost : public nsISupports { NS_IMETHOD GetFirstGroupNeedingCounts(char **_retval) = 0; /* void DisplaySubscribedGroup (in string groupname, in long first_message, in long last_message, in long total_messages, in boolean visit_now); */ - NS_IMETHOD DisplaySubscribedGroup(char *groupname, PRInt32 first_message, PRInt32 last_message, PRInt32 total_messages, PRBool visit_now) = 0; + NS_IMETHOD DisplaySubscribedGroup(const char *groupname, PRInt32 first_message, PRInt32 last_message, PRInt32 total_messages, PRBool visit_now) = 0; /* string GetFirstGroupNeedingExtraInfo (); */ NS_IMETHOD GetFirstGroupNeedingExtraInfo(char **_retval) = 0; /* void SetGroupNeedsExtraInfo (in string groupname, in boolean needsExtraInfo); */ - NS_IMETHOD SetGroupNeedsExtraInfo(char *groupname, PRBool needsExtraInfo) = 0; + NS_IMETHOD SetGroupNeedsExtraInfo(const char *groupname, PRBool needsExtraInfo) = 0; /* void GetNewsgroupAndNumberOfID (in string message_id, out nsINNTPNewsgroup group, out unsigned long message_number); */ - NS_IMETHOD GetNewsgroupAndNumberOfID(char *message_id, nsINNTPNewsgroup **group, PRUint32 *message_number) = 0; + NS_IMETHOD GetNewsgroupAndNumberOfID(const char *message_id, nsINNTPNewsgroup **group, PRUint32 *message_number) = 0; /* void SetPrettyName (in string groupName, in string prettyName); */ - NS_IMETHOD SetPrettyName(char *groupName, char *prettyName) = 0; + NS_IMETHOD SetPrettyName(const char *groupName, const char *prettyName) = 0; /* void LoadNewsrc (); */ NS_IMETHOD LoadNewsrc() = 0; @@ -134,13 +128,13 @@ class nsINNTPHost : public nsISupports { NS_IMETHOD SetNewsRCFilename(char * aNewsRCFilename) = 0; /* nsINNTPNewsgroup FindGroup (in string name); */ - NS_IMETHOD FindGroup(char *name, nsINNTPNewsgroup **_retval) = 0; + NS_IMETHOD FindGroup(const char *name, nsINNTPNewsgroup **_retval) = 0; /* nsINNTPNewsgroup AddGroup (in string groupname); */ - NS_IMETHOD AddGroup(char *groupname, nsINNTPNewsgroup **_retval) = 0; + NS_IMETHOD AddGroup(const char *groupname, nsINNTPNewsgroup **_retval) = 0; /* void RemoveGroupByName (in string groupName); */ - NS_IMETHOD RemoveGroupByName(char *groupName) = 0; + NS_IMETHOD RemoveGroupByName(const char *groupName) = 0; /* void RemoveGroup (in nsINNTPNewsgroup group); */ NS_IMETHOD RemoveGroup(nsINNTPNewsgroup *group) = 0; diff --git a/mailnews/news/public/nsINNTPHost.idl b/mailnews/news/public/nsINNTPHost.idl index 88fd45d85a8d..d7ef29baf303 100644 --- a/mailnews/news/public/nsINNTPHost.idl +++ b/mailnews/news/public/nsINNTPHost.idl @@ -19,7 +19,7 @@ #include "nsINNTPNewsgroupList.idl" #include "nsINNTPNewsgroup.idl" -[object, uuid(ADFB3740-AA57-11d2-B7ED-00805F05FFA5)] +[object, uuid(6b128da0-d74f-11d2-b7f9-00805f05ffa5)] interface nsINNTPHost : nsISupports { attribute boolean supportsExtensions; diff --git a/mailnews/news/public/nsINNTPNewsgroupList.h b/mailnews/news/public/nsINNTPNewsgroupList.h index db71acd073e5..f99c2a3044b0 100644 --- a/mailnews/news/public/nsINNTPNewsgroupList.h +++ b/mailnews/news/public/nsINNTPNewsgroupList.h @@ -6,17 +6,11 @@ #define __gen_nsINNTPNewsgroupList_h__ #include "nsISupports.h" /* interface nsISupports */ +#include "nsID.h" /* interface nsID */ #ifdef XPIDL_JS_STUBS #include "jsapi.h" #endif -#include "nsDebug.h" -#include "nsTraceRefcnt.h" -#include "nsID.h" -#include "nsIID.h" -#include "nsError.h" -#include "nsISupportsUtils.h" - /* starting interface nsINNTPNewsgroupList */ @@ -43,10 +37,10 @@ class nsINNTPNewsgroupList : public nsISupports { NS_IMETHOD InitXOVER(PRInt32 first_message, PRInt32 last_message) = 0; /* void ProcessXOVER (in string line, out long status); */ - NS_IMETHOD ProcessXOVER(char *line, PRInt32 *status) = 0; + NS_IMETHOD ProcessXOVER(const char *line, PRInt32 *status) = 0; /* void ProcessNonXOVER (in string line); */ - NS_IMETHOD ProcessNonXOVER(char *line) = 0; + NS_IMETHOD ProcessNonXOVER(const char *line) = 0; /* void ResetXOVER (); */ NS_IMETHOD ResetXOVER() = 0; diff --git a/mailnews/news/src/nsNNTPHost.cpp b/mailnews/news/src/nsNNTPHost.cpp index 866b05e65bcb..e4da31d7a1b9 100644 --- a/mailnews/news/src/nsNNTPHost.cpp +++ b/mailnews/news/src/nsNNTPHost.cpp @@ -93,8 +93,8 @@ public: NS_IMPL_CLASS_GETSET(SupportsExtensions, PRBool, m_supportsExtensions); - NS_IMETHOD AddExtension (char *ext); - NS_IMETHOD QueryExtension (char *ext, PRBool *_retval); + NS_IMETHOD AddExtension (const char *ext); + NS_IMETHOD QueryExtension (const char *ext, PRBool *_retval); NS_IMPL_CLASS_GETSET(PostingAllowed, PRBool, m_postingAllowed); @@ -103,35 +103,35 @@ public: NS_IMPL_CLASS_GETSET(LastUpdatedTime, PRInt64, m_lastGroupUpdate); - NS_IMETHOD GetNewsgroupList(char *groupname, + NS_IMETHOD GetNewsgroupList(const char *groupname, nsINNTPNewsgroupList **_retval) { NS_ASSERTION(0, "unimplemented"); return NS_OK;}; - NS_IMETHOD GetNewsgroupAndNumberOfID(char *message_id, + NS_IMETHOD GetNewsgroupAndNumberOfID(const char *message_id, nsINNTPNewsgroup **group, PRUint32 *messageNumber); /* get this from MSG_Master::FindNewsFolder */ - NS_IMETHOD FindNewsgroup(char *groupname, PRBool create, + NS_IMETHOD FindNewsgroup(const char *groupname, PRBool create, nsINNTPNewsgroup **_retval) { NS_ASSERTION(0, "unimplemented!"); return NS_OK;} - NS_IMETHOD AddPropertyForGet (char *property, char *value); - NS_IMETHOD QueryPropertyForGet (char *property, char **_retval); + NS_IMETHOD AddPropertyForGet (const char *property, const char *value); + NS_IMETHOD QueryPropertyForGet (const char *property, char **_retval); - NS_IMETHOD AddSearchableGroup(char *groupname); + NS_IMETHOD AddSearchableGroup(const char *groupname); // should these go into interfaces? - NS_IMETHOD QuerySearchableGroup (char *group, PRBool *); - NS_IMETHOD QuerySearchableGroupCharsets(char *group, char **); + NS_IMETHOD QuerySearchableGroup (const char *group, PRBool *); + NS_IMETHOD QuerySearchableGroupCharsets(const char *group, char **); // Virtual groups - NS_IMETHOD AddVirtualGroup(char *responseText) { return NS_OK;} - NS_IMETHOD SetIsVirtualGroup(char *groupname, PRBool isVirtual); - NS_IMETHOD SetIsVirtualGroup(char *groupname, PRBool isVirtual, + NS_IMETHOD AddVirtualGroup(const char *responseText) { return NS_OK;} + NS_IMETHOD SetIsVirtualGroup(const char *groupname, PRBool isVirtual); + NS_IMETHOD SetIsVirtualGroup(const char *groupname, PRBool isVirtual, nsMsgGroupRecord *inGroupRecord); - NS_IMETHOD GetIsVirtualGroup(char *groupname, PRBool *_retval); + NS_IMETHOD GetIsVirtualGroup(const char *groupname, PRBool *_retval); // custom/searchable headers - NS_IMETHOD AddSearchableHeader(char *headerName); - NS_IMETHOD QuerySearchableHeader(char *headerName, PRBool *_retval); + NS_IMETHOD AddSearchableHeader(const char *headerName); + NS_IMETHOD QuerySearchableHeader(const char *headerName, PRBool *_retval); // Go load the newsrc for this host. Creates the subscribed hosts as // children of the given nsIMsgFolder. @@ -158,21 +158,21 @@ public: // (this is what the pre-mozilla API looked like) char *GetNewsrcFileName() { return m_filename; }; - NS_IMETHOD FindGroup(char* name, nsINNTPNewsgroup* *_retval); - NS_IMETHOD AddGroup(char *groupname, + NS_IMETHOD FindGroup(const char* name, nsINNTPNewsgroup* *_retval); + NS_IMETHOD AddGroup(const char *groupname, nsINNTPNewsgroup **retval); - NS_IMETHOD AddGroup(char *groupname, + NS_IMETHOD AddGroup(const char *groupname, nsMsgGroupRecord *groupRecord, nsINNTPNewsgroup **retval); - NS_IMETHOD RemoveGroupByName(char *groupName); + NS_IMETHOD RemoveGroupByName(const char *groupName); NS_IMETHOD RemoveGroup(nsINNTPNewsgroup*); - NS_IMETHOD AddNewNewsgroup(char *groupName, + NS_IMETHOD AddNewNewsgroup(const char *groupName, PRInt32 first, PRInt32 last, - char *flags, + const char *flags, PRBool xactiveFlags); /* Name of directory to store newsgroup @@ -189,7 +189,7 @@ public: individual strings must not be free'd. */ NS_IMETHOD GetGroupList(char **_retval) { return NS_OK;} - NS_IMETHOD DisplaySubscribedGroup(char *groupname, + NS_IMETHOD DisplaySubscribedGroup(const char *groupname, PRInt32 first_message, PRInt32 last_message, PRInt32 total_messages, @@ -284,7 +284,7 @@ private: // Returns the pretty name for the given group. The resulting string // must be free'd using delete[]. char* GetPrettyName(char* groupname); - NS_IMETHOD SetPrettyName(char* groupname, char* prettyname); + NS_IMETHOD SetPrettyName(const char* groupname, const char* prettyname); time_t GetAddTime(char* groupname); @@ -294,13 +294,13 @@ private: PRBool IsCategory(char* groupname); PRBool IsCategoryContainer(char* groupname); - int SetIsCategoryContainer(char* groupname, PRBool value, nsMsgGroupRecord *inGroupRecord = NULL); + int SetIsCategoryContainer(const char* groupname, PRBool value, nsMsgGroupRecord *inGroupRecord = NULL); - NS_IMETHOD SetGroupNeedsExtraInfo(char *groupname, PRBool value); + NS_IMETHOD SetGroupNeedsExtraInfo(const char *groupname, PRBool value); // Finds the container newsgroup for this category (or NULL if this isn't // a category). The resulting string must be free'd using delete[]. - char* GetCategoryContainer(char* groupname, nsMsgGroupRecord *inGroupRecord = NULL); - nsINNTPNewsgroup *GetCategoryContainerFolderInfo(char *groupname); + char* GetCategoryContainer(const char* groupname, nsMsgGroupRecord *inGroupRecord = NULL); + nsINNTPNewsgroup *GetCategoryContainerFolderInfo(const char *groupname); // Get/Set whether this is a real group (as opposed to a container of @@ -326,7 +326,7 @@ private: // group is already present, 1 if we had to create it, negative on error. // The given group will have the "isgroup" bit set on it (in other words, // it is not to be just a container of other groups, like "mcom" is.) - int NoticeNewGroup(char* groupname, nsMsgGroupRecord **outGroupRecord = NULL); + int NoticeNewGroup(const char* groupname, nsMsgGroupRecord **outGroupRecord = NULL); // Makes sure that we have records in memory for all known descendants @@ -351,7 +351,7 @@ private: nsMsgGroupRecord* GetGroupTree() {return m_groupTree;} time_t GetFirstNewDate() {return m_firstnewdate;} - NS_IMETHOD GroupNotFound(char *groupName, PRBool opening); + NS_IMETHOD GroupNotFound(const char *groupName, PRBool opening); int ReorderGroup (nsINNTPNewsgroup *groupToMove, nsINNTPNewsgroup *groupToMoveBefore, PRInt32 *newIdx); @@ -370,7 +370,7 @@ protected: char* groupname, PRInt32 min, PRInt32 max); static PRInt32 InhaleLine(char* line, PRUint32 length, void* closure); - nsMsgGroupRecord* FindOrCreateGroup(char* groupname, + nsMsgGroupRecord* FindOrCreateGroup(const char* groupname, int* statusOfMakingGroup = NULL); nsINNTPCategoryContainer *SwitchNewsToCategoryContainer(nsINNTPNewsgroup *newsInfo); @@ -1623,7 +1623,7 @@ nsNNTPHost::EmptyInhale() nsresult -nsNNTPHost::FindGroup(char* name, nsINNTPNewsgroup* *retval) +nsNNTPHost::FindGroup(const char* name, nsINNTPNewsgroup* *retval) { nsresult result = NS_ERROR_NOT_INITIALIZED; @@ -1646,7 +1646,7 @@ nsNNTPHost::FindGroup(char* name, nsINNTPNewsgroup* *retval) } nsresult -nsNNTPHost::AddGroup(char *groupName, +nsNNTPHost::AddGroup(const char *groupName, nsINNTPNewsgroup **retval) { return AddGroup(groupName, NULL, retval); @@ -1654,7 +1654,7 @@ nsNNTPHost::AddGroup(char *groupName, nsresult -nsNNTPHost::AddGroup(char *groupName, +nsNNTPHost::AddGroup(const char *groupName, nsMsgGroupRecord *inGroupRecord, nsINNTPNewsgroup **retval) { @@ -1932,7 +1932,7 @@ nsNNTPHost::RemoveGroup (nsINNTPNewsgroup *newsInfo) } nsresult -nsNNTPHost::RemoveGroupByName(char* groupName) +nsNNTPHost::RemoveGroupByName(const char* groupName) { nsINNTPNewsgroup *newsInfo = NULL; @@ -2090,7 +2090,7 @@ PRBool nsNNTPHost::NeedsExtension (const char * /*extension*/) } nsresult -nsNNTPHost::AddExtension (char *ext) +nsNNTPHost::AddExtension (const char *ext) { PRBool alreadyHasExtension=FALSE; QueryExtension(ext, &alreadyHasExtension); @@ -2104,7 +2104,7 @@ nsNNTPHost::AddExtension (char *ext) } nsresult -nsNNTPHost::QueryExtension (char *ext, PRBool *retval) +nsNNTPHost::QueryExtension (const char *ext, PRBool *retval) { *retval = PR_FALSE; for (int i = 0; i < m_supportedExtensions.Count(); i++) @@ -2116,7 +2116,7 @@ nsNNTPHost::QueryExtension (char *ext, PRBool *retval) } nsresult -nsNNTPHost::AddSearchableGroup (char *group) +nsNNTPHost::AddSearchableGroup (const char *group) { PRBool searchableGroup; nsresult rv = QuerySearchableGroup(group, &searchableGroup); @@ -2141,7 +2141,7 @@ nsNNTPHost::AddSearchableGroup (char *group) } nsresult -nsNNTPHost::QuerySearchableGroup (char *group, PRBool *_retval) +nsNNTPHost::QuerySearchableGroup (const char *group, PRBool *_retval) { *_retval = FALSE; for (int i = 0; i < m_searchableGroups.Count(); i++) @@ -2171,7 +2171,7 @@ nsNNTPHost::QuerySearchableGroup (char *group, PRBool *_retval) // ### mwelch This should have been merged into one routine with QuerySearchableGroup, // but with two interfaces. nsresult -nsNNTPHost::QuerySearchableGroupCharsets(char *group, char **result) +nsNNTPHost::QuerySearchableGroupCharsets(const char *group, char **result) { // Very similar to the above, but this time we look up charsets. PRBool gotGroup = PR_FALSE; @@ -2204,7 +2204,7 @@ nsNNTPHost::QuerySearchableGroupCharsets(char *group, char **result) } nsresult -nsNNTPHost::AddSearchableHeader (char *header) +nsNNTPHost::AddSearchableHeader (const char *header) { PRBool searchable; nsresult rv = QuerySearchableHeader(header, &searchable); @@ -2218,7 +2218,7 @@ nsNNTPHost::AddSearchableHeader (char *header) } nsresult -nsNNTPHost::QuerySearchableHeader(char *header, PRBool *retval) +nsNNTPHost::QuerySearchableHeader(const char *header, PRBool *retval) { *retval=PR_FALSE; for (int i = 0; i < m_searchableHeaders.Count(); i++) @@ -2230,7 +2230,7 @@ nsNNTPHost::QuerySearchableHeader(char *header, PRBool *retval) } nsresult -nsNNTPHost::AddPropertyForGet (char *property, char *value) +nsNNTPHost::AddPropertyForGet (const char *property, const char *value) { char *tmp = NULL; @@ -2247,7 +2247,7 @@ nsNNTPHost::AddPropertyForGet (char *property, char *value) } nsresult -nsNNTPHost::QueryPropertyForGet (char *property, char **retval) +nsNNTPHost::QueryPropertyForGet (const char *property, char **retval) { *retval=NULL; for (int i = 0; i < m_propertiesForGet.Count(); i++) @@ -2356,7 +2356,7 @@ nsNNTPHost::GetPrettyName(char* groupname) nsresult -nsNNTPHost::SetPrettyName(char* groupname, char* prettyname) +nsNNTPHost::SetPrettyName(const char* groupname, const char* prettyname) { nsMsgGroupRecord* group = FindOrCreateGroup(groupname); if (!group) return MK_OUT_OF_MEMORY; @@ -2414,7 +2414,7 @@ nsNNTPHost::IsCategoryContainer(char* groupname) } int -nsNNTPHost::SetIsCategoryContainer(char* groupname, PRBool value, nsMsgGroupRecord *inGroupRecord) +nsNNTPHost::SetIsCategoryContainer(const char* groupname, PRBool value, nsMsgGroupRecord *inGroupRecord) { nsresult rv; nsMsgGroupRecord* group = (inGroupRecord) ? inGroupRecord : FindOrCreateGroup(groupname); @@ -2472,7 +2472,7 @@ nsNNTPHost::SetIsCategoryContainer(char* groupname, PRBool value, nsMsgGroupReco } nsresult -nsNNTPHost::SetGroupNeedsExtraInfo(char *groupname, PRBool value) +nsNNTPHost::SetGroupNeedsExtraInfo(const char *groupname, PRBool value) { nsMsgGroupRecord* group = FindOrCreateGroup(groupname); if (!group) return MK_OUT_OF_MEMORY; @@ -2483,7 +2483,7 @@ nsNNTPHost::SetGroupNeedsExtraInfo(char *groupname, PRBool value) char* -nsNNTPHost::GetCategoryContainer(char* groupname, nsMsgGroupRecord *inGroupRecord) +nsNNTPHost::GetCategoryContainer(const char* groupname, nsMsgGroupRecord *inGroupRecord) { nsMsgGroupRecord* group = (inGroupRecord) ? inGroupRecord : FindOrCreateGroup(groupname); if (group) { @@ -2494,7 +2494,7 @@ nsNNTPHost::GetCategoryContainer(char* groupname, nsMsgGroupRecord *inGroupRecor } nsINNTPNewsgroup * -nsNNTPHost::GetCategoryContainerFolderInfo(char *groupname) +nsNNTPHost::GetCategoryContainerFolderInfo(const char *groupname) { nsINNTPNewsgroup *newsgroup=NULL; nsresult rv; @@ -2517,7 +2517,7 @@ nsNNTPHost::GetCategoryContainerFolderInfo(char *groupname) nsresult -nsNNTPHost::GetIsVirtualGroup(char* groupname, PRBool *retval) +nsNNTPHost::GetIsVirtualGroup(const char* groupname, PRBool *retval) { nsMsgGroupRecord* group = FindOrCreateGroup(groupname); if (!group) { @@ -2530,12 +2530,12 @@ nsNNTPHost::GetIsVirtualGroup(char* groupname, PRBool *retval) nsresult -nsNNTPHost::SetIsVirtualGroup(char* groupname, PRBool value) +nsNNTPHost::SetIsVirtualGroup(const char* groupname, PRBool value) { return SetIsVirtualGroup(groupname, value, nsnull); } nsresult -nsNNTPHost::SetIsVirtualGroup(char* groupname, PRBool value, +nsNNTPHost::SetIsVirtualGroup(const char* groupname, PRBool value, nsMsgGroupRecord* inGroupRecord) { nsMsgGroupRecord* group = (inGroupRecord) ? inGroupRecord : FindOrCreateGroup(groupname); @@ -2774,7 +2774,7 @@ nsNNTPHost::LoadSingleEntry(nsMsgGroupRecord* parent, char* groupname, nsMsgGroupRecord* -nsNNTPHost::FindOrCreateGroup(char* groupname, +nsNNTPHost::FindOrCreateGroup(const char* groupname, int* statusOfMakingGroup) { char buf[256]; @@ -2859,7 +2859,7 @@ nsNNTPHost::FindOrCreateGroup(char* groupname, int -nsNNTPHost::NoticeNewGroup(char* groupname, nsMsgGroupRecord **outGroupRecord) +nsNNTPHost::NoticeNewGroup(const char* groupname, nsMsgGroupRecord **outGroupRecord) { int status = 0; nsMsgGroupRecord* group = FindOrCreateGroup(groupname, &status); @@ -2922,7 +2922,7 @@ nsNNTPHost::AssureAllDescendentsLoaded(nsMsgGroupRecord* group) } nsresult -nsNNTPHost::GroupNotFound(char *groupName, PRBool opening) +nsNNTPHost::GroupNotFound(const char *groupName, PRBool opening) { // if no group command has succeeded, don't blow away categories. // The server might be wedged... @@ -3091,7 +3091,7 @@ int nsNNTPHost::DeleteFiles () * (stolen from msgglue.cpp - MSG_NewsGroupAndNumberOfID) */ nsresult -nsNNTPHost::GetNewsgroupAndNumberOfID(char *message_id, +nsNNTPHost::GetNewsgroupAndNumberOfID(const char *message_id, nsINNTPNewsgroup **group, PRUint32 *messageNumber) { @@ -3119,10 +3119,10 @@ nsNNTPHost::GetNewsgroupAndNumberOfID(char *message_id, /* this function originally lived in a pane */ nsresult -nsNNTPHost::AddNewNewsgroup(char *groupName, +nsNNTPHost::AddNewNewsgroup(const char *groupName, PRInt32 first, PRInt32 last, - char *flags, + const char *flags, PRBool xactiveFlags) { nsMsgGroupRecord *groupRecord = NULL; @@ -3190,7 +3190,7 @@ nsNNTPHost::AddNewNewsgroup(char *groupName, } nsresult -nsNNTPHost::DisplaySubscribedGroup(char *group, +nsNNTPHost::DisplaySubscribedGroup(const char *group, PRInt32 first_message, PRInt32 last_message, PRInt32 total_messages, diff --git a/mailnews/news/tests/nsNNTPHostStub.cpp b/mailnews/news/tests/nsNNTPHostStub.cpp index 9ce87f06b092..3985e69a45f5 100644 --- a/mailnews/news/tests/nsNNTPHostStub.cpp +++ b/mailnews/news/tests/nsNNTPHostStub.cpp @@ -37,7 +37,7 @@ class nsNNTPHostStub : public nsINNTPHost { public: - nsNNTPHostStub(char *name, PRInt32 port); + nsNNTPHostStub(const char *name, PRInt32 port); virtual ~nsNNTPHostStub(); @@ -49,8 +49,8 @@ public: NS_IMETHOD GetSupportsExtensions(PRBool *aSupportsExtensions); NS_IMETHOD SetSupportsExtensions(PRBool aSupportsExtensions); - NS_IMETHOD AddExtension (char *ext); - NS_IMETHOD QueryExtension (char *ext, PRBool *_retval); + NS_IMETHOD AddExtension (const char *ext); + NS_IMETHOD QueryExtension (const char *ext, PRBool *_retval); NS_IMETHOD GetPostingAllowed(PRBool * aPostingAllowed); NS_IMETHOD SetPostingAllowed(PRBool aPostingAllowed); @@ -60,32 +60,32 @@ public: NS_IMPL_CLASS_GETSET(LastUpdatedTime, PRInt64, m_lastGroupUpdate); - NS_IMETHOD GetNewsgroupList(char *groupname, nsINNTPNewsgroupList **_retval); + NS_IMETHOD GetNewsgroupList(const char *groupname, nsINNTPNewsgroupList **_retval); - NS_IMETHOD GetNewsgroupAndNumberOfID(char *message_id, + NS_IMETHOD GetNewsgroupAndNumberOfID(const char *message_id, nsINNTPNewsgroup **group, PRUint32 *messageNumber); /* get this from MSG_Master::FindNewsFolder */ - NS_IMETHOD FindNewsgroup(char *groupname, PRBool create, + NS_IMETHOD FindNewsgroup(const char *groupname, PRBool create, nsINNTPNewsgroup **_retval) { return FindGroup(groupname, _retval);} - NS_IMETHOD AddPropertyForGet (char *property, char *value); - NS_IMETHOD QueryPropertyForGet (char *property, char **_retval); + NS_IMETHOD AddPropertyForGet (const char *property, const char *value); + NS_IMETHOD QueryPropertyForGet (const char *property, char **_retval); - NS_IMETHOD AddSearchableGroup(char *groupname); + NS_IMETHOD AddSearchableGroup(const char *groupname); // should these go into interfaces? - NS_IMETHOD QuerySearchableGroup (char *group, PRBool *); + NS_IMETHOD QuerySearchableGroup (const char *group, PRBool *); //NS_IMETHOD QuerySearchableGroupCharsets(char *group, char **); // Virtual groups - NS_IMETHOD AddVirtualGroup(char *responseText) { return NS_OK;} - NS_IMETHOD SetIsVirtualGroup(char *groupname, PRBool isVirtual); - NS_IMETHOD GetIsVirtualGroup(char *groupname, PRBool *_retval); + NS_IMETHOD AddVirtualGroup(const char *responseText) { return NS_OK;} + NS_IMETHOD SetIsVirtualGroup(const char *groupname, PRBool isVirtual); + NS_IMETHOD GetIsVirtualGroup(const char *groupname, PRBool *_retval); // custom/searchable headers - NS_IMETHOD AddSearchableHeader(char *headerName); - NS_IMETHOD QuerySearchableHeader(char *headerName, PRBool *_retval); + NS_IMETHOD AddSearchableHeader(const char *headerName); + NS_IMETHOD QuerySearchableHeader(const char *headerName, PRBool *_retval); // Go load the newsrc for this host. Creates the subscribed hosts as // children of the given nsIMsgFolder. @@ -108,21 +108,21 @@ public: NS_IMETHOD SetNewsRCFilename(char *); - NS_IMETHOD FindGroup(char* name, nsINNTPNewsgroup* *_retval); - NS_IMETHOD AddGroup(char *groupname, + NS_IMETHOD FindGroup(const char* name, nsINNTPNewsgroup* *_retval); + NS_IMETHOD AddGroup(const char *groupname, nsINNTPNewsgroup **retval); - //NS_IMETHOD AddGroup(char *groupname, + //NS_IMETHOD AddGroup(const char *groupname, // nsMsgGroupRecord *groupRecord, // nsINNTPNewsgroup **retval); - NS_IMETHOD RemoveGroupByName(char *groupName); + NS_IMETHOD RemoveGroupByName(const char *groupName); NS_IMETHOD RemoveGroup(nsINNTPNewsgroup*); - NS_IMETHOD AddNewNewsgroup(char *groupName, + NS_IMETHOD AddNewNewsgroup(const char *groupName, PRInt32 first, PRInt32 last, - char *flags, + const char *flags, PRBool xactiveFlags); /* Name of directory to store newsgroup @@ -137,7 +137,7 @@ public: individual strings must not be free'd. */ NS_IMETHOD GetGroupList(char **_retval); - NS_IMETHOD DisplaySubscribedGroup(char *groupname, + NS_IMETHOD DisplaySubscribedGroup(const char *groupname, PRInt32 first_message, PRInt32 last_message, PRInt32 total_messages, @@ -170,18 +170,18 @@ private: // Returns the pretty name for the given group. The resulting string // must be free'd using delete[]. char* GetPrettyName(char* groupname) { return m_prettyName;} - NS_IMETHOD SetPrettyName(char* groupname, char* prettyname); + NS_IMETHOD SetPrettyName(const char* groupname, const char* prettyname); - NS_IMETHOD SetGroupNeedsExtraInfo(char *groupname, PRBool value); + NS_IMETHOD SetGroupNeedsExtraInfo(const char *groupname, PRBool value); // Finds the container newsgroup for this category (or NULL if this isn't // a category). The resulting string must be free'd using delete[]. char* GetCategoryContainer(char* groupname, nsMsgGroupRecord *inGroupRecord = NULL); - nsINNTPNewsgroup *GetCategoryContainerFolderInfo(char *groupname); + nsINNTPNewsgroup *GetCategoryContainerFolderInfo(const char *groupname); nsMsgGroupRecord* GetGroupTree() {return m_groupTree;} - NS_IMETHOD GroupNotFound(char *groupName, PRBool opening); + NS_IMETHOD GroupNotFound(const char *groupName, PRBool opening); protected: @@ -246,7 +246,7 @@ protected: NS_IMPL_ISUPPORTS(nsNNTPHostStub, nsINNTPHost::GetIID()); -nsNNTPHostStub::nsNNTPHostStub(char * name, PRInt32 port) +nsNNTPHostStub::nsNNTPHostStub(const char * name, PRInt32 port) { NS_INIT_REFCNT(); m_supportsExtensions = PR_FALSE; @@ -276,13 +276,13 @@ nsresult nsNNTPHostStub::SetSupportsExtensions(PRBool aSupportsExtensions) } -nsresult nsNNTPHostStub::AddExtension(char * extension) +nsresult nsNNTPHostStub::AddExtension(const char * extension) { printf("Adding extension: %s. \n", extension ? extension : "invalid extension"); return NS_OK; } -nsresult nsNNTPHostStub::QueryExtension(char * extension, PRBool * aRetValue) +nsresult nsNNTPHostStub::QueryExtension(const char * extension, PRBool * aRetValue) { printf("Querying extension %s. \n", extension ? extension : "invalid extension"); if (PL_strstr(extension, "SEARCH")) @@ -323,7 +323,7 @@ nsresult nsNNTPHostStub::SetPushAuth(PRBool aPushAuth) } -nsresult nsNNTPHostStub::AddPropertyForGet (char *property, char *value) +nsresult nsNNTPHostStub::AddPropertyForGet (const char *property, const char *value) { char *tmp = NULL; @@ -341,12 +341,12 @@ nsresult nsNNTPHostStub::AddPropertyForGet (char *property, char *value) return NS_OK; } -nsresult nsNNTPHostStub::QueryPropertyForGet (char *property, char **retval) +nsresult nsNNTPHostStub::QueryPropertyForGet (const char *property, char **retval) { *retval=NULL; for (int i = 0; i < m_propertiesForGet.Count(); i++) - if (!PL_strcasecmp(property, (char *) m_propertiesForGet[i])) { - *retval = (char *)m_valuesForGet[i]; + if (!PL_strcasecmp(property, (const char *) m_propertiesForGet[i])) { + *retval = (const char *)m_valuesForGet[i]; printf("Retrieving property %s for get. \n", *retval); return NS_OK; } @@ -354,7 +354,7 @@ nsresult nsNNTPHostStub::QueryPropertyForGet (char *property, char **retval) return NS_OK; } -nsresult nsNNTPHostStub::AddSearchableGroup (char *group) +nsresult nsNNTPHostStub::AddSearchableGroup (const char *group) { PRBool searchableGroup; nsresult rv = QuerySearchableGroup(group, &searchableGroup); @@ -379,7 +379,7 @@ nsresult nsNNTPHostStub::AddSearchableGroup (char *group) return NS_OK; } -nsresult nsNNTPHostStub::QuerySearchableGroup (char *group, PRBool *_retval) +nsresult nsNNTPHostStub::QuerySearchableGroup (const char *group, PRBool *_retval) { *_retval = PR_FALSE; for (int i = 0; i < m_searchableGroups.Count(); i++) @@ -406,18 +406,18 @@ nsresult nsNNTPHostStub::QuerySearchableGroup (char *group, PRBool *_retval) return NS_OK; } -nsresult nsNNTPHostStub::SetIsVirtualGroup(char * groupname, PRBool isVirtual) +nsresult nsNNTPHostStub::SetIsVirtualGroup(const char * groupname, PRBool isVirtual) { return NS_OK; } -nsresult nsNNTPHostStub::GetIsVirtualGroup(char * groupname, PRBool * isVirtual) +nsresult nsNNTPHostStub::GetIsVirtualGroup(const char * groupname, PRBool * isVirtual) { *isVirtual = PR_FALSE; return NS_OK; } -nsresult nsNNTPHostStub::AddSearchableHeader (char *header) +nsresult nsNNTPHostStub::AddSearchableHeader (const char *header) { PRBool searchable; nsresult rv = QuerySearchableHeader(header, &searchable); @@ -432,7 +432,7 @@ nsresult nsNNTPHostStub::AddSearchableHeader (char *header) return NS_OK; } -nsresult nsNNTPHostStub::QuerySearchableHeader(char *header, PRBool *retval) +nsresult nsNNTPHostStub::QuerySearchableHeader(const char *header, PRBool *retval) { *retval=PR_FALSE; for (int i = 0; i < m_searchableHeaders.Count(); i++) @@ -443,16 +443,16 @@ nsresult nsNNTPHostStub::QuerySearchableHeader(char *header, PRBool *retval) return NS_OK; } -nsresult nsNNTPHostStub::GroupNotFound(char *groupName, PRBool opening) +nsresult nsNNTPHostStub::GroupNotFound(const char *groupName, PRBool opening) { printf("Group %s not found. \n", groupName); return NS_OK; } -nsresult nsNNTPHostStub::AddNewNewsgroup(char *groupName, +nsresult nsNNTPHostStub::AddNewNewsgroup(const char *groupName, PRInt32 first, PRInt32 last, - char *flags, + const char *flags, PRBool xactiveFlags) { printf ("Adding new newsgroup: %s. \n", groupName); @@ -496,7 +496,7 @@ nsresult nsNNTPHostStub::GetFirstGroupNeedingCounts(char ** aFirstGroup) return NS_OK; } -nsresult nsNNTPHostStub::DisplaySubscribedGroup(char * groupname, PRInt32 first_message, PRInt32 last_message, PRInt32 total_messages, +nsresult nsNNTPHostStub::DisplaySubscribedGroup(const char * groupname, PRInt32 first_message, PRInt32 last_message, PRInt32 total_messages, PRBool visit_now) { printf("Displaying subscribed group %s which has %d total messages. \n", groupname, total_messages); @@ -536,18 +536,18 @@ nsresult nsNNTPHostStub::GetFirstGroupNeedingExtraInfo(char ** retval) return NS_OK; } -nsresult nsNNTPHostStub::SetGroupNeedsExtraInfo(char * groupName, PRBool needsExtraInfo) +nsresult nsNNTPHostStub::SetGroupNeedsExtraInfo(const char * groupName, PRBool needsExtraInfo) { printf("Setting group %s to need extra info.\n", groupName); return NS_OK; } -nsresult nsNNTPHostStub::GetNewsgroupAndNumberOfID(char *messageID, nsINNTPNewsgroup ** group, PRUint32 * messageNumber) +nsresult nsNNTPHostStub::GetNewsgroupAndNumberOfID(const char *messageID, nsINNTPNewsgroup ** group, PRUint32 * messageNumber) { return NS_OK; } -nsresult nsNNTPHostStub::SetPrettyName(char * groupname, char * prettyname) +nsresult nsNNTPHostStub::SetPrettyName(const char * groupname, const char * prettyname) { printf("Setting group %s to have pretty name %s. \n", groupname, prettyname); return NS_OK; @@ -576,7 +576,7 @@ nsresult nsNNTPHostStub::MarkDirty() } #if 0 -nsresult nsNNTPHostStub::GetNewsRCFilename(char ** aNewsRCFileName) +nsresult nsNNTPHostStub::GetNewsRCFilename(const char ** aNewsRCFileName) { if (aNewsRCFileName) *aNewsRCFileName = "temp.rc"; @@ -590,7 +590,7 @@ nsresult nsNNTPHostStub::SetNewsRCFilename(char * fileName) return NS_OK; } -nsresult nsNNTPHostStub::GetNewsgroupList(char *groupname, nsINNTPNewsgroupList **_retval) +nsresult nsNNTPHostStub::GetNewsgroupList(const char *groupname, nsINNTPNewsgroupList **_retval) { nsresult rv = NS_OK; // find group with the group name... @@ -605,7 +605,7 @@ nsresult nsNNTPHostStub::GetNewsgroupList(char *groupname, nsINNTPNewsgroupList return rv; } -nsresult nsNNTPHostStub::FindGroup(char * name, nsINNTPNewsgroup ** retVal) +nsresult nsNNTPHostStub::FindGroup(const char * name, nsINNTPNewsgroup ** retVal) { PRBool found = PR_FALSE; *retVal = nsnull; @@ -637,7 +637,7 @@ nsresult nsNNTPHostStub::FindGroup(char * name, nsINNTPNewsgroup ** retVal) return NS_OK; } -nsresult nsNNTPHostStub::AddGroup(char *groupname, nsINNTPNewsgroup **retval) +nsresult nsNNTPHostStub::AddGroup(const char *groupname, nsINNTPNewsgroup **retval) { nsresult rv = NS_OK; printf ("Adding group %s to host.\n", groupname); @@ -645,7 +645,7 @@ nsresult nsNNTPHostStub::AddGroup(char *groupname, nsINNTPNewsgroup **retval) nsINNTPNewsgroup * group = nsnull; rv = NS_NewNewsgroup(&group, nsnull, /* nsNNTPArticleSet * */ nsnull, PR_TRUE, this, 0); if (group) // set the name for our group.. - group->SetName((char *) groupname); + group->SetName((char*)groupname); // generate a news group list for the new group... nsINNTPNewsgroupList * list = nsnull; rv = NS_NewNewsgroupList(&list,this, group); @@ -677,7 +677,7 @@ nsresult nsNNTPHostStub::RemoveGroup(nsINNTPNewsgroup * group) return NS_OK; } -nsresult nsNNTPHostStub::RemoveGroupByName(char *groupName) +nsresult nsNNTPHostStub::RemoveGroupByName(const char *groupName) { printf ("Removing group %s. \n", groupName); return NS_OK; diff --git a/mailnews/news/tests/nsNNTPNewsgroupListStub.cpp b/mailnews/news/tests/nsNNTPNewsgroupListStub.cpp index 5ac21c01f848..60761ab213fc 100644 --- a/mailnews/news/tests/nsNNTPNewsgroupListStub.cpp +++ b/mailnews/news/tests/nsNNTPNewsgroupListStub.cpp @@ -50,9 +50,9 @@ class nsNNTPNewsgroupListStub : public nsINNTPNewsgroupList { NS_IMETHOD InitXOVER(PRInt32 first_message, PRInt32 last_message); - NS_IMETHOD ProcessXOVER(char *line, PRInt32 *status); + NS_IMETHOD ProcessXOVER(const char *line, PRInt32 *status); - NS_IMETHOD ProcessNonXOVER(char *line); + NS_IMETHOD ProcessNonXOVER(const char *line); NS_IMETHOD ResetXOVER(); NS_IMETHOD FinishXOVER(PRInt32 status, PRInt32 *newstatus); @@ -222,7 +222,7 @@ nsresult nsNNTPNewsgroupListStub::InitXOVER(PRInt32 first_msg, PRInt32 last_msg) #define NEWS_ART_DISPLAY_FREQ 10 -nsresult nsNNTPNewsgroupListStub::ProcessXOVER(char *line, int *status) +nsresult nsNNTPNewsgroupListStub::ProcessXOVER(const char *line, int *status) { const char *next; PRUint32 message_number=0; @@ -288,7 +288,7 @@ nsNNTPNewsgroupListStub::ResetXOVER() slow anyway that this just doesn't matter. */ -nsresult nsNNTPNewsgroupListStub::ProcessNonXOVER (char * /*line*/) +nsresult nsNNTPNewsgroupListStub::ProcessNonXOVER (const char * /*line*/) { // ### dmb write me return NS_OK;