]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/commands/cmd_privmsg.cpp
Membership* changes
[user/henk/code/inspircd.git] / src / commands / cmd_privmsg.cpp
index c6e74db8b134ab32053baca2cedddd016d75f10d..e05366fa059cd8a32c71165bd21ba1efc4e0da8b 100644 (file)
  */
 
 #include "inspircd.h"
-#include "commands/cmd_privmsg.h"
 
-extern "C" DllExport  Command* init_command(InspIRCd* Instance)
+/** Handle /PRIVMSG. 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
+ * may not.
+ */
+class CommandPrivmsg : public Command
 {
-       return new CommandPrivmsg(Instance);
-}
+ public:
+       /** Constructor for privmsg.
+        */
+       CommandPrivmsg (InspIRCd* Instance, Module* parent) : Command(Instance,parent,"PRIVMSG",0,2) { syntax = "<target>{,<target>} <message>"; }
+       /** Handle command.
+        * @param parameters The parameters to the comamnd
+        * @param pcnt The number of parameters passed to teh command
+        * @param user The user issuing the command
+        * @return A value from CmdResult to indicate command success or failure.
+        */
+       CmdResult Handle(const std::vector<std::string>& parameters, User *user);
+};
 
 CmdResult CommandPrivmsg::Handle (const std::vector<std::string>& parameters, User *user)
 {
@@ -64,11 +78,11 @@ CmdResult CommandPrivmsg::Handle (const std::vector<std::string>& parameters, Us
        {
                chan = ServerInstance->FindChan(target);
 
-               except_list[user] = user->nick;
+               except_list.insert(user);
 
                if (chan)
                {
-                       if (IS_LOCAL(user) && chan->GetStatus(user) < STATUS_VOICE)
+                       if (IS_LOCAL(user) && chan->GetPrefixValue(user) < VOICE_VALUE)
                        {
                                if (chan->IsModeSet('n') && !chan->HasUser(user))
                                {
@@ -202,3 +216,5 @@ CmdResult CommandPrivmsg::Handle (const std::vector<std::string>& parameters, Us
        }
        return CMD_SUCCESS;
 }
+
+COMMAND_INIT(CommandPrivmsg)