]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modules/m_spanningtree/kill.cpp
Don't append server name to kill reasons.
[user/henk/code/inspircd.git] / src / modules / m_spanningtree / kill.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
15 #include "inspircd.h"
16 #include "xline.h"
17
18 #include "m_spanningtree/treesocket.h"
19 #include "m_spanningtree/treeserver.h"
20 #include "m_spanningtree/utils.h"
21
22 /* $ModDep: m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/treesocket.h */
23
24
25
26 bool TreeSocket::RemoteKill(const std::string &prefix, std::deque<std::string> &params)
27 {
28         if (params.size() != 2)
29                 return true;
30
31         User* who = this->ServerInstance->FindNick(params[0]);
32
33         if (who)
34         {
35                 /* Prepend kill source, if we don't have one */
36                 if (*(params[1].c_str()) != 'K')
37                 {
38                         TreeServer* ts = Utils->FindServer(prefix);
39                         params[1] = "Killed (" + params[1] +")";
40                 }
41                 std::string reason = params[1];
42                 params[1] = ":" + params[1];
43                 Utils->DoOneToAllButSender(prefix,"KILL",params,prefix);
44                 // NOTE: This is safe with kill hiding on, as RemoteKill is only reached if we have a server prefix.
45                 // in short this is not executed for USERS.
46                 who->Write(":%s KILL %s :%s (%s)", prefix.c_str(), who->nick.c_str(), prefix.c_str(), reason.c_str());
47                 this->ServerInstance->Users->QuitUser(who, reason);
48         }
49         return true;
50 }
51