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 * ---------------------------------------------------
17 #include "m_spanningtree/treesocket.h"
18 #include "m_spanningtree/treeserver.h"
19 #include "m_spanningtree/utils.h"
21 /* $ModDep: m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/treesocket.h */
24 bool TreeSocket::Modules(const std::string &prefix, std::deque<std::string> ¶ms)
29 if (!InspIRCd::Match(this->ServerInstance->Config->ServerName, params[0]))
31 /* Pass it on, not for us */
32 Utils->DoOneToOne(prefix, "MODULES", params, params[0]);
37 std::deque<std::string> par;
38 par.push_back(prefix);
41 User* source = this->ServerInstance->FindNick(prefix);
45 std::vector<std::string> module_names = ServerInstance->Modules->GetAllModuleNames(0);
47 for (unsigned int i = 0; i < module_names.size(); i++)
49 Module* m = ServerInstance->Modules->Find(module_names[i]);
50 Version V = m->GetVersion();
54 std::string flags("Svsc");
56 for (int mult = 1; mult <= VF_SERVICEPROVIDER; mult *= 2, ++pos)
57 if (!(V.Flags & mult))
60 snprintf(strbuf, MAXBUF, "::%s 702 %s :0x%08lx %s %s :%s", ServerInstance->Config->ServerName, source->nick.c_str(),(unsigned long)m, module_names[i].c_str(), flags.c_str(), V.version.c_str());
64 snprintf(strbuf, MAXBUF, "::%s 702 %s :%s", ServerInstance->Config->ServerName, source->nick.c_str(), module_names[i].c_str());
67 Utils->DoOneToOne(ServerInstance->Config->GetSID(), "PUSH", par, source->server);
69 snprintf(strbuf, MAXBUF, "::%s 703 %s :End of MODULES list", ServerInstance->Config->ServerName, source->nick.c_str());
71 Utils->DoOneToOne(ServerInstance->Config->GetSID(), "PUSH", par, source->server);