]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modules/m_spanningtree/kill.cpp
79852422110298d6a0d5aab9582f4303343ac578
[user/henk/code/inspircd.git] / src / modules / m_spanningtree / kill.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
15 #include "inspircd.h"
16 #include "xline.h"
17
18 #include "treesocket.h"
19 #include "treeserver.h"
20 #include "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                         params[1] = "Killed (" + params[1] +")";
39                 }
40                 std::string reason = params[1];
41                 params[1] = ":" + params[1];
42                 Utils->DoOneToAllButSender(prefix,"KILL",params,prefix);
43                 TreeServer* src = Utils->FindServer(prefix);
44                 if (src)
45                 {
46                         // this shouldn't ever be null, but it doesn't hurt to check
47                         who->Write(":%s KILL %s :%s (%s)", src->GetName().c_str(), who->nick.c_str(), src->GetName().c_str(), reason.c_str());
48                 }
49                 this->ServerInstance->Users->QuitUser(who, reason);
50         }
51         return true;
52 }
53