diff options
| author | 2010-08-07 18:08:27 -0400 | |
|---|---|---|
| committer | 2010-08-07 18:08:27 -0400 | |
| commit | 6cc73f0f98faa681d7afb425b428372ec210c2ce (patch) | |
| tree | 06f22d6b5ee8868a78791949884f9eb6ca1665b8 /src/modules/m_alias.cpp | |
| parent | Change m_override to require umode +O to be set to use (diff) | |
Add ECHO command to m_alias for user feedback
Diffstat (limited to 'src/modules/m_alias.cpp')
| -rw-r--r-- | src/modules/m_alias.cpp | 25 |
1 files changed, 22 insertions, 3 deletions
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 = "<line>"; + } - char fprefix; + CmdResult Handle(const std::vector<std::string> ¶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); |
