]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modules/m_seenicks.cpp
...because every now and again, i have to do a massive commit.
[user/henk/code/inspircd.git] / src / modules / m_seenicks.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: Provides support for seeing local and remote nickchanges via snomasks */
17
18 class ModuleSeeNicks : public Module
19 {
20  public:
21         ModuleSeeNicks()
22                         {
23                 ServerInstance->SNO->EnableSnomask('n',"NICK");
24                 ServerInstance->SNO->EnableSnomask('N',"REMOTENICK");
25                 Implementation eventlist[] = { I_OnUserPostNick };
26                 ServerInstance->Modules->Attach(eventlist, this, 1);
27         }
28
29         virtual ~ModuleSeeNicks()
30         {
31                 ServerInstance->SNO->DisableSnomask('n');
32                 ServerInstance->SNO->DisableSnomask('N');
33         }
34
35         virtual Version GetVersion()
36         {
37                 return Version("Provides support for seeing local and remote nickchanges via snomasks", VF_VENDOR);
38         }
39
40
41         virtual void OnUserPostNick(User* user, const std::string &oldnick)
42         {
43                 ServerInstance->SNO->WriteToSnoMask(IS_LOCAL(user) ? 'n' : 'N',"User %s changed their nickname to %s", oldnick.c_str(), user->nick.c_str());
44         }
45 };
46
47 MODULE_INIT(ModuleSeeNicks)