]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/commands/cmd_invite.cpp
Separate spy channels [jackmcbarn]
[user/henk/code/inspircd.git] / src / commands / cmd_invite.cpp
index 31c6f459c6b901d0dc807e0c6ec2a595993effe0..89437e25217352f37aa0b3aa2dc1c675669087f1 100644 (file)
  */
 
 #include "inspircd.h"
-#include "commands/cmd_invite.h"
 
-extern "C" DllExport Command* init_command(InspIRCd* Instance)
+/** Handle /INVITE. 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 CommandInvite : public Command
 {
-       return new CommandInvite(Instance);
-}
+ public:
+       /** Constructor for invite.
+        */
+       CommandInvite ( Module* parent) : Command(parent,"INVITE", 0, 0) { Penalty = 4; syntax = "[<nick> <channel>]"; }
+       /** 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);
+};
 
 /** Handle /INVITE
  */
@@ -66,9 +80,11 @@ CmdResult CommandInvite::Handle (const std::vector<std::string>& parameters, Use
                {
                        if (IS_LOCAL(user))
                        {
-                               if (c->GetStatus(user) < STATUS_HOP)
+                               int rank = c->GetPrefixValue(user);
+                               if (rank < HALFOP_VALUE)
                                {
-                                       user->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s %s :You must be a channel %soperator", user->nick.c_str(), c->name.c_str(), c->GetStatus(u) == STATUS_HOP ? "" : "half-");
+                                       user->WriteNumeric(ERR_CHANOPRIVSNEEDED, "%s %s :You must be a channel %soperator",
+                                               user->nick.c_str(), c->name.c_str(), rank >= HALFOP_VALUE ? "" : "half-");
                                        return CMD_FAILURE;
                                }
                        }
@@ -111,3 +127,5 @@ CmdResult CommandInvite::Handle (const std::vector<std::string>& parameters, Use
        return CMD_SUCCESS;
 }
 
+
+COMMAND_INIT(CommandInvite)