mirror of
https://github.com/znc/znc.git
synced 2026-07-03 16:31:49 +02:00
Added GetCommonChans()
git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@159 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
#include "Nick.h"
|
||||
#include "Chan.h"
|
||||
#include "User.h"
|
||||
|
||||
CNick::CNick() {
|
||||
m_bIsOp = false;
|
||||
@@ -34,6 +36,26 @@ void CNick::Parse(const string& sNickMask) {
|
||||
}
|
||||
}
|
||||
|
||||
unsigned int CNick::GetCommonChans(vector<CChan*>& vRetChans, CUser* pUser) const {
|
||||
vRetChans.clear();
|
||||
|
||||
const vector<CChan*>& vChans = pUser->GetChans();
|
||||
|
||||
for (unsigned int a = 0; a < vChans.size(); a++) {
|
||||
CChan* pChan = vChans[a];
|
||||
const map<string,CNick*>& msNicks = pChan->GetNicks();
|
||||
|
||||
for (map<string,CNick*>::const_iterator it = msNicks.begin(); it != msNicks.end(); it++) {
|
||||
if (strcasecmp(it->first.c_str(), m_sNick.c_str()) == 0) {
|
||||
vRetChans.push_back(pChan);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return vRetChans.size();
|
||||
}
|
||||
|
||||
void CNick::SetNick(const string& s) { m_sNick = s; }
|
||||
void CNick::SetIdent(const string& s) { m_sIdent = s; }
|
||||
void CNick::SetHost(const string& s) { m_sHost = s; }
|
||||
|
||||
Reference in New Issue
Block a user