]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modules/m_spanningtree/delline.cpp
13aa684df630dc15219ef5b45303cf7ed68c67a4
[user/henk/code/inspircd.git] / src / modules / m_spanningtree / delline.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 "xline.h"
16
17 #include "m_spanningtree/treesocket.h"
18 #include "m_spanningtree/treeserver.h"
19 #include "m_spanningtree/utils.h"
20
21 /* $ModDep: m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/treesocket.h */
22
23
24 bool TreeSocket::DelLine(const std::string &prefix, std::deque<std::string> &params)
25 {
26         if (params.size() < 2)
27                 return true;
28
29         Instance->Logs->Log("loltree", DEBUG, "DELLINE: %s %s", params[0].c_str(), params[1].c_str());
30         std::string setter = "<unknown>";
31
32         User* user = Instance->FindNick(prefix);
33         if (user)
34                 setter = user->nick;
35         else
36         {
37                 TreeServer* t = Utils->FindServer(prefix);
38                 if (t)
39                         setter = t->GetName().c_str();
40         }
41
42
43         /* NOTE: No check needed on 'user', this function safely handles NULL */
44         if (Instance->XLines->DelLine(params[0].c_str(), params[1], user))
45         {
46                 this->Instance->SNO->WriteToSnoMask('x',"%s removed %s%s on %s.", setter.c_str(),
47                                 params[0].c_str(), params[0].length() == 1 ? "LINE" : "", params[1].c_str());
48                 Utils->DoOneToAllButSender(prefix,"DELLINE", params, prefix);
49         }
50         return true;
51 }
52