]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modules/m_nonotice.cpp
Added m_blockcolor, implements unreal-style mode +c for color blocking
[user/henk/code/inspircd.git] / src / modules / m_nonotice.cpp
1 #include <stdio.h>
2
3 #include "users.h"
4 #include "channels.h"
5 #include "modules.h"
6
7 /* $ModDesc: Provides support for unreal-style channel mode +T */
8
9 class ModuleNoNotice : public Module
10 {
11         Server *Srv;
12         
13  public:
14  
15         ModuleNoNotice()
16         {
17                 Srv = new Server;
18                 Srv->AddExtendedMode('T',MT_CHANNEL,false,0,0);
19         }
20         
21         virtual int OnUserPreNotice(userrec* user,void* dest,int target_type, std::string text)
22         {
23                 if (target_type == TYPE_CHANNEL)
24                 {
25                         chanrec* c = (chanrec*)dest;
26                         if (c->IsCustomModeSet('T'))
27                         {
28                                 if ((Srv->ChanMode(user,c) == '@') || (Srv->ChanMode(user,c) == '%'))
29                                 {
30                                         // ops and halfops can still /NOTICE the channel
31                                         return 0;
32                                 }
33                                 else
34                                 {
35                                         WriteServ(user->fd,"404 %s %s :Can't send NOTICE to channel (+T set)",user->nick, c->name);
36                                         return 1;
37                                 }
38                         }
39                 }
40                 return 0;
41         }
42         
43         virtual ~ModuleNoNotice()
44         {
45                 delete Srv;
46         }
47         
48         virtual Version GetVersion()
49         {
50                 return Version(1,0,0,0);
51         }
52 };
53
54
55 class ModuleNoNoticeFactory : public ModuleFactory
56 {
57  public:
58         ModuleNoNoticeFactory()
59         {
60         }
61         
62         ~ModuleNoNoticeFactory()
63         {
64         }
65         
66         virtual Module * CreateModule()
67         {
68                 return new ModuleNoNotice;
69         }
70         
71 };
72
73
74 extern "C" void * init_module( void )
75 {
76         return new ModuleNoNoticeFactory;
77 }
78