summaryrefslogtreecommitdiff
path: root/src/modules/m_spanningtree/treesocket2.cpp
diff options
context:
space:
mode:
authorbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-03-16 22:34:00 +0000
committerbrain <brain@e03df62e-2008-0410-955e-edbf42e46eb7>2007-03-16 22:34:00 +0000
commit813b671227cd4c9bdfb584b2ca7ad705620cd2c5 (patch)
treed2f80e12f71d34e565d12ac255800add6772b663 /src/modules/m_spanningtree/treesocket2.cpp
parentdf2faa39f2f1f174eb3821c5108369e47ff1b531 (diff)
Remote /MODULES
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@6688 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src/modules/m_spanningtree/treesocket2.cpp')
-rw-r--r--src/modules/m_spanningtree/treesocket2.cpp59
1 files changed, 59 insertions, 0 deletions
diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp
index db06a47c5..128f4613e 100644
--- a/src/modules/m_spanningtree/treesocket2.cpp
+++ b/src/modules/m_spanningtree/treesocket2.cpp
@@ -38,6 +38,61 @@ bool TreeSocket::Error(std::deque<std::string> &params)
return false;
}
+bool TreeSocket::Modules(const std::string &prefix, std::deque<std::string> &params)
+{
+ if (params.empty())
+ return true;
+
+ if (!this->Instance->MatchText(this->Instance->Config->ServerName, params[0]))
+ {
+ /* Pass it on, not for us */
+ Utils->DoOneToOne(prefix, "MODULES", params, params[0]);
+ return true;
+ }
+
+ char strbuf[MAXBUF];
+ std::deque<std::string> par;
+ par.push_back(prefix);
+ par.push_back("");
+
+ userrec* source = this->Instance->FindNick(prefix);
+ if (!source)
+ return true;
+
+ for (unsigned int i = 0; i < Instance->Config->module_names.size(); i++)
+ {
+ Version V = Instance->modules[i]->GetVersion();
+ char modulename[MAXBUF];
+ char flagstate[MAXBUF];
+ *flagstate = 0;
+ if (V.Flags & VF_STATIC)
+ strlcat(flagstate,", static",MAXBUF);
+ if (V.Flags & VF_VENDOR)
+ strlcat(flagstate,", vendor",MAXBUF);
+ if (V.Flags & VF_COMMON)
+ strlcat(flagstate,", common",MAXBUF);
+ if (V.Flags & VF_SERVICEPROVIDER)
+ strlcat(flagstate,", service provider",MAXBUF);
+ if (!flagstate[0])
+ strcpy(flagstate," <no flags>");
+ strlcpy(modulename,Instance->Config->module_names[i].c_str(),256);
+ if (*source->oper)
+ {
+ snprintf(strbuf, MAXBUF, "::%s 900 %s :0x%08lx %d.%d.%d.%d %s (%s)",Instance->Config->ServerName,source->nick,(long unsigned int)Instance->modules[i],V.Major,V.Minor,V.Revision,V.Build,ServerConfig::CleanFilename(modulename),flagstate+2);
+ }
+ else
+ {
+ snprintf(strbuf, MAXBUF, "::%s 900 %s :%s",Instance->Config->ServerName,source->nick,ServerConfig::CleanFilename(modulename));
+ }
+ par[1] = strbuf;
+ Utils->DoOneToOne(Instance->Config->ServerName, "PUSH", par, source->server);
+ }
+ snprintf(strbuf, MAXBUF, "::%s 901 %s :End of MODULES list", Instance->Config->ServerName, source->nick);
+ par[1] = strbuf;
+ Utils->DoOneToOne(Instance->Config->ServerName, "PUSH", par, source->server);
+ return true;
+}
+
/** remote MOTD. leet, huh? */
bool TreeSocket::Motd(const std::string &prefix, std::deque<std::string> &params)
{
@@ -1050,6 +1105,10 @@ bool TreeSocket::ProcessLine(std::string &line)
{
return this->Motd(prefix, params);
}
+ else if (command == "MODULES")
+ {
+ return this->Modules(prefix, params);
+ }
else if (command == "ADMIN")
{
return this->Admin(prefix, params);