]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modules/m_chancreate.cpp
Revert 05e6330fbd6e9a427c09cf90e2cada10656c48f7 and reference HELPOP instead (afteral...
[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                 Implementation eventlist[] = { I_OnUserJoin };
26                 ServerInstance->Modules->Attach(eventlist, this, 1);
27         }
28
29         Version GetVersion()
30         {
31                 return Version("Creates a snomask with notices whenever a new channel is created",VF_VENDOR);
32         }
33
34
35         void OnUserJoin(Membership* memb, bool sync, bool created, CUList& except)
36         {
37                 if (created)
38                 {
39                         if (IS_LOCAL(memb->user))
40                                 ServerInstance->SNO->WriteToSnoMask('j', "Channel %s created by %s!%s@%s",
41                                         memb->chan->name.c_str(), memb->user->nick.c_str(),
42                                         memb->user->ident.c_str(), memb->user->host.c_str());
43                         else
44                                 ServerInstance->SNO->WriteGlobalSno('J', "Channel %s created by %s!%s@%s",
45                                         memb->chan->name.c_str(), memb->user->nick.c_str(),
46                                         memb->user->ident.c_str(), memb->user->host.c_str());
47                 }
48         }
49 };
50
51 MODULE_INIT(ModuleChanCreate)