const correctness fixes

This commit is contained in:
J-P Nurmi
2014-10-01 20:30:26 +02:00
parent 4fe249280e
commit ef4caae6d1
12 changed files with 31 additions and 31 deletions
+1 -1
View File
@@ -60,7 +60,7 @@ public:
~CChan();
void Reset();
CConfig ToConfig();
CConfig ToConfig() const;
void Clone(CChan& chan);
void Cycle() const;
void JoinUser(bool bForce = false, const CString& sKey = "", CClient* pClient = NULL);
+2 -2
View File
@@ -131,7 +131,7 @@ public:
void PutModule(const CString& sModule, const CString& sLine);
void PutModNotice(const CString& sModule, const CString& sLine);
bool IsCapEnabled(const CString& sCap) { return 1 == m_ssAcceptedCaps.count(sCap); }
bool IsCapEnabled(const CString& sCap) const { return 1 == m_ssAcceptedCaps.count(sCap); }
virtual void ReadLine(const CString& sData);
bool SendMotd();
@@ -151,7 +151,7 @@ public:
const std::vector<CClient*>& GetClients() const;
const CIRCSock* GetIRCSock() const;
CIRCSock* GetIRCSock();
CString GetFullName();
CString GetFullName() const;
private:
void HandleCap(const CString& sLine);
void RespondCap(const CString& sResponse);
+2 -2
View File
@@ -238,8 +238,8 @@ public:
return uRet;
}
CFile::EFileAttr GetSortAttr() { return m_eSortAttr; }
bool IsDescending() { return m_bDesc; }
CFile::EFileAttr GetSortAttr() const { return m_eSortAttr; }
bool IsDescending() const { return m_bDesc; }
// Check if sPath + "/" + sAdd (~/ is handled) is an absolute path which
// resides under sPath. Returns absolute path on success, else "".
+1 -1
View File
@@ -56,7 +56,7 @@ public:
void ParseURI();
void GetPage();
static CString GetDate(time_t tm = 0);
virtual CString GetRemoteIP();
virtual CString GetRemoteIP() const;
// Cookies
CString GetRequestCookie(const CString& sKey) const;
+3 -3
View File
@@ -57,12 +57,12 @@ public:
void Clone(const CIRCNetwork& Network, bool bCloneName = true);
CString GetNetworkPath();
CString GetNetworkPath() const;
void DelServers();
bool ParseConfig(CConfig *pConfig, CString& sError, bool bUpgrade = false);
CConfig ToConfig();
CConfig ToConfig() const;
void BounceAllClients();
@@ -71,7 +71,7 @@ public:
void ClientConnected(CClient *pClient);
void ClientDisconnected(CClient *pClient);
CUser* GetUser();
CUser* GetUser() const;
const CString& GetName() const;
bool IsNetworkAttached() const { return !m_vClients.empty(); }
const std::vector<CClient*>& GetClients() const { return m_vClients; }
+7 -7
View File
@@ -978,13 +978,13 @@ public:
* except when we are in a user-specific module hook in which
* case this is the user pointer.
*/
CUser* GetUser() { return m_pUser; }
CUser* GetUser() const { return m_pUser; }
/** @returns NULL except when we are in a client-specific module hook in
* which case this is the client for which the hook is called.
*/
CIRCNetwork* GetNetwork() { return m_pNetwork; }
CClient* GetClient() { return m_pClient; }
CSockManager* GetManager() { return m_pManager; }
CIRCNetwork* GetNetwork() const { return m_pNetwork; }
CClient* GetClient() const { return m_pClient; }
CSockManager* GetManager() const { return m_pManager; }
// !Getters
// Global Modules
@@ -1114,9 +1114,9 @@ public:
void SetUser(CUser* pUser) { m_pUser = pUser; }
void SetNetwork(CIRCNetwork* pNetwork) { m_pNetwork = pNetwork; }
void SetClient(CClient* pClient) { m_pClient = pClient; }
CUser* GetUser() { return m_pUser; }
CIRCNetwork* GetNetwork() { return m_pNetwork; }
CClient* GetClient() { return m_pClient; }
CUser* GetUser() const { return m_pUser; }
CIRCNetwork* GetNetwork() const { return m_pNetwork; }
CClient* GetClient() const { return m_pClient; }
void UnloadAll();
+3 -3
View File
@@ -57,7 +57,7 @@ public:
return CUtils::SaltedSHA256Hash(sPass, sSalt);
}
CConfig ToConfig();
CConfig ToConfig() const;
bool CheckPass(const CString& sPass) const;
bool AddAllowedHost(const CString& sHostMask);
bool IsHostAllowed(const CString& sHostMask) const;
@@ -91,7 +91,7 @@ public:
void UserConnected(CClient* pClient);
void UserDisconnected(CClient* pClient);
CString GetLocalDCCIP();
CString GetLocalDCCIP() const;
CString ExpandString(const CString& sStr) const;
CString& ExpandString(const CString& sStr, CString& sRet) const;
@@ -141,8 +141,8 @@ public:
// !Setters
// Getters
std::vector<CClient*> GetAllClients();
const std::vector<CClient*>& GetUserClients() const { return m_vClients; }
std::vector<CClient*> GetAllClients() const;
const CString& GetUserName() const;
const CString& GetCleanUserName() const;
const CString& GetNick(bool bAllowDefault = true) const;
+1 -1
View File
@@ -80,7 +80,7 @@ void CChan::Reset() {
ResetJoinTries();
}
CConfig CChan::ToConfig() {
CConfig CChan::ToConfig() const {
CConfig config;
if (m_bHasBufferCountSet)
+1 -1
View File
@@ -775,7 +775,7 @@ void CClient::PutIRC(const CString& sLine) {
}
}
CString CClient::GetFullName() {
CString CClient::GetFullName() const {
if (!m_pUser)
return GetRemoteIP();
if (!m_pNetwork)
+1 -1
View File
@@ -181,7 +181,7 @@ void CHTTPSock::ReadLine(const CString& sData) {
}
}
CString CHTTPSock::GetRemoteIP() {
CString CHTTPSock::GetRemoteIP() const {
if (!m_sForwardedIP.empty()) {
return m_sForwardedIP;
}
+4 -4
View File
@@ -305,7 +305,7 @@ void CIRCNetwork::DelServers() {
m_vServers.clear();
}
CString CIRCNetwork::GetNetworkPath() {
CString CIRCNetwork::GetNetworkPath() const {
CString sNetworkPath = m_pUser->GetUserPath() + "/networks/" + m_sName;
if (!CFile::Exists(sNetworkPath)) {
@@ -455,7 +455,7 @@ bool CIRCNetwork::ParseConfig(CConfig *pConfig, CString& sError, bool bUpgrade)
return true;
}
CConfig CIRCNetwork::ToConfig() {
CConfig CIRCNetwork::ToConfig() const {
CConfig config;
if (!m_sNick.empty()) {
@@ -487,7 +487,7 @@ CConfig CIRCNetwork::ToConfig() {
}
// Modules
CModules& Mods = GetModules();
const CModules& Mods = GetModules();
if (!Mods.empty()) {
for (unsigned int a = 0; a < Mods.size(); a++) {
@@ -638,7 +638,7 @@ void CIRCNetwork::ClientDisconnected(CClient *pClient) {
}
}
CUser* CIRCNetwork::GetUser() {
CUser* CIRCNetwork::GetUser() const {
return m_pUser;
}
+5 -5
View File
@@ -859,7 +859,7 @@ bool CUser::IsValid(CString& sErrMsg, bool bSkipPass) const {
return true;
}
CConfig CUser::ToConfig() {
CConfig CUser::ToConfig() const {
CConfig config;
CConfig passConfig;
@@ -923,7 +923,7 @@ CConfig CUser::ToConfig() {
}
// Modules
CModules& Mods = GetModules();
const CModules& Mods = GetModules();
if (!Mods.empty()) {
for (unsigned int a = 0; a < Mods.size(); a++) {
@@ -976,11 +976,11 @@ bool CUser::CheckPass(const CString& sPass) const {
return (CClient*) CZNC::Get().GetManager().FindSockByName(sSockName);
}*/
CString CUser::GetLocalDCCIP() {
CString CUser::GetLocalDCCIP() const {
if (!GetDCCBindHost().empty())
return GetDCCBindHost();
for (vector<CIRCNetwork*>::iterator it = m_vIRCNetworks.begin(); it != m_vIRCNetworks.end(); ++it) {
for (vector<CIRCNetwork*>::const_iterator it = m_vIRCNetworks.begin(); it != m_vIRCNetworks.end(); ++it) {
CIRCNetwork *pNetwork = *it;
CIRCSock* pIRCSock = pNetwork->GetIRCSock();
if (pIRCSock) {
@@ -1167,7 +1167,7 @@ bool CUser::SetStatusPrefix(const CString& s) {
// !Setters
// Getters
vector<CClient*> CUser::GetAllClients() {
vector<CClient*> CUser::GetAllClients() const {
vector<CClient*> vClients;
for (unsigned int a = 0; a < m_vIRCNetworks.size(); a++) {