]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modules/m_spanningtree/save.cpp
Add SAVE s2s protocol command
[user/henk/code/inspircd.git] / src / modules / m_spanningtree / save.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 "commands/cmd_whois.h"
16 #include "commands/cmd_stats.h"
17 #include "socket.h"
18 #include "xline.h"
19 #include "../transport.h"
20 #include "socketengine.h"
21
22 #include "main.h"
23 #include "utils.h"
24 #include "treeserver.h"
25 #include "treesocket.h"
26
27 /* $ModDep: m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/treesocket.h */
28
29 /**
30  * SAVE command - force nick change to UID on timestamp match
31  */
32 bool TreeSocket::ForceNick(const std::string &prefix, parameterlist &params)
33 {
34         if (params.size() < 2)
35                 return true;
36
37         User* u = this->ServerInstance->FindNick(params[0]);
38         time_t ts = atol(params[1].c_str());
39
40         if (u && u->age == ts)
41         {
42                 Utils->DoOneToAllButSender(prefix,"SAVE",params,prefix);
43
44                 if (!u->ForceNickChange(u->uuid.c_str()))
45                 {
46                         this->ServerInstance->Users->QuitUser(u, "Nickname collision");
47                 }
48         }
49
50         return true;
51 }
52