1 /* +------------------------------------+
2 * | Inspire Internet Relay Chat Daemon |
3 * +------------------------------------+
5 * InspIRCd: (C) 2002-2008 InspIRCd Development Team
6 * See: http://www.inspircd.org/wiki/index.php/Credits
8 * This program is free but copyrighted software; see
9 * the file COPYING for details.
11 * ---------------------------------------------------
15 #include "commands/cmd_whois.h"
16 #include "commands/cmd_stats.h"
20 #include "transport.h"
21 #include "socketengine.h"
23 #include "m_spanningtree/main.h"
24 #include "m_spanningtree/utils.h"
25 #include "m_spanningtree/treeserver.h"
26 #include "m_spanningtree/link.h"
27 #include "m_spanningtree/treesocket.h"
28 #include "m_spanningtree/resolvers.h"
29 #include "m_spanningtree/handshaketimer.h"
31 /* $ModDep: m_spanningtree/timesynctimer.h m_spanningtree/resolvers.h m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/link.h m_spanningtree/treesocket.h */
33 bool TreeSocket::Modules(const std::string &prefix, std::deque<std::string> ¶ms)
38 if (!this->Instance->MatchText(this->Instance->Config->ServerName, params[0]))
40 /* Pass it on, not for us */
41 Utils->DoOneToOne(prefix, "MODULES", params, params[0]);
46 std::deque<std::string> par;
47 par.push_back(prefix);
50 User* source = this->Instance->FindNick(prefix);
54 std::vector<std::string> module_names = Instance->Modules->GetAllModuleNames(0);
56 for (unsigned int i = 0; i < module_names.size(); i++)
58 Module* m = Instance->Modules->Find(module_names[i]);
59 Version V = m->GetVersion();
60 char modulename[MAXBUF];
61 char flagstate[MAXBUF];
63 if (V.Flags & VF_STATIC)
64 strlcat(flagstate,", static",MAXBUF);
65 if (V.Flags & VF_VENDOR)
66 strlcat(flagstate,", vendor",MAXBUF);
67 if (V.Flags & VF_COMMON)
68 strlcat(flagstate,", common",MAXBUF);
69 if (V.Flags & VF_SERVICEPROVIDER)
70 strlcat(flagstate,", service provider",MAXBUF);
72 strcpy(flagstate," <no flags>");
73 strlcpy(modulename,module_names[i].c_str(),256);
76 snprintf(strbuf, MAXBUF, "::%s 900 %s :0x%08lx %d.%d.%d.%d %s (%s)",Instance->Config->ServerName,source->nick,(unsigned long)m,
77 V.Major,V.Minor,V.Revision,V.Build,ServerConfig::CleanFilename(modulename),flagstate+2);
81 snprintf(strbuf, MAXBUF, "::%s 900 %s :%s",Instance->Config->ServerName,source->nick,ServerConfig::CleanFilename(modulename));
84 Utils->DoOneToOne(Instance->Config->GetSID(), "PUSH", par, source->server);
86 snprintf(strbuf, MAXBUF, "::%s 901 %s :End of MODULES list", Instance->Config->ServerName, source->nick);
88 Utils->DoOneToOne(Instance->Config->GetSID(), "PUSH", par, source->server);