]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modules/m_spanningtree/svsnick.cpp
Create StreamSocket for IO hooking implementation
[user/henk/code/inspircd.git] / src / modules / m_spanningtree / svsnick.cpp
1 /*       +------------------------------------+
2  *       | Inspire Internet Relay Chat Daemon |
3  *       +------------------------------------+
4  *
5  *  InspIRCd: (C) 2002-2009 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 #include "socket.h"
16 #include "xline.h"
17 #include "../transport.h"
18 #include "socketengine.h"
19
20 #include "main.h"
21 #include "utils.h"
22 #include "treeserver.h"
23 #include "treesocket.h"
24
25 /* $ModDep: m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/treesocket.h */
26
27 /** Because Andy insists that services-compatible servers must
28  * implement SVSNICK and SVSJOIN, that's exactly what we do :p
29  */
30 bool TreeSocket::SVSNick(const std::string &prefix, parameterlist &params)
31 {
32         if (params.size() < 3)
33                 return true;
34
35         User* u = ServerInstance->FindNick(params[0]);
36
37         if (u)
38         {
39                 Utils->DoOneToAllButSender(prefix,"SVSNICK",params,prefix);
40
41                 if (IS_LOCAL(u))
42                 {
43                         parameterlist par;
44                         par.push_back(params[1]);
45
46                         if (!u->ForceNickChange(params[1].c_str()))
47                         {
48                                 /* buh. UID them */
49                                 if (!u->ForceNickChange(u->uuid.c_str()))
50                                 {
51                                         ServerInstance->Users->QuitUser(u, "Nickname collision");
52                                         return true;
53                                 }
54                         }
55
56                         u->age = atoi(params[2].c_str());
57                 }
58         }
59
60         return true;
61 }
62