From: <sil...@us...> - 2008-11-24 17:56:38
|
Revision: 1271 http://znc.svn.sourceforge.net/znc/?rev=1271&view=rev Author: silverleo Date: 2008-11-24 17:56:34 +0000 (Mon, 24 Nov 2008) Log Message: ----------- Added OnIRCRegistration(). Patch from Freman. Thanks :) Modified Paths: -------------- trunk/IRCSock.cpp trunk/Modules.cpp trunk/Modules.h trunk/modules/modperl.cpp trunk/modules/sample.cpp Modified: trunk/IRCSock.cpp =================================================================== --- trunk/IRCSock.cpp 2008-11-20 11:45:51 UTC (rev 1270) +++ trunk/IRCSock.cpp 2008-11-24 17:56:34 UTC (rev 1271) @@ -805,12 +805,19 @@ DEBUG_ONLY(cout << GetSockName() << " == Connected()" << endl); m_pUser->IRCConnected(this); - if (!m_sPass.empty()) { - PutIRC("PASS " + m_sPass); + CString sPass = m_sPass; + CString sNick = m_pUser->GetNick(); + CString sIdent = m_pUser->GetIdent(); + CString sRealName = m_pUser->GetRealName(); + + MODULECALL(OnIRCRegistration(sPass, sNick, sIdent, sRealName), m_pUser, NULL, return); + + if (!sPass.empty()) { + PutIRC("PASS " + sPass); } - PutIRC("NICK " + m_pUser->GetNick()); - PutIRC("USER " + m_pUser->GetIdent() + " \"" + m_pUser->GetIdent() + "\" \"" + m_pUser->GetIdent() + "\" :" + m_pUser->GetRealName()); + PutIRC("NICK " + sNick); + PutIRC("USER " + sIdent + " \"" + sIdent + "\" \"" + sIdent + "\" :" + sRealName); } void CIRCSock::Disconnected() { Modified: trunk/Modules.cpp =================================================================== --- trunk/Modules.cpp 2008-11-20 11:45:51 UTC (rev 1270) +++ trunk/Modules.cpp 2008-11-24 17:56:34 UTC (rev 1271) @@ -448,6 +448,7 @@ void CModule::OnPostRehash() {} void CModule::OnIRCDisconnected() {} void CModule::OnIRCConnected() {} +CModule::EModRet CModule::OnIRCRegistration(CString& sPass, CString& sNick, CString& sIdent, CString& sRealName) { return CONTINUE; } CModule::EModRet CModule::OnBroadcast(CString& sMessage) { return CONTINUE; } CModule::EModRet CModule::OnDCCUserSend(const CNick& RemoteNick, unsigned long uLongIP, unsigned short uPort, const CString& sFile, unsigned long uFileSize) { return CONTINUE; } @@ -580,6 +581,7 @@ bool CModules::OnPreRehash() { MODUNLOADCHK(OnPreRehash()); return false; } bool CModules::OnPostRehash() { MODUNLOADCHK(OnPostRehash()); return false; } bool CModules::OnIRCConnected() { MODUNLOADCHK(OnIRCConnected()); return false; } +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; } bool CModules::OnDCCUserSend(const CNick& RemoteNick, unsigned long uLongIP, unsigned short uPort, const CString& sFile, unsigned long uFileSize) { MODHALTCHK(OnDCCUserSend(RemoteNick, uLongIP, uPort, sFile, uFileSize)); } Modified: trunk/Modules.h =================================================================== --- trunk/Modules.h 2008-11-20 11:45:51 UTC (rev 1270) +++ trunk/Modules.h 2008-11-24 17:56:34 UTC (rev 1271) @@ -229,6 +229,7 @@ virtual void OnPostRehash(); virtual void OnIRCDisconnected(); virtual void OnIRCConnected(); + virtual EModRet OnIRCRegistration(CString& sPass, CString& sNick, CString& sIdent, CString& sRealName); virtual EModRet OnBroadcast(CString& sMessage); virtual EModRet OnDCCUserSend(const CNick& RemoteNick, unsigned long uLongIP, unsigned short uPort, const CString& sFile, unsigned long uFileSize); @@ -372,6 +373,7 @@ virtual bool OnPostRehash(); virtual bool OnIRCDisconnected(); virtual bool OnIRCConnected(); + virtual bool OnIRCRegistration(CString& sPass, CString& sNick, CString& sIdent, CString& sRealName); virtual bool OnBroadcast(CString& sMessage); virtual bool OnDCCUserSend(const CNick& RemoteNick, unsigned long uLongIP, unsigned short uPort, const CString& sFile, unsigned long uFileSize); Modified: trunk/modules/modperl.cpp =================================================================== --- trunk/modules/modperl.cpp 2008-11-20 11:45:51 UTC (rev 1270) +++ trunk/modules/modperl.cpp 2008-11-24 17:56:34 UTC (rev 1271) @@ -333,6 +333,10 @@ virtual EModRet OnUserRaw(CString& sLine) { return(CBSingle("OnUserRaw", sLine)); } virtual EModRet OnRaw(CString& sLine) { return(CBSingle("OnRaw", sLine)); } + virtual EModRet OnIRCRegistration(CString& sPass, CString& sNick, CString& sIdent, CString& sRealName) { + return(CBFour("OnIRCRegistration", sPass, sNick, sIdent, sRealName)); + } + virtual void OnModCommand(const CString& sCommand) { if (CBSingle("OnModCommand", sCommand) == 0) Modified: trunk/modules/sample.cpp =================================================================== --- trunk/modules/sample.cpp 2008-11-20 11:45:51 UTC (rev 1270) +++ trunk/modules/sample.cpp 2008-11-24 17:56:34 UTC (rev 1271) @@ -52,6 +52,11 @@ PutModule("You got disconnected BoyOh."); } + virtual EModRet OnIRCRegistration(CString& sPass, CString& sNick, CString& sIdent, CString& sRealName) { + sRealName += " - ZNC"; + return CONTINUE; + } + virtual EModRet OnBroadcast(CString& sMessage) { PutModule("------ [" + sMessage + "]"); sMessage = "======== [" + sMessage + "] ========"; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |