From 6cc73f0f98faa681d7afb425b428372ec210c2ce Mon Sep 17 00:00:00 2001 From: Daniel De Graaf Date: Sat, 7 Aug 2010 18:08:27 -0400 Subject: Add ECHO command to m_alias for user feedback --- src/modules/m_alias.cpp | 25 ++++++++++++++++++++++--- 1 file changed, 22 insertions(+), 3 deletions(-) (limited to 'src/modules/m_alias.cpp') diff --git a/src/modules/m_alias.cpp b/src/modules/m_alias.cpp index d1de728c2..8f44d8b31 100644 --- a/src/modules/m_alias.cpp +++ b/src/modules/m_alias.cpp @@ -48,12 +48,29 @@ class Alias std::string format; }; -class ModuleAlias : public Module +class CommandEcho : public Command { - private: + public: + CommandEcho(Module* Parent) : Command(Parent, "ECHO", 1, 1) + { + syntax = ""; + } - char fprefix; + CmdResult Handle(const std::vector ¶meters, User *user) + { + std::string line = parameters[0]; + if (line[0] != ':') + user->WriteServ(line); + else + user->SendText(line); + return CMD_SUCCESS; + } +}; +class ModuleAlias : public Module +{ + CommandEcho echo; + char fprefix; /* We cant use a map, there may be multiple aliases with the same name. * We can, however, use a fancy invention: the multimap. Maps a key to one or more values. * -- w00t @@ -91,10 +108,12 @@ class ModuleAlias : public Module } public: + ModuleAlias() : echo(this) {} void init() { ReadAliases(); + ServerInstance->Modules->AddService(echo); ServerInstance->Modules->Attach(I_OnPreCommand, this); ServerInstance->Modules->Attach(I_OnRehash, this); ServerInstance->Modules->Attach(I_OnUserMessage, this); -- cgit v1.3.1-10-gc9f91