]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modules/m_operjoin.cpp
Changed to use __single_client_alloc, faster on most systems in a single thread
[user/henk/code/inspircd.git] / src / modules / m_operjoin.cpp
1 // operjoin module by typobox43
2
3 using namespace std;
4
5 #include "users.h"
6 #include "channels.h"
7 #include "modules.h"
8 #include "helperfuncs.h"
9
10 /* $ModDesc: Forces opers to join a specified channel on oper-up */
11
12 Server *Srv;
13
14 class ModuleOperjoin : public Module {
15
16         private:
17
18                 std::string operChan;
19                 ConfigReader* conf;
20
21         public:
22
23                 ModuleOperjoin() {
24
25                         Srv = new Server;
26                         conf = new ConfigReader;
27
28                         operChan = conf->ReadValue("operjoin", "channel", 0);
29
30                 }
31
32                 virtual ~ModuleOperjoin() {
33
34                         delete Srv;
35                         delete conf;
36
37                 }
38
39                 virtual Version GetVersion() {
40
41                         return Version(1,0,0,1,VF_VENDOR);
42
43                 }
44
45                 virtual void OnOper(userrec* user) {
46
47                         if(operChan != "") {
48
49                                 Srv->JoinUserToChannel(user,operChan,"");
50
51                         }
52
53                 }
54
55 };
56
57 class ModuleOperjoinFactory : public ModuleFactory
58 {
59  public:
60         ModuleOperjoinFactory()
61         {
62         }
63
64         ~ModuleOperjoinFactory()
65         {
66         }
67
68         virtual Module * CreateModule()
69         {
70                 return new ModuleOperjoin;
71         }
72
73 };
74
75 extern "C" void * init_module( void )
76 {
77         return new ModuleOperjoinFactory;
78 }
79