]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modules/m_chancreate.cpp
...because every now and again, i have to do a massive commit.
[user/henk/code/inspircd.git] / src / modules / m_chancreate.cpp
1 /*       +------------------------------------+
2  *       | Inspire Internet Relay Chat Daemon |
3  *       +------------------------------------+
4  *
5  *  InspIRCd: (C) 2002-2010 InspIRCd Development Team
6  * See: http://wiki.inspircd.org/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
16 /* $ModDesc: Creates a snomask with notices whenever a new channel is created */
17
18 class ModuleChanCreate : public Module
19 {
20  private:
21  public:
22         ModuleChanCreate()
23                         {
24                 ServerInstance->SNO->EnableSnomask('j', "CHANCREATE");
25                 ServerInstance->SNO->EnableSnomask('J', "REMOTECHANCREATE");
26                 Implementation eventlist[] = { I_OnUserJoin };
27                 ServerInstance->Modules->Attach(eventlist, this, 1);
28         }
29
30         ~ModuleChanCreate()
31         {
32                 ServerInstance->SNO->DisableSnomask('j');
33                 ServerInstance->SNO->DisableSnomask('J');
34         }
35
36         Version GetVersion()
37         {
38                 return Version("Creates a snomask with notices whenever a new channel is created",VF_VENDOR);
39         }
40
41
42         void OnUserJoin(Membership* memb, bool sync, bool created, CUList& except)
43         {
44                 if (created)
45                 {
46                         ServerInstance->SNO->WriteToSnoMask(IS_LOCAL(memb->user) ? 'j' : 'J', "Channel %s created by %s!%s@%s",
47                                 memb->chan->name.c_str(), memb->user->nick.c_str(), memb->user->ident.c_str(), memb->user->host.c_str());
48                 }
49         }
50 };
51
52 MODULE_INIT(ModuleChanCreate)