mirror of
https://github.com/znc/znc.git
synced 2026-05-01 19:12:31 +02:00
Implemented a nick compare function
As suggested by the todos in IRCSock, added IsNick(CString) method so the ugly Nick.GetNick().Equals(GetNick()) could be simplified. Signed-off-by: Toon Schoenmakers <nighteyes1993@gmail.com>
This commit is contained in:
@@ -37,6 +37,7 @@ public:
|
||||
void Parse(const CString& sNickMask);
|
||||
CString GetHostMask() const;
|
||||
size_t GetCommonChans(std::vector<CChan*>& vChans, CIRCNetwork* pNetwork) const;
|
||||
bool IsNick(const CString& nickname) const;
|
||||
|
||||
// Setters
|
||||
void SetNetwork(CIRCNetwork* pNetwork);
|
||||
|
||||
@@ -512,8 +512,7 @@ void CIRCSock::ReadLine(const CString& sData) {
|
||||
}
|
||||
}
|
||||
|
||||
// Todo: use nick compare function here
|
||||
if (Nick.GetNick().Equals(GetNick())) {
|
||||
if (Nick.IsNick(GetNick())) {
|
||||
// We are changing our own nick, the clients always must see this!
|
||||
bIsVisible = false;
|
||||
SetNick(sNewNick);
|
||||
@@ -563,8 +562,7 @@ void CIRCSock::ReadLine(const CString& sData) {
|
||||
CString sChan = sRest.Token(0).TrimPrefix_n();
|
||||
CChan* pChan;
|
||||
|
||||
// Todo: use nick compare function
|
||||
if (Nick.GetNick().Equals(GetNick())) {
|
||||
if (Nick.IsNick(GetNick())) {
|
||||
m_pNetwork->AddChan(sChan, false);
|
||||
pChan = m_pNetwork->FindChan(sChan);
|
||||
if (pChan) {
|
||||
@@ -598,8 +596,7 @@ void CIRCSock::ReadLine(const CString& sData) {
|
||||
bDetached = true;
|
||||
}
|
||||
|
||||
// Todo: use nick compare function
|
||||
if (Nick.GetNick().Equals(GetNick())) {
|
||||
if (Nick.IsNick(GetNick())) {
|
||||
m_pNetwork->DelChan(sChan);
|
||||
}
|
||||
|
||||
|
||||
@@ -78,6 +78,10 @@ size_t CNick::GetCommonChans(vector<CChan*>& vRetChans, CIRCNetwork* pNetwork) c
|
||||
return vRetChans.size();
|
||||
}
|
||||
|
||||
bool CNick::IsNick(const CString& nickname) const {
|
||||
return m_sNick.Equals(nickname);
|
||||
}
|
||||
|
||||
void CNick::SetNetwork(CIRCNetwork* pNetwork) { m_pNetwork = pNetwork; }
|
||||
void CNick::SetNick(const CString& s) { m_sNick = s; }
|
||||
void CNick::SetIdent(const CString& s) { m_sIdent = s; }
|
||||
|
||||
Reference in New Issue
Block a user