]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modules/m_httpd_acl.cpp
Skeleton ACL module, and hooks for it. This will provide ip restrictions, passwording...
[user/henk/code/inspircd.git] / src / modules / m_httpd_acl.cpp
1 /*       +------------------------------------+
2  *       | Inspire Internet Relay Chat Daemon |
3  *       +------------------------------------+
4  *
5  *  InspIRCd: (C) 2002-2008 InspIRCd Development Team
6  * See: http://www.inspircd.org/wiki/index.php/Credits
7  *
8  * This program is free but copyrighted software; see
9  *          the file COPYING for details.
10  *
11  * ---------------------------------------------------
12  */
13
14 #include "inspircd.h"
15 #include "httpd.h"
16 #include "protocol.h"
17
18 /* $ModDesc: Provides access control lists (passwording of resources, ip restrictions etc) to m_httpd.so dependent modules */
19 /* $ModDep: httpd.h */
20
21 class ModuleHTTPAccessList : public Module
22 {
23         
24         std::string stylesheet;
25         bool changed;
26
27  public:
28
29         void ReadConfig()
30         {
31                 ConfigReader c(ServerInstance);
32         }
33
34         ModuleHTTPAccessList(InspIRCd* Me) : Module(Me)
35         {
36                 ReadConfig();
37                 this->changed = true;
38                 Implementation eventlist[] = { I_OnEvent, I_OnRequest };
39                 ServerInstance->Modules->Attach(eventlist, this, 2);
40         }
41
42         void OnEvent(Event* event)
43         {
44                 std::stringstream data("");
45
46                 if (event->GetEventID() == "httpd_url")
47                 {
48                         ServerInstance->Logs->Log("m_http_stats", DEBUG,"Handling httpd event");
49                         HTTPRequest* http = (HTTPRequest*)event->GetData();
50
51
52
53                         //if ((http->GetURI() == "/stats") || (http->GetURI() == "/stats/"))
54                         //{
55                                 /* Send the document back to m_httpd */
56                         //      HTTPDocument response(http->sock, &data, 200);
57                         //      response.headers.SetHeader("X-Powered-By", "m_httpd_stats.so");
58                         //      response.headers.SetHeader("Content-Type", "text/xml");
59                         //      Request req((char*)&response, (Module*)this, event->GetSource());
60                         //      req.Send();
61                         //}
62                 }
63         }
64
65         const char* OnRequest(Request* request)
66         {
67                 return NULL;
68         }
69
70         virtual ~ModuleHTTPAccessList()
71         {
72         }
73
74         virtual Version GetVersion()
75         {
76                 return Version(1, 2, 0, 0, VF_VENDOR, API_VERSION);
77         }
78 };
79
80 MODULE_INIT(ModuleHTTPAccessList)