]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/coremods/core_wallops.cpp
Only show UHNAMES and NAMESX in 005 if the cap module is loaded.
[user/henk/code/inspircd.git] / src / coremods / core_wallops.cpp
index 856fcea747293cf470c878a6ec5f0c44909128bf..09fafd244146ea329afa7d6d65f25f64bffb2238 100644 (file)
@@ -25,6 +25,7 @@
 class CommandWallops : public Command
 {
        SimpleUserModeHandler wallopsmode;
+       ClientProtocol::EventProvider protoevprov;
 
  public:
        /** Constructor for wallops.
@@ -32,9 +33,10 @@ class CommandWallops : public Command
        CommandWallops(Module* parent)
                : Command(parent, "WALLOPS", 1, 1)
                , wallopsmode(parent, "wallops", 'w')
+               , protoevprov(parent, name)
        {
                flags_needed = 'o';
-               syntax = "<any-text>";
+               syntax = ":<message>";
        }
 
        /** Handle command.
@@ -52,18 +54,36 @@ class CommandWallops : public Command
 
 CmdResult CommandWallops::Handle(User* user, const Params& parameters)
 {
-       std::string wallop("WALLOPS :");
-       wallop.append(parameters[0]);
+       ClientProtocol::Message msg("WALLOPS", user);
+       msg.PushParamRef(parameters[0]);
+       ClientProtocol::Event wallopsevent(protoevprov, msg);
 
        const UserManager::LocalList& list = ServerInstance->Users.GetLocalUsers();
        for (UserManager::LocalList::const_iterator i = list.begin(); i != list.end(); ++i)
        {
-               User* t = *i;
-               if (t->IsModeSet(wallopsmode))
-                       t->WriteFrom(user, wallop);
+               LocalUser* curr = *i;
+               if (curr->IsModeSet(wallopsmode))
+                       curr->Send(wallopsevent);
        }
 
        return CMD_SUCCESS;
 }
 
-COMMAND_INIT(CommandWallops)
+class CoreModWallops : public Module
+{
+ private:
+       CommandWallops cmd;
+
+ public:
+       CoreModWallops()
+               : cmd(this)
+       {
+       }
+
+       Version GetVersion() CXX11_OVERRIDE
+       {
+               return Version("Provides the WALLOPS command", VF_CORE | VF_VENDOR);
+       }
+};
+
+MODULE_INIT(CoreModWallops)