]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modules/m_seenicks.cpp
82deda0cd6514cbf153ffc00ccc0ef56d5ac107b
[user/henk/code/inspircd.git] / src / modules / m_seenicks.cpp
1 /*       +------------------------------------+
2  *       | Inspire Internet Relay Chat Daemon |
3  *       +------------------------------------+
4  *
5  *  InspIRCd: (C) 2002-2007 InspIRCd Development Team
6  * See: http://www.inspircd.org/wiki/index.php/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(InspIRCd* Me)
22                 : Module(Me)
23         {
24                 ServerInstance->SNO->EnableSnomask('n',"NICK");
25                 ServerInstance->SNO->EnableSnomask('N',"REMOTENICK");
26         }
27
28         virtual ~ModuleSeeNicks()
29         {
30                 ServerInstance->SNO->DisableSnomask('n');
31                 ServerInstance->SNO->DisableSnomask('N');
32         }
33
34         virtual Version GetVersion()
35         {
36                 return Version(1,1,0,1, VF_VENDOR, API_VERSION);
37         }
38
39         void Implements(char* List)
40         {
41                 List[I_OnUserPostNick] = 1;
42         }
43
44         virtual void OnUserPostNick(User* user, const std::string &oldnick)
45         {
46                 ServerInstance->SNO->WriteToSnoMask(IS_LOCAL(user) ? 'n' : 'N',"User %s changed their nickname to %s", oldnick.c_str(), user->nick);
47         }
48 };
49
50 MODULE_INIT(ModuleSeeNicks)