mirror of
https://github.com/znc/znc.git
synced 2026-03-28 17:42:41 +01:00
Rename OnUserAttached and OnUserDetached and add OnClientConnect
OnUserAttached is renamed to OnClientLogin and OnUserDetached to OnClientDisconnect. This adds some new function with different arguments for the old names to cause warnings from -Woverloaded-virtual while compiling. This patch also adds OnClientConnect() which is called when the low-level raw connection is established. (No SSL-handshake was done at this point yet!) git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1266 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
@@ -660,7 +660,7 @@ void CClient::AcceptLogin(CUser& User) {
|
||||
|
||||
SendMotd();
|
||||
|
||||
MODULECALL(OnUserAttached(), m_pUser, this, );
|
||||
MODULECALL(OnClientLogin(), m_pUser, this, );
|
||||
}
|
||||
|
||||
void CClient::StartLoginTimeout() {
|
||||
@@ -693,7 +693,7 @@ void CClient::Disconnected() {
|
||||
|
||||
m_pIRCSock = NULL;
|
||||
|
||||
MODULECALL(OnUserDetached(), m_pUser, this, );
|
||||
MODULECALL(OnClientDisconnect(), m_pUser, this, );
|
||||
}
|
||||
|
||||
void CClient::ReachedMaxBuffer() {
|
||||
|
||||
13
Modules.cpp
13
Modules.cpp
@@ -473,8 +473,8 @@ void CModule::OnKick(const CNick& Nick, const CString& sKickedNick, CChan& Chann
|
||||
void CModule::OnJoin(const CNick& Nick, CChan& Channel) {}
|
||||
void CModule::OnPart(const CNick& Nick, CChan& Channel) {}
|
||||
|
||||
void CModule::OnUserAttached() {}
|
||||
void CModule::OnUserDetached() {}
|
||||
void CModule::OnClientLogin() {}
|
||||
void CModule::OnClientDisconnect() {}
|
||||
CModule::EModRet CModule::OnUserRaw(CString& sLine) { return CONTINUE; }
|
||||
CModule::EModRet CModule::OnUserCTCPReply(CString& sTarget, CString& sMessage) { return CONTINUE; }
|
||||
CModule::EModRet CModule::OnUserCTCP(CString& sTarget, CString& sMessage) { return CONTINUE; }
|
||||
@@ -539,6 +539,7 @@ bool CModule::PutModNotice(const CString& sLine, const CString& sIdent, const CS
|
||||
///////////////////
|
||||
CModule::EModRet CGlobalModule::OnConfigLine(const CString& sName, const CString& sValue, CUser* pUser, CChan* pChan) { return CONTINUE; }
|
||||
CModule::EModRet CGlobalModule::OnDeleteUser(CUser& User) { return CONTINUE; }
|
||||
void CGlobalModule::OnClientConnect(CClient* pClient, const CString& sHost, unsigned short uPort) {}
|
||||
CModule::EModRet CGlobalModule::OnLoginAttempt(CSmartPtr<CAuthBase> Auth) { return CONTINUE; }
|
||||
void CGlobalModule::OnFailedLogin(const CString& sUsername, const CString& sRemoteIP) {}
|
||||
|
||||
@@ -591,8 +592,8 @@ bool CModules::OnRawMode(const CNick& OpNick, CChan& Channel, const CString& sMo
|
||||
bool CModules::OnMode(const CNick& OpNick, CChan& Channel, char uMode, const CString& sArg, bool bAdded, bool bNoChange) { MODUNLOADCHK(OnMode(OpNick, Channel, uMode, sArg, bAdded, bNoChange)); return false; }
|
||||
bool CModules::OnRaw(CString& sLine) { MODHALTCHK(OnRaw(sLine)); }
|
||||
|
||||
bool CModules::OnUserAttached() { MODUNLOADCHK(OnUserAttached()); return false; }
|
||||
bool CModules::OnUserDetached() { MODUNLOADCHK(OnUserDetached()); return false; }
|
||||
bool CModules::OnClientLogin() { MODUNLOADCHK(OnClientLogin()); return false; }
|
||||
bool CModules::OnClientDisconnect() { MODUNLOADCHK(OnClientDisconnect()); return false; }
|
||||
bool CModules::OnUserRaw(CString& sLine) { MODHALTCHK(OnUserRaw(sLine)); }
|
||||
bool CModules::OnUserCTCPReply(CString& sTarget, CString& sMessage) { MODHALTCHK(OnUserCTCPReply(sTarget, sMessage)); }
|
||||
bool CModules::OnUserCTCP(CString& sTarget, CString& sMessage) { MODHALTCHK(OnUserCTCP(sTarget, sMessage)); }
|
||||
@@ -635,6 +636,10 @@ bool CGlobalModules::OnDeleteUser(CUser& User) {
|
||||
GLOBALMODHALTCHK(OnDeleteUser(User));
|
||||
}
|
||||
|
||||
void CGlobalModules::OnClientConnect(CClient* pClient, const CString& sHost, unsigned short uPort) {
|
||||
GLOBALMODCALL(OnClientConnect(pClient, sHost, uPort));
|
||||
}
|
||||
|
||||
bool CGlobalModules::OnLoginAttempt(CSmartPtr<CAuthBase> Auth) {
|
||||
GLOBALMODHALTCHK(OnLoginAttempt(Auth));
|
||||
}
|
||||
|
||||
12
Modules.h
12
Modules.h
@@ -254,8 +254,10 @@ public:
|
||||
virtual void OnJoin(const CNick& Nick, CChan& Channel);
|
||||
virtual void OnPart(const CNick& Nick, CChan& Channel);
|
||||
|
||||
virtual void OnUserAttached();
|
||||
virtual void OnUserDetached();
|
||||
virtual void OnUserAttached(bool thisFunctionWasRemoved, bool UseOnClientLogin) {}
|
||||
virtual void OnUserDetached(bool thisFunctionWasRemoved, bool UseOnClientDisconnect) {}
|
||||
virtual void OnClientLogin();
|
||||
virtual void OnClientDisconnect();
|
||||
virtual EModRet OnUserRaw(CString& sLine);
|
||||
virtual EModRet OnUserCTCPReply(CString& sTarget, CString& sMessage);
|
||||
virtual EModRet OnUserCTCP(CString& sTarget, CString& sMessage);
|
||||
@@ -395,8 +397,8 @@ public:
|
||||
virtual bool OnJoin(const CNick& Nick, CChan& Channel);
|
||||
virtual bool OnPart(const CNick& Nick, CChan& Channel);
|
||||
|
||||
virtual bool OnUserAttached();
|
||||
virtual bool OnUserDetached();
|
||||
virtual bool OnClientLogin();
|
||||
virtual bool OnClientDisconnect();
|
||||
virtual bool OnUserRaw(CString& sLine);
|
||||
virtual bool OnUserCTCPReply(CString& sTarget, CString& sMessage);
|
||||
virtual bool OnUserCTCP(CString& sTarget, CString& sMessage);
|
||||
@@ -441,6 +443,7 @@ public:
|
||||
|
||||
virtual EModRet OnConfigLine(const CString& sName, const CString& sValue, CUser* pUser, CChan* pChan);
|
||||
virtual EModRet OnDeleteUser(CUser& User);
|
||||
virtual void OnClientConnect(CClient* pClient, const CString& sHost, unsigned short uPort);
|
||||
virtual EModRet OnLoginAttempt(CSmartPtr<CAuthBase> Auth);
|
||||
virtual void OnFailedLogin(const CString& sUsername, const CString& sRemoteIP);
|
||||
private:
|
||||
@@ -453,6 +456,7 @@ public:
|
||||
|
||||
virtual bool OnConfigLine(const CString& sName, const CString& sValue, CUser* pUser, CChan* pChan);
|
||||
virtual bool OnDeleteUser(CUser& User);
|
||||
virtual void OnClientConnect(CClient* pClient, const CString& sHost, unsigned short uPort);
|
||||
virtual bool OnLoginAttempt(CSmartPtr<CAuthBase> Auth);
|
||||
virtual void OnFailedLogin(const CString& sUsername, const CString& sRemoteIP);
|
||||
private:
|
||||
|
||||
@@ -138,11 +138,11 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
virtual void OnUserAttached()
|
||||
virtual void OnClientLogin()
|
||||
{
|
||||
Back(true);
|
||||
}
|
||||
virtual void OnUserDetached()
|
||||
virtual void OnClientDisconnect()
|
||||
{
|
||||
Away();
|
||||
}
|
||||
|
||||
@@ -94,11 +94,11 @@ public:
|
||||
RemTimer("BackNickTimer");
|
||||
}
|
||||
|
||||
virtual void OnUserAttached() {
|
||||
virtual void OnClientLogin() {
|
||||
StartBackNickTimer();
|
||||
}
|
||||
|
||||
virtual void OnUserDetached() {
|
||||
virtual void OnClientDisconnect() {
|
||||
if (!m_pUser->IsUserAttached()) {
|
||||
StartAwayNickTimer();
|
||||
}
|
||||
|
||||
@@ -62,14 +62,14 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual void OnUserAttached()
|
||||
virtual void OnClientLogin()
|
||||
{
|
||||
stringstream s;
|
||||
s << "You have " << m_ssUidls.size() << " emails.";
|
||||
PutModule(s.str());
|
||||
StartTimer();
|
||||
}
|
||||
virtual void OnUserDetached()
|
||||
virtual void OnClientDisconnect()
|
||||
{
|
||||
RemTimer("EMAIL::" + m_pUser->GetUserName());
|
||||
}
|
||||
|
||||
@@ -302,8 +302,8 @@ public:
|
||||
void UnSetUser() { m_pUser = NULL; }
|
||||
|
||||
virtual bool OnLoad(const CString & sArgs, CString & sMessage);
|
||||
virtual void OnUserAttached() { CBNone("OnUserAttached"); }
|
||||
virtual void OnUserDetached() { CBNone("OnUserDetached"); }
|
||||
virtual void OnClientLogin() { CBNone("OnClientLogin"); }
|
||||
virtual void OnClientDisconnect() { CBNone("OnClientDisconnect"); }
|
||||
virtual void OnIRCDisconnected() { CBNone("OnIRCDisconnected"); }
|
||||
virtual void OnIRCConnected() { CBNone("OnIRCConnected"); }
|
||||
|
||||
|
||||
@@ -148,7 +148,7 @@ public:
|
||||
m_spInjectedPrefixes.erase(m_pUser);
|
||||
}
|
||||
|
||||
virtual void OnUserAttached() {
|
||||
virtual void OnClientLogin() {
|
||||
if (m_spInjectedPrefixes.find(m_pUser) == m_spInjectedPrefixes.end()) {
|
||||
m_pClient->PutClient(":" + GetIRCServer(m_pUser) + " 005 " + m_pUser->GetIRCNick().GetNick() + " CHANTYPES=" + m_pUser->GetChanPrefixes() + "~ :are supported by this server.");
|
||||
}
|
||||
@@ -193,7 +193,7 @@ public:
|
||||
}
|
||||
}
|
||||
|
||||
virtual void OnUserDetached() {
|
||||
virtual void OnClientDisconnect() {
|
||||
if (!m_pUser->IsUserAttached() && !m_pUser->IsBeingDeleted()) {
|
||||
for (set<CPartylineChannel*>::iterator it = m_ssChannels.begin(); it != m_ssChannels.end(); it++) {
|
||||
const set<CString>& ssNicks = (*it)->GetNicks();
|
||||
|
||||
@@ -135,7 +135,7 @@ public:
|
||||
return true;
|
||||
}
|
||||
|
||||
virtual void OnUserAttached()
|
||||
virtual void OnClientLogin()
|
||||
{
|
||||
CString sName = "SCHAT::" + m_pUser->GetUserName();
|
||||
for (u_int a = 0; a < m_pManager->size(); a++)
|
||||
|
||||
@@ -79,11 +79,11 @@ public:
|
||||
SetAway(false);
|
||||
}
|
||||
|
||||
virtual void OnUserAttached() {
|
||||
virtual void OnClientLogin() {
|
||||
SetBack();
|
||||
}
|
||||
|
||||
virtual void OnUserDetached() {
|
||||
virtual void OnClientDisconnect() {
|
||||
/* There might still be other clients */
|
||||
if (!m_pUser->IsUserAttached())
|
||||
SetAway();
|
||||
|
||||
@@ -163,7 +163,7 @@ public:
|
||||
Process(OpNick, "* " + OpNick.GetNick() + " sets mode: " + sModes + " " + sArgs + " on " + Channel.GetName(), Channel.GetName());
|
||||
}
|
||||
|
||||
virtual void OnUserAttached() {
|
||||
virtual void OnClientLogin() {
|
||||
CString sBufLine;
|
||||
while (m_Buffer.GetNextLine(m_pUser->GetCurNick(), sBufLine)) {
|
||||
PutUser(sBufLine);
|
||||
|
||||
4
znc.h
4
znc.h
@@ -234,7 +234,9 @@ public:
|
||||
}
|
||||
|
||||
virtual Csock* GetSockObj(const CString& sHost, unsigned short uPort) {
|
||||
return new CClient(sHost, uPort);
|
||||
CClient *pClient = new CClient(sHost, uPort);
|
||||
CZNC::Get().GetModules().OnClientConnect(pClient, sHost, uPort);
|
||||
return pClient;
|
||||
}
|
||||
|
||||
virtual void SockError(int iErrno) {
|
||||
|
||||
Reference in New Issue
Block a user