From aeded4708c515bcc255b2947e67f076855fead14 Mon Sep 17 00:00:00 2001 From: danieldg Date: Tue, 19 Jan 2010 04:43:19 +0000 Subject: Fix MOTD and RULES to work remotely (remove the old hacks for MOTD) git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@12301 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_spanningtree/main.h | 4 -- src/modules/m_spanningtree/motd.cpp | 72 ---------------------------- src/modules/m_spanningtree/override_motd.cpp | 50 ------------------- src/modules/m_spanningtree/precommand.cpp | 4 -- src/modules/m_spanningtree/treesocket.h | 3 -- src/modules/m_spanningtree/treesocket2.cpp | 4 -- 6 files changed, 137 deletions(-) delete mode 100644 src/modules/m_spanningtree/motd.cpp delete mode 100644 src/modules/m_spanningtree/override_motd.cpp (limited to 'src/modules/m_spanningtree') diff --git a/src/modules/m_spanningtree/main.h b/src/modules/m_spanningtree/main.h index b2bff960a..4467b243f 100644 --- a/src/modules/m_spanningtree/main.h +++ b/src/modules/m_spanningtree/main.h @@ -75,10 +75,6 @@ class ModuleSpanningTree : public Module */ void ShowMap(TreeServer* Current, User* user, int depth, int &line, char* names, int &maxnamew, char* stats); - /** Handle remote MOTD - */ - ModResult HandleMotd(const std::vector& parameters, User* user); - /** Handle remote ADMIN */ ModResult HandleAdmin(const std::vector& parameters, User* user); diff --git a/src/modules/m_spanningtree/motd.cpp b/src/modules/m_spanningtree/motd.cpp deleted file mode 100644 index 03d40a812..000000000 --- a/src/modules/m_spanningtree/motd.cpp +++ /dev/null @@ -1,72 +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 MOTD. leet, huh? */ -bool TreeSocket::Motd(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(""); - - if (!ServerInstance->Config->MOTD.size()) - { - par[1] = std::string("::")+ServerInstance->Config->ServerName+" 422 "+source->nick+" :Message of the day file is missing."; - Utils->DoOneToOne(ServerInstance->Config->GetSID(), "PUSH",par, source->server); - return true; - } - - par[1] = std::string("::")+ServerInstance->Config->ServerName+" 375 "+source->nick+" :"+ServerInstance->Config->ServerName+" message of the day"; - Utils->DoOneToOne(ServerInstance->Config->GetSID(), "PUSH",par, source->server); - - for (unsigned int i = 0; i < ServerInstance->Config->MOTD.size(); i++) - { - par[1] = std::string("::")+ServerInstance->Config->ServerName+" 372 "+source->nick+" :- "+ServerInstance->Config->MOTD[i]; - Utils->DoOneToOne(ServerInstance->Config->GetSID(), "PUSH",par, source->server); - } - - par[1] = std::string("::")+ServerInstance->Config->ServerName+" 376 "+source->nick+" :End of message of the day."; - Utils->DoOneToOne(ServerInstance->Config->GetSID(), "PUSH",par, source->server); - } - } - else - { - /* Pass it on */ - User* source = ServerInstance->FindNick(prefix); - if (source) - Utils->DoOneToOne(prefix, "MOTD", params, params[0]); - } - } - return true; -} - diff --git a/src/modules/m_spanningtree/override_motd.cpp b/src/modules/m_spanningtree/override_motd.cpp deleted file mode 100644 index 24a9b0a72..000000000 --- a/src/modules/m_spanningtree/override_motd.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::HandleMotd(const std::vector& parameters, User* user) -{ - if (parameters.size() > 0) - { - if (InspIRCd::Match(ServerInstance->Config->ServerName, parameters[0])) - return MOD_RES_PASSTHRU; - - /* Remote MOTD, 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, "MOTD", 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/precommand.cpp b/src/modules/m_spanningtree/precommand.cpp index dbef35cb7..15456f276 100644 --- a/src/modules/m_spanningtree/precommand.cpp +++ b/src/modules/m_spanningtree/precommand.cpp @@ -38,10 +38,6 @@ ModResult ModuleSpanningTree::OnPreCommand(std::string &command, std::vectorHandleStats(parameters,user); } - else if (command == "MOTD") - { - return this->HandleMotd(parameters,user); - } else if (command == "ADMIN") { return this->HandleAdmin(parameters,user); diff --git a/src/modules/m_spanningtree/treesocket.h b/src/modules/m_spanningtree/treesocket.h index c1678ea5e..a329f0ec0 100644 --- a/src/modules/m_spanningtree/treesocket.h +++ b/src/modules/m_spanningtree/treesocket.h @@ -251,9 +251,6 @@ class TreeSocket : public BufferedSocket /** Handle ERROR command */ void Error(parameterlist ¶ms); - /** remote MOTD. */ - bool Motd(const std::string &prefix, parameterlist ¶ms); - /** remote ADMIN. */ bool Admin(const std::string &prefix, parameterlist ¶ms); diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp index fc58862d7..d10ec612c 100644 --- a/src/modules/m_spanningtree/treesocket2.cpp +++ b/src/modules/m_spanningtree/treesocket2.cpp @@ -294,10 +294,6 @@ void TreeSocket::ProcessConnectedLine(std::string& prefix, std::string& command, { this->Stats(prefix, params); } - else if (command == "MOTD") - { - this->Motd(prefix, params); - } else if (command == "ADMIN") { this->Admin(prefix, params); -- cgit v1.2.3