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

View File

@@ -51,7 +51,7 @@ void CClient::UserCommand(CString& sLine) {
return;
}
const map<CString,CNick*>& msNicks = pChan->GetNicks();
const map<CString,CNick>& msNicks = pChan->GetNicks();
CIRCSock* pIRCSock = m_pUser->GetIRCSock();
const CString& sPerms = (pIRCSock) ? pIRCSock->GetPerms() : "";
@@ -72,20 +72,20 @@ void CClient::UserCommand(CString& sLine) {
Table.AddColumn("Ident");
Table.AddColumn("Host");
for (map<CString,CNick*>::const_iterator a = msNicks.begin(); a != msNicks.end(); ++a) {
for (map<CString,CNick>::const_iterator a = msNicks.begin(); a != msNicks.end(); ++a) {
Table.AddRow();
for (unsigned int b = 0; b < sPerms.size(); b++) {
if (a->second->HasPerm(sPerms[b])) {
if (a->second.HasPerm(sPerms[b])) {
CString sPerm;
sPerm += sPerms[b];
Table.SetCell(sPerm, sPerm);
}
}
Table.SetCell("Nick", a->second->GetNick());
Table.SetCell("Ident", a->second->GetIdent());
Table.SetCell("Host", a->second->GetHost());
Table.SetCell("Nick", a->second.GetNick());
Table.SetCell("Ident", a->second.GetIdent());
Table.SetCell("Host", a->second.GetHost());
}
PutStatus(Table);