Initial commit of webmods - still lots of work to be done

git-svn-id: https://znc.svn.sourceforge.net/svnroot/znc/trunk@1784 726aef4b-f618-498e-8847-2d620e286838
This commit is contained in:
prozacx
2010-02-22 07:40:22 +00:00
parent 7331fe3fd2
commit c09dca3b8e
41 changed files with 2845 additions and 1109 deletions
+22 -1
View File
@@ -12,6 +12,7 @@
#include "IRCSock.h"
#include "User.h"
#include "znc.h"
#include "WebModules.h"
#define CALLMOD(MOD, CLIENT, USER, FUNC) { \
CModule* pModule = CZNC::Get().GetModules().FindModule(MOD); \
@@ -67,8 +68,28 @@ void CClient::ReadLine(const CString& sData) {
if (IsAttached()) {
MODULECALL(OnUserRaw(sLine), m_pUser, this, return);
} else {
if (CZNC::Get().GetModules().OnUnknownUserRaw(this, sLine))
// If it's an HTTP Request - Check the webmods
if (sLine.WildCmp("GET * HTTP/1.?") || sLine.WildCmp("POST * HTTP/1.?")) {
CModule* pMod = new CModule(NULL, "<webmod>", "");
pMod->SetFake(true);
CWebSock* pSock = new CWebSock(pMod);
CZNC::Get().GetManager().SwapSockByAddr(pSock, this);
// And don't forget to give it some sane name / timeout
pSock->SetSockName("WebMod::Client");
pSock->SetTimeout(120);
// TODO can we somehow get rid of this?
pSock->ReadLine(sLine);
pSock->PushBuff("", 0, true);
return;
}
if (CZNC::Get().GetModules().OnUnknownUserRaw(this, sLine)) {
return;
}
}
#endif