]> git.netwichtig.de Git - user/henk/code/inspircd.git/blob - src/modules/m_spanningtree/metadata.cpp
Fix typo.
[user/henk/code/inspircd.git] / src / modules / m_spanningtree / metadata.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 "commands.h"
16
17 #include "treesocket.h"
18 #include "treeserver.h"
19 #include "utils.h"
20
21 CmdResult CommandMetadata::Handle(const std::vector<std::string>& params, User *srcuser)
22 {
23         std::string value = params.size() < 3 ? "" : params[2];
24         ExtensionItem* item = ServerInstance->Extensions.GetItem(params[1]);
25         if (params[0] == "*")
26         {
27                 FOREACH_MOD(I_OnDecodeMetaData,OnDecodeMetaData(NULL,params[1],value));
28         }
29         else if (*(params[0].c_str()) == '#')
30         {
31                 Channel* c = ServerInstance->FindChan(params[0]);
32                 if (c)
33                 {
34                         if (item)
35                                 item->unserialize(FORMAT_NETWORK, c, value);
36                         FOREACH_MOD(I_OnDecodeMetaData,OnDecodeMetaData(c,params[1],value));
37                 }
38         }
39         else if (*(params[0].c_str()) != '#')
40         {
41                 User* u = ServerInstance->FindNick(params[0]);
42                 if (u)
43                 {
44                         if (item)
45                                 item->unserialize(FORMAT_NETWORK, u, value);
46                         FOREACH_MOD(I_OnDecodeMetaData,OnDecodeMetaData(u,params[1],value));
47                 }
48         }
49
50         return CMD_SUCCESS;
51 }
52