Turn CChan::m_msNicks into a map<CString, CNick>

Saving a pointer in a map seems like a bad idea and means we have to delete all
the contained stuff by hand when the channel is destroyed. This requires us to
loop through the channel which is slow. A map is meant as a container, so use it
as one and directly save the stuff we want it to save in there.


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@2175 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
psychon
2010-11-06 19:41:40 +00:00
parent 612b61dada
commit 5e070e7881
7 changed files with 38 additions and 37 deletions
+2 -2
View File
@@ -124,8 +124,8 @@ protected:
return;
// Is that person us and we don't have op?
const CNick* pNick = Channel.GetNicks().begin()->second;
if (!pNick->HasPerm(CChan::Op) && pNick->GetNick().Equals(m_pUser->GetCurNick()))
const CNick& pNick = Channel.GetNicks().begin()->second;
if (!pNick.HasPerm(CChan::Op) && pNick.GetNick().Equals(m_pUser->GetCurNick()))
Channel.Cycle();
}
+2 -2
View File
@@ -352,7 +352,7 @@ public:
for (size_t a = 0; a < Chans.size(); a++) {
const CChan& Chan = *Chans[a];
CNick* pNick = Chan.FindNick(Nick.GetNick());
const CNick* pNick = Chan.FindNick(Nick.GetNick());
if (pNick) {
if (pNick->HasPerm(CChan::Op) && pUser->ChannelMatches(Chan.GetName())) {
@@ -446,7 +446,7 @@ public:
const CChan& Chan = *Chans[a];
if (Chan.HasPerm(CChan::Op) && User.ChannelMatches(Chan.GetName())) {
CNick* pNick = Chan.FindNick(Nick.GetNick());
const CNick* pNick = Chan.FindNick(Nick.GetNick());
if (pNick && !pNick->HasPerm(CChan::Op)) {
PutIRC("MODE " + Chan.GetName() + " +o " + Nick.GetNick());
+3 -3
View File
@@ -302,9 +302,9 @@ private:
return TCL_ERROR;
}
const map<CString,CNick*>& msNicks = pChannel->GetNicks();
for (map<CString,CNick*>::const_iterator it = msNicks.begin(); it != msNicks.end(); ++it) {
const CNick& Nick = *it->second;
const map<CString,CNick>& msNicks = pChannel->GetNicks();
for (map<CString,CNick>::const_iterator it = msNicks.begin(); it != msNicks.end(); ++it) {
const CNick& Nick = it->second;
l[0] = (Nick.GetNick()).c_str();
l[1] = (Nick.GetIdent()).c_str();
l[2] = (Nick.GetHost()).c_str();