From 87d031609bb8b7d2cd186d8f24bcb853fd93798c Mon Sep 17 00:00:00 2001 From: danieldg Date: Thu, 1 Oct 2009 22:45:17 +0000 Subject: Merge remote/local MODULES output git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11793 e03df62e-2008-0410-955e-edbf42e46eb7 --- src/modules/m_spanningtree/main.h | 4 -- src/modules/m_spanningtree/modules.cpp | 74 --------------------- src/modules/m_spanningtree/override_modules.cpp | 49 -------------- src/modules/m_spanningtree/precommand.cpp | 4 -- src/modules/m_spanningtree/privmsg.cpp | 85 ------------------------- src/modules/m_spanningtree/treesocket.h | 11 +--- src/modules/m_spanningtree/treesocket2.cpp | 4 -- 7 files changed, 2 insertions(+), 229 deletions(-) delete mode 100644 src/modules/m_spanningtree/modules.cpp delete mode 100644 src/modules/m_spanningtree/override_modules.cpp delete mode 100644 src/modules/m_spanningtree/privmsg.cpp (limited to 'src/modules/m_spanningtree') diff --git a/src/modules/m_spanningtree/main.h b/src/modules/m_spanningtree/main.h index fc3392e26..59d40eca4 100644 --- a/src/modules/m_spanningtree/main.h +++ b/src/modules/m_spanningtree/main.h @@ -114,10 +114,6 @@ class ModuleSpanningTree : public Module */ ModResult HandleRemoteWhois(const std::vector& parameters, User* user); - /** Handle remote MODULES - */ - ModResult HandleModules(const std::vector& parameters, User* user); - /** Ping all local servers */ void DoPingChecks(time_t curtime); diff --git a/src/modules/m_spanningtree/modules.cpp b/src/modules/m_spanningtree/modules.cpp deleted file mode 100644 index 635fac7d3..000000000 --- a/src/modules/m_spanningtree/modules.cpp +++ /dev/null @@ -1,74 +0,0 @@ -/* +------------------------------------+ - * | Inspire Internet Relay Chat Daemon | - * +------------------------------------+ - * - * InspIRCd: (C) 2002-2009 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 */ - - -bool TreeSocket::Modules(const std::string &prefix, parameterlist ¶ms) -{ - if (params.empty()) - return true; - - if (!InspIRCd::Match(ServerInstance->Config->ServerName, params[0])) - { - /* Pass it on, not for us */ - Utils->DoOneToOne(prefix, "MODULES", params, params[0]); - return true; - } - - char strbuf[MAXBUF]; - parameterlist par; - par.push_back(prefix); - par.push_back(""); - - User* source = ServerInstance->FindNick(prefix); - if (!source) - return true; - - std::vector module_names = ServerInstance->Modules->GetAllModuleNames(0); - - for (unsigned int i = 0; i < module_names.size(); i++) - { - Module* m = ServerInstance->Modules->Find(module_names[i]); - Version V = m->GetVersion(); - - if (IS_OPER(source)) - { - std::string flags("SvscC"); - int pos = 0; - for (int mult = 1; mult <= VF_OPTCOMMON; mult *= 2, ++pos) - if (!(V.Flags & mult)) - flags[pos] = '-'; - - snprintf(strbuf, MAXBUF, "::%s 702 %s :0x%08lx %s %s :%s - %s", ServerInstance->Config->ServerName, source->nick.c_str(),(unsigned long)m, module_names[i].c_str(), flags.c_str(), V.description.c_str(), V.version.c_str()); - } - else - { - snprintf(strbuf, MAXBUF, "::%s 702 %s :%s %s", ServerInstance->Config->ServerName, source->nick.c_str(), module_names[i].c_str(), V.description.c_str()); - } - par[1] = strbuf; - Utils->DoOneToOne(ServerInstance->Config->GetSID(), "PUSH", par, source->server); - } - snprintf(strbuf, MAXBUF, "::%s 703 %s :End of MODULES list", ServerInstance->Config->ServerName, source->nick.c_str()); - par[1] = strbuf; - Utils->DoOneToOne(ServerInstance->Config->GetSID(), "PUSH", par, source->server); - return true; -} - diff --git a/src/modules/m_spanningtree/override_modules.cpp b/src/modules/m_spanningtree/override_modules.cpp deleted file mode 100644 index 6854bc31c..000000000 --- a/src/modules/m_spanningtree/override_modules.cpp +++ /dev/null @@ -1,49 +0,0 @@ -/* +------------------------------------+ - * | Inspire Internet Relay Chat Daemon | - * +------------------------------------+ - * - * InspIRCd: (C) 2002-2009 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 "../transport.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::HandleModules(const std::vector& parameters, User* user) -{ - if (parameters.size() > 0) - { - if (InspIRCd::Match(ServerInstance->Config->ServerName, parameters[0])) - return MOD_RES_PASSTHRU; - - parameterlist params; - params.push_back(parameters[0]); - TreeServer* s = Utils->FindServerMask(parameters[0].c_str()); - if (s) - { - params[0] = s->GetName(); - Utils->DoOneToOne(user->uuid, "MODULES", 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 6564dd95b..a024a4901 100644 --- a/src/modules/m_spanningtree/precommand.cpp +++ b/src/modules/m_spanningtree/precommand.cpp @@ -82,10 +82,6 @@ ModResult ModuleSpanningTree::OnPreCommand(std::string &command, std::vectorHandleVersion(parameters,user); return MOD_RES_DENY; } - else if ((command == "MODULES") && (parameters.size() > 0)) - { - return this->HandleModules(parameters,user); - } return MOD_RES_PASSTHRU; } diff --git a/src/modules/m_spanningtree/privmsg.cpp b/src/modules/m_spanningtree/privmsg.cpp deleted file mode 100644 index 042edaba8..000000000 --- a/src/modules/m_spanningtree/privmsg.cpp +++ /dev/null @@ -1,85 +0,0 @@ -/* +------------------------------------+ - * | Inspire Internet Relay Chat Daemon | - * +------------------------------------+ - * - * InspIRCd: (C) 2002-2009 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" - -/** remote server PRIVMSG/NOTICE */ -bool TreeSocket::ServerMessage(const std::string &messagetype, const std::string &prefix, parameterlist ¶ms, const std::string &sourceserv) -{ - if (params.size() >= 2) - { - CUList except_list; - char status = '\0'; - const char* target = params[0].c_str(); - std::string text = params[1].c_str(); - - if (ServerInstance->Modes->FindPrefix(*target)) - { - status = *target; - target++; - } - - Channel* channel = ServerInstance->FindChan(target); - - if (channel) - { - if (messagetype == "PRIVMSG") - { - FOREACH_MOD(I_OnUserMessage, OnUserMessage(Utils->ServerUser, channel, TYPE_CHANNEL, text, status, except_list)); - } - else - { - FOREACH_MOD(I_OnUserNotice, OnUserNotice(Utils->ServerUser, channel, TYPE_CHANNEL, text, status, except_list)); - } - TreeServer* s = Utils->FindServer(prefix); - if (s) - { - FOREACH_MOD(I_OnText, OnText(Utils->ServerUser, channel, TYPE_CHANNEL, text, status, except_list)); - channel->WriteChannelWithServ(s->GetName().c_str(), "%s %s :%s", messagetype.c_str(), channel->name.c_str(), text.c_str()); - } - } - else - { - User* user = ServerInstance->FindNick(target); - - if (user) - { - if (messagetype == "PRIVMSG") - { - FOREACH_MOD(I_OnUserMessage, OnUserMessage(Utils->ServerUser, user, TYPE_USER, text, 0, except_list)); - } - else - { - FOREACH_MOD(I_OnUserNotice, OnUserNotice(Utils->ServerUser, user, TYPE_USER, text, 0, except_list)); - } - TreeServer* s = Utils->FindServer(prefix); - if (s) - { - FOREACH_MOD(I_OnText, OnText(Utils->ServerUser, user, TYPE_USER, text, status, except_list)); - user->Write(":%s %s %s :%s", s->GetName().c_str(), messagetype.c_str(), user->nick.c_str(), text.c_str()); - } - - } - } - - /* Propogate as channel privmsg */ - return Utils->DoOneToAllButSenderRaw(":" + prefix + " " + messagetype + " " + target + " :" + text, sourceserv, prefix, assign(messagetype), params); - } - return true; -} - diff --git a/src/modules/m_spanningtree/treesocket.h b/src/modules/m_spanningtree/treesocket.h index 2081c2a92..3744de96b 100644 --- a/src/modules/m_spanningtree/treesocket.h +++ b/src/modules/m_spanningtree/treesocket.h @@ -260,15 +260,12 @@ class TreeSocket : public BufferedSocket /** Handle ERROR command */ bool Error(parameterlist ¶ms); - /** remote MOTD. leet, huh? */ + /** remote MOTD. */ bool Motd(const std::string &prefix, parameterlist ¶ms); - /** remote ADMIN. leet, huh? */ + /** remote ADMIN. */ bool Admin(const std::string &prefix, parameterlist ¶ms); - /** Remote MODULES */ - bool Modules(const std::string &prefix, parameterlist ¶ms); - bool Stats(const std::string &prefix, parameterlist ¶ms); /** Because the core won't let users or even SERVERS set +o, @@ -287,10 +284,6 @@ class TreeSocket : public BufferedSocket /** SAVE to resolve nick collisions without killing */ bool ForceNick(const std::string &prefix, parameterlist ¶ms); - /** PRIVMSG or NOTICE with server origin ONLY - */ - bool ServerMessage(const std::string &messagetype, const std::string &prefix, parameterlist ¶ms, const std::string &sourceserv); - /** ENCAP command */ bool Encap(const std::string &prefix, parameterlist ¶ms); diff --git a/src/modules/m_spanningtree/treesocket2.cpp b/src/modules/m_spanningtree/treesocket2.cpp index 7ba406b5e..bdda77ee1 100644 --- a/src/modules/m_spanningtree/treesocket2.cpp +++ b/src/modules/m_spanningtree/treesocket2.cpp @@ -310,10 +310,6 @@ void TreeSocket::ProcessConnectedLine(std::string& prefix, std::string& command, { this->Motd(prefix, params); } - else if (command == "MODULES") - { - this->Modules(prefix, params); - } else if (command == "ADMIN") { this->Admin(prefix, params); -- cgit v1.2.3