]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modules/m_seenicks.cpp
OOPS! We try again, since I'm smoking craq. LF is 0x0a NOT CR.
[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 #include "users.h"
16 #include "channels.h"
17 #include "modules.h"
18 #include "hashcomp.h"
19 #include "configreader.h"
20
21 /* $ModDesc: Provides support for seeing local and remote nickchanges via snomasks */
22
23 class ModuleSeeNicks : public Module
24 {
25  public:
26         ModuleSeeNicks(InspIRCd* Me)
27                 : Module(Me)
28         {
29                 ServerInstance->SNO->EnableSnomask('n',"NICK");
30                 ServerInstance->SNO->EnableSnomask('N',"REMOTENICK");
31         }
32
33         virtual ~ModuleSeeNicks()
34         {
35                 ServerInstance->SNO->DisableSnomask('n');
36                 ServerInstance->SNO->DisableSnomask('N');
37         }
38
39         virtual Version GetVersion()
40         {
41                 return Version(1,1,0,1, VF_VENDOR, API_VERSION);
42         }
43
44         void Implements(char* List)
45         {
46                 List[I_OnUserPostNick] = 1;
47         }
48
49         virtual void OnUserPostNick(userrec* user, const std::string &oldnick)
50         {
51                 ServerInstance->SNO->WriteToSnoMask(IS_LOCAL(user) ? 'n' : 'N',"User %s changed their nickname to %s", oldnick.c_str(), user->nick);
52         }
53 };
54
55 MODULE_INIT(ModuleSeeNicks)