]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modules/m_httpd_stats.cpp
c02a1a2150c26a7c7a7c09fddb5dc57e034eaee8
[user/henk/code/inspircd.git] / src / modules / m_httpd_stats.cpp
1 /*       +------------------------------------+
2  *       | Inspire Internet Relay Chat Daemon |
3  *       +------------------------------------+
4  *
5  *  InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev.
6  *                     E-mail:
7  *              <brain@chatspike.net>
8  *                <Craig@chatspike.net>
9  *     
10  * Written by Craig Edwards, Craig McLure, and others.
11  * This program is free but copyrighted software; see
12  *          the file COPYING for details.
13  *
14  * ---------------------------------------------------
15  */
16
17 using namespace std;
18
19 #include <stdio.h>
20 #include "users.h"
21 #include "channels.h"
22 #include "modules.h"
23 #include "inspsocket.h"
24 #include "helperfuncs.h"
25 #include "httpd.h"
26
27 /* $ModDesc: Provides statistics over HTTP via m_httpd.so */
28
29 class ModuleHttpStats : public Module
30 {
31         int port;
32         std::string host;
33         std::string bindip;
34         std::string indexfile;
35
36         FileReader index;
37
38         HttpSocket* http;
39
40  public:
41
42         void ReadConfig()
43         {
44         }
45
46         ModuleHttpStats(Server* Me) : Module::Module(Me)
47         {
48                 Srv = Me;
49                 ReadConfig();
50         }
51
52         void OnEvent(Event* event)
53         {
54                 if (event->GetID() == "httpd_url")
55                 {
56                         log(DEBUG,"HTTP URL!");
57                 }
58         }
59
60         char* OnRequest(Request* request)
61         {
62                 return NULL;
63         }
64
65         void Implements(char* List)
66         {
67                 List[I_OnEvent] = List[I_OnRequest] = 1;
68         }
69
70         virtual ~ModuleHttpStats()
71         {
72                 Srv->DelSocket(http);
73         }
74
75         virtual Version GetVersion()
76         {
77                 return Version(1,0,0,0,VF_STATIC|VF_VENDOR);
78         }
79 };
80
81
82 class ModuleHttpStatsFactory : public ModuleFactory
83 {
84  public:
85         ModuleHttpStatsFactory()
86         {
87         }
88         
89         ~ModuleHttpStatsFactory()
90         {
91         }
92         
93         virtual Module * CreateModule(Server* Me)
94         {
95                 return new ModuleHttpStats(Me);
96         }
97 };
98
99
100 extern "C" void * init_module( void )
101 {
102         return new ModuleHttpStatsFactory;
103 }