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:
psychon
2009-09-26 14:49:15 +00:00
parent 6cdc7fb527
commit 5ccbd002c0
3 changed files with 12 additions and 0 deletions
+2
View File
@@ -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; }
+3
View File
@@ -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);
+7
View File
@@ -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?)");