diff options
Diffstat (limited to 'src/modules')
-rw-r--r-- | src/modules/m_spanningtree/admin.cpp | 58 | ||||
-rw-r--r-- | src/modules/m_spanningtree/main.h | 12 | ||||
-rw-r--r-- | src/modules/m_spanningtree/override_admin.cpp | 50 | ||||
-rw-r--r-- | src/modules/m_spanningtree/override_stats.cpp | 31 | ||||
-rw-r--r-- | src/modules/m_spanningtree/override_time.cpp | 50 | ||||
-rw-r--r-- | src/modules/m_spanningtree/precommand.cpp | 12 | ||||
-rw-r--r-- | src/modules/m_spanningtree/stats.cpp | 62 | ||||
-rw-r--r-- | src/modules/m_spanningtree/time.cpp | 74 | ||||
-rw-r--r-- | src/modules/m_spanningtree/treesocket.h | 9 | ||||
-rw-r--r-- | src/modules/m_spanningtree/treesocket2.cpp | 14 |
10 files changed, 1 insertions, 371 deletions
diff --git a/src/modules/m_spanningtree/admin.cpp b/src/modules/m_spanningtree/admin.cpp deleted file mode 100644 index 56416fdc3..000000000 --- a/src/modules/m_spanningtree/admin.cpp +++ /dev/null @@ -1,58 +0,0 @@ -/* +------------------------------------+ - * | Inspire Internet Relay Chat Daemon | - * +------------------------------------+ - * - * InspIRCd: (C) 2002-2010 InspIRCd Development Team - * See: http://wiki.inspircd.org/Credits - * - * This program is free but copyrighted software; see - * the file COPYING for details. - * - * --------------------------------------------------- - */ - -#include "inspircd.h" -#include "xline.h" - -#include "treesocket.h" -#include "treeserver.h" -#include "utils.h" - -/* $ModDep: m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/treesocket.h */ - -/** remote ADMIN. leet, huh? */ -bool TreeSocket::Admin(const std::string &prefix, parameterlist ¶ms) -{ - if (params.size() > 0) - { - if (InspIRCd::Match(ServerInstance->Config->ServerName, params[0])) - { - /* It's for our server */ - string_list results; - User* source = ServerInstance->FindNick(prefix); - if (source) - { - parameterlist par; - par.push_back(prefix); - par.push_back(""); - par[1] = std::string("::")+ServerInstance->Config->ServerName+" 256 "+source->nick+" :Administrative info for "+ServerInstance->Config->ServerName; - Utils->DoOneToOne(ServerInstance->Config->GetSID(), "PUSH",par, source->server); - par[1] = std::string("::")+ServerInstance->Config->ServerName+" 257 "+source->nick+" :Name - "+ServerInstance->Config->AdminName; - Utils->DoOneToOne(ServerInstance->Config->GetSID(), "PUSH",par, source->server); - par[1] = std::string("::")+ServerInstance->Config->ServerName+" 258 "+source->nick+" :Nickname - "+ServerInstance->Config->AdminNick; - Utils->DoOneToOne(ServerInstance->Config->GetSID(), "PUSH",par, source->server); - par[1] = std::string("::")+ServerInstance->Config->ServerName+" 258 "+source->nick+" :E-Mail - "+ServerInstance->Config->AdminEmail; - Utils->DoOneToOne(ServerInstance->Config->GetSID(), "PUSH",par, source->server); - } - } - else - { - /* Pass it on */ - User* source = ServerInstance->FindNick(prefix); - if (source) - Utils->DoOneToOne(prefix, "ADMIN", params, params[0]); - } - } - return true; -} - diff --git a/src/modules/m_spanningtree/main.h b/src/modules/m_spanningtree/main.h index 4467b243f..ce7709189 100644 --- a/src/modules/m_spanningtree/main.h +++ b/src/modules/m_spanningtree/main.h @@ -75,14 +75,6 @@ class ModuleSpanningTree : public Module */ void ShowMap(TreeServer* Current, User* user, int depth, int &line, char* names, int &maxnamew, char* stats); - /** Handle remote ADMIN - */ - ModResult HandleAdmin(const std::vector<std::string>& parameters, User* user); - - /** Handle remote STATS - */ - ModResult HandleStats(const std::vector<std::string>& parameters, User* user); - /** Handle MAP command */ bool HandleMap(const std::vector<std::string>& parameters, User* user); @@ -91,10 +83,6 @@ class ModuleSpanningTree : public Module */ ModResult HandleSquit(const std::vector<std::string>& parameters, User* user); - /** Handle TIME - */ - ModResult HandleTime(const std::vector<std::string>& parameters, User* user); - /** Handle remote WHOIS */ ModResult HandleRemoteWhois(const std::vector<std::string>& parameters, User* user); diff --git a/src/modules/m_spanningtree/override_admin.cpp b/src/modules/m_spanningtree/override_admin.cpp deleted file mode 100644 index c319b834a..000000000 --- a/src/modules/m_spanningtree/override_admin.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* +------------------------------------+ - * | Inspire Internet Relay Chat Daemon | - * +------------------------------------+ - * - * InspIRCd: (C) 2002-2010 InspIRCd Development Team - * See: http://wiki.inspircd.org/Credits - * - * This program is free but copyrighted software; see - * the file COPYING for details. - * - * --------------------------------------------------- - */ - -/* $ModDesc: Provides a spanning tree server link protocol */ - -#include "inspircd.h" -#include "socket.h" -#include "xline.h" - -#include "main.h" -#include "utils.h" -#include "treeserver.h" -#include "treesocket.h" - -/* $ModDep: m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/treesocket.h */ - -ModResult ModuleSpanningTree::HandleAdmin(const std::vector<std::string>& parameters, User* user) -{ - if (parameters.size() > 0) - { - if (InspIRCd::Match(ServerInstance->Config->ServerName, parameters[0])) - return MOD_RES_PASSTHRU; - - /* Remote ADMIN, the server is within the 1st parameter */ - parameterlist params; - params.push_back(parameters[0]); - /* Send it out remotely, generate no reply yet */ - TreeServer* s = Utils->FindServerMask(parameters[0]); - if (s) - { - params[0] = s->GetName(); - Utils->DoOneToOne(user->uuid, "ADMIN", params, s->GetName()); - } - else - user->WriteNumeric(ERR_NOSUCHSERVER, "%s %s :No such server", user->nick.c_str(), parameters[0].c_str()); - return MOD_RES_DENY; - } - return MOD_RES_PASSTHRU; -} - diff --git a/src/modules/m_spanningtree/override_stats.cpp b/src/modules/m_spanningtree/override_stats.cpp index 0a1f18d04..3355c9775 100644 --- a/src/modules/m_spanningtree/override_stats.cpp +++ b/src/modules/m_spanningtree/override_stats.cpp @@ -15,7 +15,6 @@ #include "inspircd.h" #include "socket.h" -#include "xline.h" #include "main.h" #include "utils.h" @@ -23,36 +22,6 @@ #include "link.h" #include "treesocket.h" -/* $ModDep: m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/link.h m_spanningtree/treesocket.h */ - -ModResult ModuleSpanningTree::HandleStats(const std::vector<std::string>& parameters, User* user) -{ - if (parameters.size() > 1) - { - if (InspIRCd::Match(ServerInstance->Config->ServerName, parameters[1])) - return MOD_RES_PASSTHRU; - - /* Remote STATS, the server is within the 2nd parameter */ - parameterlist params; - params.push_back(parameters[0]); - params.push_back(parameters[1]); - /* Send it out remotely, generate no reply yet */ - - TreeServer* s = Utils->FindServerMask(parameters[1]); - if (s) - { - params[1] = s->GetName(); - Utils->DoOneToOne(user->uuid, "STATS", params, s->GetName()); - } - else - { - user->WriteServ( "402 %s %s :No such server", user->nick.c_str(), parameters[1].c_str()); - } - return MOD_RES_DENY; - } - return MOD_RES_PASSTHRU; -} - ModResult ModuleSpanningTree::OnStats(char statschar, User* user, string_list &results) { if ((statschar == 'c') || (statschar == 'n')) diff --git a/src/modules/m_spanningtree/override_time.cpp b/src/modules/m_spanningtree/override_time.cpp deleted file mode 100644 index 4cb0cc527..000000000 --- a/src/modules/m_spanningtree/override_time.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* +------------------------------------+ - * | Inspire Internet Relay Chat Daemon | - * +------------------------------------+ - * - * InspIRCd: (C) 2002-2010 InspIRCd Development Team - * See: http://wiki.inspircd.org/Credits - * - * This program is free but copyrighted software; see - * the file COPYING for details. - * - * --------------------------------------------------- - */ - -/* $ModDesc: Provides a spanning tree server link protocol */ - -#include "inspircd.h" -#include "socket.h" -#include "xline.h" - -#include "main.h" -#include "utils.h" -#include "treeserver.h" -#include "treesocket.h" - -/* $ModDep: m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/treesocket.h */ - -ModResult ModuleSpanningTree::HandleTime(const std::vector<std::string>& parameters, User* user) -{ - if ((IS_LOCAL(user)) && (parameters.size() > 0)) - { - TreeServer* found = Utils->FindServerMask(parameters[0].c_str()); - if (found) - { - // we dont' override for local server - if (found == Utils->TreeRoot) - return MOD_RES_PASSTHRU; - - parameterlist params; - params.push_back(found->GetName()); - params.push_back(user->uuid); - Utils->DoOneToOne(ServerInstance->Config->GetSID(),"TIME",params,found->GetName()); - } - else - { - user->WriteNumeric(ERR_NOSUCHSERVER, "%s %s :No such server",user->nick.c_str(),parameters[0].c_str()); - } - } - return MOD_RES_DENY; -} - diff --git a/src/modules/m_spanningtree/precommand.cpp b/src/modules/m_spanningtree/precommand.cpp index 15456f276..806246056 100644 --- a/src/modules/m_spanningtree/precommand.cpp +++ b/src/modules/m_spanningtree/precommand.cpp @@ -34,14 +34,6 @@ ModResult ModuleSpanningTree::OnPreCommand(std::string &command, std::vector<std { return this->HandleConnect(parameters,user); } - else if (command == "STATS") - { - return this->HandleStats(parameters,user); - } - else if (command == "ADMIN") - { - return this->HandleAdmin(parameters,user); - } else if (command == "SQUIT") { return this->HandleSquit(parameters,user); @@ -50,10 +42,6 @@ ModResult ModuleSpanningTree::OnPreCommand(std::string &command, std::vector<std { return this->HandleMap(parameters,user) ? MOD_RES_DENY : MOD_RES_PASSTHRU; } - else if ((command == "TIME") && (parameters.size() > 0)) - { - return this->HandleTime(parameters,user); - } else if (command == "LINKS") { this->HandleLinks(parameters,user); diff --git a/src/modules/m_spanningtree/stats.cpp b/src/modules/m_spanningtree/stats.cpp deleted file mode 100644 index a30bb8118..000000000 --- a/src/modules/m_spanningtree/stats.cpp +++ /dev/null @@ -1,62 +0,0 @@ -/* +------------------------------------+ - * | Inspire Internet Relay Chat Daemon | - * +------------------------------------+ - * - * InspIRCd: (C) 2002-2010 InspIRCd Development Team - * See: http://wiki.inspircd.org/Credits - * - * This program is free but copyrighted software; see - * the file COPYING for details. - * - * --------------------------------------------------- - */ - -#include "inspircd.h" -#include "socket.h" -#include "xline.h" -#include "socketengine.h" - -#include "main.h" -#include "utils.h" -#include "treeserver.h" -#include "link.h" -#include "treesocket.h" - -/* $ModDep: m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/link.h m_spanningtree/treesocket.h */ - -bool TreeSocket::Stats(const std::string &prefix, parameterlist ¶ms) -{ - /* 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() > 1) - { - if (InspIRCd::Match(ServerInstance->Config->ServerName, params[1])) - { - /* It's for our server */ - string_list results; - User* source = ServerInstance->FindNick(prefix); - if (source) - { - parameterlist par; - par.push_back(prefix); - par.push_back(""); - ServerInstance->DoStats(params[0][0], source, results); - for (size_t i = 0; i < results.size(); i++) - { - par[1] = "::" + results[i]; - Utils->DoOneToOne(ServerInstance->Config->GetSID(), "PUSH",par, source->server); - } - } - } - else - { - /* Pass it on */ - User* source = ServerInstance->FindNick(prefix); - if (source) - Utils->DoOneToOne(source->uuid, "STATS", params, params[1]); - } - } - return true; -} - diff --git a/src/modules/m_spanningtree/time.cpp b/src/modules/m_spanningtree/time.cpp deleted file mode 100644 index 4f4373498..000000000 --- a/src/modules/m_spanningtree/time.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* +------------------------------------+ - * | Inspire Internet Relay Chat Daemon | - * +------------------------------------+ - * - * InspIRCd: (C) 2002-2010 InspIRCd Development Team - * See: http://wiki.inspircd.org/Credits - * - * This program is free but copyrighted software; see - * the file COPYING for details. - * - * --------------------------------------------------- - */ - -#include "inspircd.h" -#include "socket.h" -#include "xline.h" -#include "socketengine.h" - -#include "main.h" -#include "utils.h" -#include "treeserver.h" -#include "treesocket.h" - -/* $ModDep: m_spanningtree/main.h m_spanningtree/utils.h m_spanningtree/treeserver.h m_spanningtree/treesocket.h */ - -bool TreeSocket::Time(const std::string &prefix, parameterlist ¶ms) -{ - // :source.server TIME remote.server sendernick - // :remote.server TIME source.server sendernick TS - if (params.size() == 2) - { - // someone querying our time? - if (ServerInstance->Config->ServerName == params[0] || ServerInstance->Config->GetSID() == params[0]) - { - User* u = ServerInstance->FindNick(params[1]); - if (u) - { - params.push_back(ConvToStr(ServerInstance->Time())); - params[0] = prefix; - Utils->DoOneToOne(ServerInstance->Config->GetSID(),"TIME",params,params[0]); - } - } - else - { - // not us, pass it on - User* u = ServerInstance->FindNick(params[1]); - if (u) - Utils->DoOneToOne(prefix,"TIME",params,params[0]); - } - } - else if (params.size() == 3) - { - // a response to a previous TIME - User* u = ServerInstance->FindNick(params[1]); - if ((u) && (IS_LOCAL(u))) - { - std::string sourceserv = Utils->FindServer(prefix)->GetName(); - time_t rawtime = atol(params[2].c_str()); - struct tm * timeinfo; - timeinfo = localtime(&rawtime); - char tms[26]; - snprintf(tms,26,"%s",asctime(timeinfo)); - tms[24] = 0; - u->WriteNumeric(RPL_TIME, "%s %s :%s",u->nick.c_str(),sourceserv.c_str(),tms); - } - else - { - if (u) - Utils->DoOneToOne(prefix,"TIME",params,u->server); - } - } - return true; -} - diff --git a/src/modules/m_spanningtree/treesocket.h b/src/modules/m_spanningtree/treesocket.h index a329f0ec0..1bd02762d 100644 --- a/src/modules/m_spanningtree/treesocket.h +++ b/src/modules/m_spanningtree/treesocket.h @@ -251,11 +251,6 @@ class TreeSocket : public BufferedSocket /** Handle ERROR command */ void Error(parameterlist ¶ms); - /** remote ADMIN. */ - bool Admin(const std::string &prefix, parameterlist ¶ms); - - bool Stats(const std::string &prefix, parameterlist ¶ms); - /** Remote AWAY */ bool Away(const std::string &prefix, parameterlist ¶ms); @@ -298,10 +293,6 @@ class TreeSocket : public BufferedSocket */ bool Push(const std::string &prefix, parameterlist ¶ms); - /** TIME - */ - bool Time(const std::string &prefix, parameterlist ¶ms); - /** PING */ bool LocalPing(const std::string &prefix, parameterlist ¶ms); diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp index d10ec612c..3f63da03d 100644 --- a/src/modules/m_spanningtree/treesocket2.cpp +++ b/src/modules/m_spanningtree/treesocket2.cpp @@ -290,15 +290,7 @@ void TreeSocket::ProcessConnectedLine(std::string& prefix, std::string& command, command = "MODE"; // TODO move all this into Commands - if (command == "STATS") - { - this->Stats(prefix, params); - } - else if (command == "ADMIN") - { - this->Admin(prefix, params); - } - else if (command == "MAP") + if (command == "MAP") { Utils->Creator->HandleMap(params, who); } @@ -356,10 +348,6 @@ void TreeSocket::ProcessConnectedLine(std::string& prefix, std::string& command, { this->Push(prefix,params); } - else if (command == "TIME") - { - this->Time(prefix,params); - } else if (command == "SQUIT") { if (params.size() == 2) |