Make chan modes and permissions to be char instead of unsigned char.

Deprecate old module hooks which accept mode as unsigned char.

SWIG handles unsigned char as int, but char as a string.
Before this commit, usage of HasPerm from perl modules required this:
either $chan->HasPerm(ord('@')) or $chan->HasPerm(ord($ZNC::CChan::Op)).
Now ord() is not necessary, and these calls work too:
$chan->HasPerm('@') and $chan->HasPerm($ZNC::CChan::Op).

Fix #1486
This commit is contained in:
Alexey Sokolov
2018-02-10 15:49:53 +00:00
parent 9ff4127e33
commit a2470b3dd3
10 changed files with 127 additions and 99 deletions

View File

@@ -617,6 +617,11 @@ CModule::EModRet CModule::OnIRCRegistration(CString& sPass, CString& sNick,
}
CModule::EModRet CModule::OnBroadcast(CString& sMessage) { return CONTINUE; }
void CModule::OnChanPermission3(const CNick* pOpNick, const CNick& Nick,
CChan& Channel, char cMode,
bool bAdded, bool bNoChange) {
OnChanPermission2(pOpNick, Nick, Channel, cMode, bAdded, bNoChange);
}
void CModule::OnChanPermission2(const CNick* pOpNick, const CNick& Nick,
CChan& Channel, unsigned char uMode,
bool bAdded, bool bNoChange) {
@@ -1144,6 +1149,13 @@ bool CModules::OnIRCDisconnected() {
return false;
}
bool CModules::OnChanPermission3(const CNick* pOpNick, const CNick& Nick,
CChan& Channel, char cMode,
bool bAdded, bool bNoChange) {
MODUNLOADCHK(
OnChanPermission3(pOpNick, Nick, Channel, cMode, bAdded, bNoChange));
return false;
}
bool CModules::OnChanPermission2(const CNick* pOpNick, const CNick& Nick,
CChan& Channel, unsigned char uMode,
bool bAdded, bool bNoChange) {