The InspIRCd Project
Home | Developers | Wiki | Forums | Bug Tracker | SVN | Download
Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | File List | Namespace Members | Class Members | File Members

kill.cpp

Go to the documentation of this file.
00001 /*       +------------------------------------+
00002  *       | Inspire Internet Relay Chat Daemon |
00003  *       +------------------------------------+
00004  *
00005  *  InspIRCd: (C) 2002-2008 InspIRCd Development Team
00006  * See: http://www.inspircd.org/wiki/index.php/Credits
00007  *
00008  * This program is free but copyrighted software; see
00009  *            the file COPYING for details.
00010  *
00011  * ---------------------------------------------------
00012  */
00013 
00014 
00015 #include "inspircd.h"
00016 #include "xline.h"
00017 
00018 #include "m_spanningtree/treesocket.h"
00019 #include "m_spanningtree/treeserver.h"
00020 #include "m_spanningtree/utils.h"
00021 
00022 /* $ModDep: m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/treesocket.h */
00023 
00024 
00025 
00026 bool TreeSocket::RemoteKill(const std::string &prefix, std::deque<std::string> &params)
00027 {
00028         if (params.size() != 2)
00029                 return true;
00030 
00031         User* who = this->ServerInstance->FindNick(params[0]);
00032 
00033         if (who)
00034         {
00035                 /* Prepend kill source, if we don't have one */
00036                 if (*(params[1].c_str()) != '[')
00037                 {
00038                         TreeServer* ts = Utils->FindServer(prefix);
00039                         params[1] = "[" + (ts ? ts->GetName() : prefix) + "] Killed (" + params[1] +")";
00040                 }
00041                 std::string reason = params[1];
00042                 params[1] = ":" + params[1];
00043                 Utils->DoOneToAllButSender(prefix,"KILL",params,prefix);
00044                 // NOTE: This is safe with kill hiding on, as RemoteKill is only reached if we have a server prefix.
00045                 // in short this is not executed for USERS.
00046                 who->Write(":%s KILL %s :%s (%s)", prefix.c_str(), who->nick.c_str(), prefix.c_str(), reason.c_str());
00047                 this->ServerInstance->Users->QuitUser(who, reason);
00048         }
00049         return true;
00050 }
00051