]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modules/m_spanningtree/encap.cpp
972a7fd20f35184802a5cd0fccec56ff4135931f
[user/henk/code/inspircd.git] / src / modules / m_spanningtree / encap.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
25 /** remote MOTD. leet, huh? */
26 bool TreeSocket::Encap(const std::string &prefix, std::deque<std::string> &params)
27 {
28         if (params.size() > 1)
29         {
30                 if (Instance->MatchText(Instance->Config->GetSID(), params[0]))
31                 {
32                         Event event((char*) &params, (Module*)this->Utils->Creator, "encap_received");
33                         event.Send(Instance);
34                 }
35                 else
36                 {
37                         User* u = Instance->FindNick(params[0]);
38
39                         if (u && IS_LOCAL(u))
40                         {
41                                 Event event((char*) &params, (Module*)this->Utils->Creator, "encap_received");
42                                 event.Send(Instance);
43                         }
44
45                         return true;
46                 }
47
48                 if (params[0].find('*') != std::string::npos)
49                 {
50                         User* u = Instance->FindNick(params[0]);
51                         if (u)
52                                 Utils->DoOneToAllButSender(prefix, "ENCAP", params, u->server);
53                         else
54                                 Utils->DoOneToAllButSender(prefix, "ENCAP", params, params[0]);
55                 }
56                 else
57                         Utils->DoOneToOne(prefix, "ENCAP", params, prefix);
58         }
59         return true;
60 }
61