summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-10-01 22:45:17 +0000
committerdanieldg <danieldg@e03df62e-2008-0410-955e-edbf42e46eb7>2009-10-01 22:45:17 +0000
commit87d031609bb8b7d2cd186d8f24bcb853fd93798c (patch)
tree729a7dbefab1fee32a47e5cec97d1c8506fb60fd
parent507e9554d69df3e2cee60fe52b02dc160c6e1602 (diff)
Merge remote/local MODULES output
git-svn-id: http://svn.inspircd.org/repository/trunk/inspircd@11793 e03df62e-2008-0410-955e-edbf42e46eb7
-rw-r--r--src/commands/cmd_modules.cpp27
-rw-r--r--src/modules/m_spanningtree/main.h4
-rw-r--r--src/modules/m_spanningtree/modules.cpp74
-rw-r--r--src/modules/m_spanningtree/override_modules.cpp49
-rw-r--r--src/modules/m_spanningtree/precommand.cpp4
-rw-r--r--src/modules/m_spanningtree/privmsg.cpp85
-rw-r--r--src/modules/m_spanningtree/treesocket.h11
-rw-r--r--src/modules/m_spanningtree/treesocket2.cpp4
8 files changed, 14 insertions, 244 deletions
diff --git a/src/commands/cmd_modules.cpp b/src/commands/cmd_modules.cpp
index 70406330a..76cc29ac6 100644
--- a/src/commands/cmd_modules.cpp
+++ b/src/commands/cmd_modules.cpp
@@ -13,14 +13,6 @@
#include "inspircd.h"
-#ifndef __CMD_MODULES_H__
-#define __CMD_MODULES_H__
-
-// include the common header files
-
-#include "users.h"
-#include "channels.h"
-
/** Handle /MODULES. These command handlers can be reloaded by the core,
* and handle basic RFC1459 commands. Commands within modules work
* the same way, however, they can be fully unloaded, where these
@@ -31,7 +23,7 @@ class CommandModules : public Command
public:
/** Constructor for modules.
*/
- CommandModules ( Module* parent) : Command(parent,"MODULES",0,0) { syntax = "[debug]"; }
+ CommandModules ( Module* parent) : Command(parent,"MODULES",0,0) { syntax = "[server]"; }
/** Handle command.
* @param parameters The parameters to the comamnd
* @param pcnt The number of parameters passed to teh command
@@ -39,11 +31,14 @@ class CommandModules : public Command
* @return A value from CmdResult to indicate command success or failure.
*/
CmdResult Handle(const std::vector<std::string>& parameters, User *user);
+ RouteDescriptor GetRouting(User* user, const std::vector<std::string>& parameters)
+ {
+ if (parameters.size() >= 1)
+ return ROUTE_UNICAST(parameters[0]);
+ return ROUTE_LOCALONLY;
+ }
};
-#endif
-
-
/** Handle /MODULES
*/
CmdResult CommandModules::Handle (const std::vector<std::string>&, User *user)
@@ -63,14 +58,16 @@ CmdResult CommandModules::Handle (const std::vector<std::string>&, User *user)
if (!(V.Flags & mult))
flags[pos] = '-';
- user->WriteNumeric(702, "%s :0x%08lx %s %s :%s - %s", user->nick.c_str(),(unsigned long)m, module_names[i].c_str(), flags.c_str(), V.description.c_str(), V.version.c_str());
+ ServerInstance->DumpText(user, ":%s 702 %s :%p %s %s :%s - %s", ServerInstance->Config->ServerName,
+ user->nick.c_str(), (void*)m, module_names[i].c_str(), flags.c_str(), V.description.c_str(), V.version.c_str());
}
else
{
- user->WriteNumeric(702, "%s :%s %s", user->nick.c_str(), module_names[i].c_str(), V.description.c_str());
+ ServerInstance->DumpText(user, ":%s 702 %s :%s %s", ServerInstance->Config->ServerName,
+ user->nick.c_str(), module_names[i].c_str(), V.description.c_str());
}
}
- user->WriteNumeric(703, "%s :End of MODULES list",user->nick.c_str());
+ ServerInstance->DumpText(user, ":%s 703 %s :End of MODULES list", ServerInstance->Config->ServerName, user->nick.c_str());
return CMD_SUCCESS;
}
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<std::string>& parameters, User* user);
- /** Handle remote MODULES
- */
- ModResult HandleModules(const std::vector<std::string>& 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 &params)
-{
- 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<std::string> 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<std::string>& 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::vector<std
this->HandleVersion(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 &params, 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 &params);
- /** remote MOTD. leet, huh? */
+ /** remote MOTD. */
bool Motd(const std::string &prefix, parameterlist &params);
- /** remote ADMIN. leet, huh? */
+ /** remote ADMIN. */
bool Admin(const std::string &prefix, parameterlist &params);
- /** Remote MODULES */
- bool Modules(const std::string &prefix, parameterlist &params);
-
bool Stats(const std::string &prefix, parameterlist &params);
/** 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 &params);
- /** PRIVMSG or NOTICE with server origin ONLY
- */
- bool ServerMessage(const std::string &messagetype, const std::string &prefix, parameterlist &params, const std::string &sourceserv);
-
/** ENCAP command
*/
bool Encap(const std::string &prefix, parameterlist &params);
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);