summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2006-08-28 23:36:30 +0000
committerw00t <w00t@e03df62e-2008-0410-955e-edbf42e46eb7>2006-08-28 23:36:30 +0000
commit07c3b07ff7d961eb8048a1e9390cafd35d224a7c (patch)
treed49844f5faaede05376f806bc7fcba4efb38ab26 /src
parentaf42b46c28af610f918ba15869a84ecb228e423e (diff)
Hey, what the hell. Let's do remote ADMIN too. :)
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@5059 e03df62e-2008-0410-955e-edbf42e46eb7
Diffstat (limited to 'src')
-rw-r--r--src/modules/m_spanningtree.cpp75
1 files changed, 72 insertions, 3 deletions
diff --git a/src/modules/m_spanningtree.cpp b/src/modules/m_spanningtree.cpp
index f9a89bf5c..ad7203177 100644
--- a/src/modules/m_spanningtree.cpp
+++ b/src/modules/m_spanningtree.cpp
@@ -2043,9 +2043,6 @@ class TreeSocket : public InspSocket
/* remote MOTD. leet, huh? */
bool Motd(std::string prefix, std::deque<std::string> &params)
{
- /* Get the reply to a STATS query if it matches this servername,
- * and send it back as a load of PUSH queries
- */
if (params.size() > 0)
{
if (this->Instance->MatchText(this->Instance->Config->ServerName, params[0]))
@@ -2091,6 +2088,47 @@ class TreeSocket : public InspSocket
return true;
}
+ /* remote ADMIN. leet, huh? */
+ bool Admin(std::string prefix, std::deque<std::string> &params)
+ {
+ if (params.size() > 0)
+ {
+ if (this->Instance->MatchText(this->Instance->Config->ServerName, params[0]))
+ {
+ /* It's for our server */
+ string_list results;
+ userrec* source = this->Instance->FindNick(prefix);
+
+ if (source)
+ {
+ std::deque<std::string> par;
+ par.push_back(prefix);
+ par.push_back("");
+
+ par[1] = std::string("::")+ServerInstance->Config->ServerName+" 256 "+source->nick+" :Administrative info for "+ServerInstance->Config->ServerName;
+ DoOneToOne(this->Instance->Config->ServerName, "PUSH",par, source->server);
+
+ par[1] = std::string("::")+ServerInstance->Config->ServerName+" 257 "+source->nick+" :Name - "+ServerInstance->Config->AdminName;
+ DoOneToOne(this->Instance->Config->ServerName, "PUSH",par, source->server);
+
+ par[1] = std::string("::")+ServerInstance->Config->ServerName+" 258 "+source->nick+" :Nickname - "+ServerInstance->Config->AdminNick;
+ DoOneToOne(this->Instance->Config->ServerName, "PUSH",par, source->server);
+
+ par[1] = std::string("::")+ServerInstance->Config->ServerName+" 258 "+source->nick+" :E-Mail - "+ServerInstance->Config->AdminEmail;
+ DoOneToOne(this->Instance->Config->ServerName, "PUSH",par, source->server);
+ }
+ }
+ else
+ {
+ /* Pass it on */
+ userrec* source = this->Instance->FindNick(prefix);
+ if (source)
+ DoOneToOne(prefix, "ADMIN", params, params[0]);
+ }
+ }
+ return true;
+ }
+
bool Stats(std::string prefix, std::deque<std::string> &params)
{
/* Get the reply to a STATS query if it matches this servername,
@@ -2946,6 +2984,10 @@ class TreeSocket : public InspSocket
{
return this->Motd(prefix, params);
}
+ else if (command == "ADMIN")
+ {
+ return this->Admin(prefix, params);
+ }
else if (command == "SERVER")
{
return this->RemoteServer(prefix,params);
@@ -3771,6 +3813,29 @@ class ModuleSpanningTree : public Module
return 0;
}
+ int HandleAdmin(const char** parameters, int pcnt, userrec* user)
+ {
+ if (pcnt > 0)
+ {
+ /* Remote ADMIN, the server is within the 1st parameter */
+ std::deque<std::string> params;
+ params.push_back(parameters[0]);
+
+ /* Send it out remotely, generate no reply yet */
+ TreeServer* s = FindServerMask(parameters[0]);
+ if (s)
+ {
+ DoOneToOne(user->nick, "ADMIN", params, s->GetName());
+ }
+ else
+ {
+ user->WriteServ( "402 %s %s :No such server", user->nick, parameters[0]);
+ }
+ return 1;
+ }
+ return 0;
+ }
+
int HandleStats(const char** parameters, int pcnt, userrec* user)
{
if (pcnt > 1)
@@ -4136,6 +4201,10 @@ class ModuleSpanningTree : public Module
{
return this->HandleMotd(parameters,pcnt,user);
}
+ else if (command == "ADMIN")
+ {
+ return this->HandleAdmin(parameters,pcnt,user);
+ }
else if (command == "SQUIT")
{
return this->HandleSquit(parameters,pcnt,user);