]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modules/m_spanningtree/encap.cpp
43fd84d9b4c826d236442006913b6e1177bcac41
[user/henk/code/inspircd.git] / src / modules / m_spanningtree / encap.cpp
1 /*       +------------------------------------+
2  *       | Inspire Internet Relay Chat Daemon |
3  *       +------------------------------------+
4  *
5  *  InspIRCd: (C) 2002-2010 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 "xline.h"
16
17 #include "treesocket.h"
18 #include "treeserver.h"
19 #include "utils.h"
20
21 /** ENCAP */
22 void TreeSocket::Encap(User* who, parameterlist &params)
23 {
24         if (params.size() > 1)
25         {
26                 if (ServerInstance->Config->GetSID() == params[0] || InspIRCd::Match(ServerInstance->Config->ServerName, params[0]))
27                 {
28                         parameterlist plist(params.begin() + 2, params.end());
29                         ServerInstance->CallCommandHandler(params[1].c_str(), plist, who);
30                         // discard return value, ENCAP shall succeed even if the command does not exist
31                 }
32                 
33                 params[params.size() - 1] = ":" + params[params.size() - 1];
34
35                 if (params[0].find('*') != std::string::npos)
36                 {
37                         Utils->DoOneToAllButSender(who->uuid, "ENCAP", params, who->server);
38                 }
39                 else
40                         Utils->DoOneToOne(who->uuid, "ENCAP", params, params[0]);
41         }
42 }
43