mirror of
https://github.com/znc/znc.git
synced 2026-05-09 14:54:53 +02:00
Add a new module hook OnIRCConnecting
This hook is called just before some user tries to connect() to an IRC server. git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1638 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
@@ -484,6 +484,7 @@ void CModule::OnPreRehash() {}
|
||||
void CModule::OnPostRehash() {}
|
||||
void CModule::OnIRCDisconnected() {}
|
||||
void CModule::OnIRCConnected() {}
|
||||
CModule::EModRet CModule::OnIRCConnecting(CIRCSock *IRCSock) { return CONTINUE; }
|
||||
CModule::EModRet CModule::OnIRCRegistration(CString& sPass, CString& sNick, CString& sIdent, CString& sRealName) { return CONTINUE; }
|
||||
CModule::EModRet CModule::OnBroadcast(CString& sMessage) { return CONTINUE; }
|
||||
|
||||
@@ -624,6 +625,7 @@ bool CModules::OnBoot() {
|
||||
bool CModules::OnPreRehash() { MODUNLOADCHK(OnPreRehash()); return false; }
|
||||
bool CModules::OnPostRehash() { MODUNLOADCHK(OnPostRehash()); return false; }
|
||||
bool CModules::OnIRCConnected() { MODUNLOADCHK(OnIRCConnected()); return false; }
|
||||
bool CModules::OnIRCConnecting(CIRCSock *pIRCSock) { MODHALTCHK(OnIRCConnecting(pIRCSock)); }
|
||||
bool CModules::OnIRCRegistration(CString& sPass, CString& sNick, CString& sIdent, CString& sRealName) { MODHALTCHK(OnIRCRegistration(sPass, sNick, sIdent, sRealName)); }
|
||||
bool CModules::OnBroadcast(CString& sMessage) { MODHALTCHK(OnBroadcast(sMessage)); }
|
||||
bool CModules::OnIRCDisconnected() { MODUNLOADCHK(OnIRCDisconnected()); return false; }
|
||||
|
||||
@@ -24,6 +24,7 @@ using std::set;
|
||||
class CAuthBase;
|
||||
class CChan;
|
||||
class CClient;
|
||||
class CIRCSock;
|
||||
// !Forward Declarations
|
||||
|
||||
// User Module Macros
|
||||
@@ -239,6 +240,7 @@ public:
|
||||
virtual void OnPostRehash();
|
||||
virtual void OnIRCDisconnected();
|
||||
virtual void OnIRCConnected();
|
||||
virtual EModRet OnIRCConnecting(CIRCSock *pIRCSock);
|
||||
virtual EModRet OnIRCRegistration(CString& sPass, CString& sNick, CString& sIdent, CString& sRealName);
|
||||
virtual EModRet OnBroadcast(CString& sMessage);
|
||||
|
||||
@@ -399,6 +401,7 @@ public:
|
||||
bool OnPostRehash();
|
||||
bool OnIRCDisconnected();
|
||||
bool OnIRCConnected();
|
||||
bool OnIRCConnecting(CIRCSock *pIRCSock);
|
||||
bool OnIRCRegistration(CString& sPass, CString& sNick, CString& sIdent, CString& sRealName);
|
||||
bool OnBroadcast(CString& sMessage);
|
||||
|
||||
|
||||
@@ -165,6 +165,13 @@ bool CZNC::ConnectUser(CUser *pUser) {
|
||||
}
|
||||
#endif
|
||||
|
||||
MODULECALL(OnIRCConnecting(pIRCSock), pUser, NULL,
|
||||
DEBUG("Some module aborted the connection attempt");
|
||||
ReleaseISpoof();
|
||||
delete pIRCSock;
|
||||
return false;
|
||||
);
|
||||
|
||||
if (!m_Manager.Connect(pServer->GetName(), pServer->GetPort(), sSockName, 120, bSSL, pUser->GetVHost(), pIRCSock)) {
|
||||
ReleaseISpoof();
|
||||
pUser->PutStatus("Unable to connect. (Bad host?)");
|
||||
|
||||
Reference in New Issue
Block a user