Add new module call OnMode()

It's basically OnRawMode() but once per single mode.
Oh and this also fixes a problem where ZNC lost track of chan modes with params
(See hunk in CChan::AddMode).


git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1189 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
psychon
2008-09-04 10:28:19 +00:00
parent 57bdb554a9
commit 219ae6a572
3 changed files with 16 additions and 4 deletions
+12 -4
View File
@@ -330,6 +330,18 @@ void CChan::ModeChange(const CString& sModes, const CString& sOpNick) {
break;
}
#ifdef _MODULES
bool bNoChange;
if (bList) {
bNoChange = false;
} else if (bAdd) {
bNoChange = HasMode(uMode) && GetModeArg(uMode) == sArg;
} else {
bNoChange = !HasMode(uMode);
}
MODULECALL(OnMode(*pOpNick, *this, uMode, sArg, bAdd, bNoChange), m_pUser, NULL, );
#endif
if (!bList) {
(bAdd) ? AddMode(uMode, sArg) : RemMode(uMode, sArg);
}
@@ -372,10 +384,6 @@ bool CChan::HasMode(unsigned char uMode) const {
}
bool CChan::AddMode(unsigned char uMode, const CString& sArg) {
if (HasMode(uMode)) {
return false;
}
m_musModes[uMode] = sArg;
return true;
}