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