mirror of
https://github.com/znc/znc.git
synced 2026-07-01 15:31:52 +02:00
Add OnJoining module hook.
This patch adds an OnJoining module hook that allows a module to allow or disallow joining any given channel.
This commit is contained in:
@@ -567,6 +567,11 @@ public:
|
||||
* @param sMessage The kick message.
|
||||
*/
|
||||
virtual void OnKick(const CNick& OpNick, const CString& sKickedNick, CChan& Channel, const CString& sMessage);
|
||||
/** This module hook is called just before ZNC tries to join an IRC channel.
|
||||
* @param Chan The channel which is about to get joined.
|
||||
* @return See CModule::EModRet.
|
||||
*/
|
||||
virtual EModRet OnJoining(CChan& Channel);
|
||||
/** Called when a nick joins a channel.
|
||||
* @param Nick The nick who joined.
|
||||
* @param Channel The channel which was joined.
|
||||
@@ -1112,6 +1117,7 @@ public:
|
||||
bool OnQuit(const CNick& Nick, const CString& sMessage, const std::vector<CChan*>& vChans);
|
||||
bool OnNick(const CNick& Nick, const CString& sNewNick, const std::vector<CChan*>& vChans);
|
||||
bool OnKick(const CNick& Nick, const CString& sOpNick, CChan& Channel, const CString& sMessage);
|
||||
bool OnJoining(CChan& Channel);
|
||||
bool OnJoin(const CNick& Nick, CChan& Channel);
|
||||
bool OnPart(const CNick& Nick, CChan& Channel, const CString& sMessage);
|
||||
bool OnInvite(const CNick& Nick, const CString& sChan);
|
||||
|
||||
@@ -28,6 +28,7 @@ void OnModCTCP(const CString& sMessage)
|
||||
void OnQuit(const CNick& Nick, const CString& sMessage, const vector<CChan*>& vChans)
|
||||
void OnNick(const CNick& Nick, const CString& sNewNick, const vector<CChan*>& vChans)
|
||||
void OnKick(const CNick& OpNick, const CString& sKickedNick, CChan& Channel, const CString& sMessage)
|
||||
EModRet OnJoining(CChan& Channel)
|
||||
void OnJoin(const CNick& Nick, CChan& Channel)
|
||||
void OnPart(const CNick& Nick, CChan& Channel, const CString& sMessage)
|
||||
EModRet OnChanBufferStarting(CChan& Chan, CClient& Client)
|
||||
|
||||
@@ -68,6 +68,7 @@ public:
|
||||
virtual void OnQuit(const CNick& Nick, const CString& sMessage, const std::vector<CChan*>& vChans);
|
||||
virtual void OnNick(const CNick& Nick, const CString& sNewNick, const std::vector<CChan*>& vChans);
|
||||
virtual void OnKick(const CNick& OpNick, const CString& sKickedNick, CChan& Channel, const CString& sMessage);
|
||||
virtual EModRet OnJoining(CChan& Channel);
|
||||
virtual void OnJoin(const CNick& Nick, CChan& Channel);
|
||||
virtual void OnPart(const CNick& Nick, CChan& Channel, const CString& sMessage);
|
||||
virtual EModRet OnChanBufferStarting(CChan& Chan, CClient& Client);
|
||||
|
||||
@@ -337,6 +337,7 @@ sub OnModCTCP {}
|
||||
sub OnQuit {}
|
||||
sub OnNick {}
|
||||
sub OnKick {}
|
||||
sub OnJoining {}
|
||||
sub OnJoin {}
|
||||
sub OnPart {}
|
||||
sub OnChanBufferStarting {}
|
||||
|
||||
@@ -28,6 +28,7 @@ void OnModCTCP(const CString& sMessage)
|
||||
void OnQuit(const CNick& Nick, const CString& sMessage, const vector<CChan*>& vChans)
|
||||
void OnNick(const CNick& Nick, const CString& sNewNick, const vector<CChan*>& vChans)
|
||||
void OnKick(const CNick& OpNick, const CString& sKickedNick, CChan& Channel, const CString& sMessage)
|
||||
EModRet OnJoining(CChan& Channel)
|
||||
void OnJoin(const CNick& Nick, CChan& Channel)
|
||||
void OnPart(const CNick& Nick, CChan& Channel, const CString& sMessage)
|
||||
EModRet OnChanBufferStarting(CChan& Chan, CClient& Client)
|
||||
|
||||
@@ -84,6 +84,7 @@ public:
|
||||
virtual void OnQuit(const CNick& Nick, const CString& sMessage, const std::vector<CChan*>& vChans);
|
||||
virtual void OnNick(const CNick& Nick, const CString& sNewNick, const std::vector<CChan*>& vChans);
|
||||
virtual void OnKick(const CNick& OpNick, const CString& sKickedNick, CChan& Channel, const CString& sMessage);
|
||||
virtual EModRet OnJoining(CChan& Channel);
|
||||
virtual void OnJoin(const CNick& Nick, CChan& Channel);
|
||||
virtual void OnPart(const CNick& Nick, CChan& Channel, const CString& sMessage);
|
||||
virtual EModRet OnChanBufferStarting(CChan& Chan, CClient& Client);
|
||||
|
||||
@@ -281,6 +281,9 @@ class Module:
|
||||
def OnKick(self, OpNick, sKickedNick, Channel, sMessage):
|
||||
pass
|
||||
|
||||
def OnJoining(self, Channel):
|
||||
pass
|
||||
|
||||
def OnJoin(self, Nick, Channel):
|
||||
pass
|
||||
|
||||
|
||||
@@ -762,6 +762,12 @@ void CIRCNetwork::JoinChans(set<CChan*>& sChans) {
|
||||
}
|
||||
|
||||
bool CIRCNetwork::JoinChan(CChan* pChan) {
|
||||
bool bReturn = false;
|
||||
NETWORKMODULECALL(OnJoining(*pChan), m_pUser, this, NULL, &bReturn);
|
||||
|
||||
if (bReturn)
|
||||
return false;
|
||||
|
||||
if (m_pUser->JoinTries() != 0 && pChan->GetJoinTries() >= m_pUser->JoinTries()) {
|
||||
PutStatus("The channel " + pChan->GetName() + " could not be joined, disabling it.");
|
||||
pChan->Disable();
|
||||
|
||||
@@ -589,6 +589,7 @@ void CModule::OnUnknownModCommand(const CString& sLine) {
|
||||
void CModule::OnQuit(const CNick& Nick, const CString& sMessage, const vector<CChan*>& vChans) {}
|
||||
void CModule::OnNick(const CNick& Nick, const CString& sNewNick, const vector<CChan*>& vChans) {}
|
||||
void CModule::OnKick(const CNick& Nick, const CString& sKickedNick, CChan& Channel, const CString& sMessage) {}
|
||||
CModule::EModRet CModule::OnJoining(CChan& Channel) { return CONTINUE; }
|
||||
void CModule::OnJoin(const CNick& Nick, CChan& Channel) {}
|
||||
void CModule::OnPart(const CNick& Nick, CChan& Channel, const CString& sMessage) {}
|
||||
CModule::EModRet CModule::OnInvite(const CNick& Nick, const CString& sChan) { return CONTINUE; }
|
||||
@@ -775,6 +776,7 @@ bool CModules::OnUserTopicRequest(CString& sChannel) { MODHALTCHK(OnUserTopicReq
|
||||
bool CModules::OnQuit(const CNick& Nick, const CString& sMessage, const vector<CChan*>& vChans) { MODUNLOADCHK(OnQuit(Nick, sMessage, vChans)); return false; }
|
||||
bool CModules::OnNick(const CNick& Nick, const CString& sNewNick, const vector<CChan*>& vChans) { MODUNLOADCHK(OnNick(Nick, sNewNick, vChans)); return false; }
|
||||
bool CModules::OnKick(const CNick& Nick, const CString& sKickedNick, CChan& Channel, const CString& sMessage) { MODUNLOADCHK(OnKick(Nick, sKickedNick, Channel, sMessage)); return false; }
|
||||
bool CModules::OnJoining(CChan& Channel) { MODHALTCHK(OnJoining(Channel)); }
|
||||
bool CModules::OnJoin(const CNick& Nick, CChan& Channel) { MODUNLOADCHK(OnJoin(Nick, Channel)); return false; }
|
||||
bool CModules::OnPart(const CNick& Nick, CChan& Channel, const CString& sMessage) { MODUNLOADCHK(OnPart(Nick, Channel, sMessage)); return false; }
|
||||
bool CModules::OnInvite(const CNick& Nick, const CString& sChan) { MODHALTCHK(OnInvite(Nick, sChan)); }
|
||||
|
||||
Reference in New Issue
Block a user