]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/commands/cmd_join.cpp
Fix double dot in half-cloaked resolved hosts
[user/henk/code/inspircd.git] / src / commands / cmd_join.cpp
index c8d731ef5cebd57b0588c1df73dea6e51c889ad5..806823f76e50a72b9f2498f4f951ce15f34e3727 100644 (file)
  */
 
 #include "inspircd.h"
-#include "commands/cmd_join.h"
 
-extern "C" DllExport Command* init_command(InspIRCd* Instance)
+#ifndef __CMD_JOIN_H__
+#define __CMD_JOIN_H__
+
+// include the common header files
+
+#include "users.h"
+#include "channels.h"
+
+/** Handle /JOIN. 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 CommandJoin : public Command
 {
-       return new CommandJoin(Instance);
-}
+ public:
+       /** Constructor for join.
+        */
+       CommandJoin ( Module* parent) : Command(parent,"JOIN", 1, 2) { syntax = "<channel>{,<channel>} {<key>{,<key>}}"; Penalty = 2; }
+       /** 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);
+};
+
+#endif
+
 
 /** Handle /JOIN
  */
@@ -30,7 +55,7 @@ CmdResult CommandJoin::Handle (const std::vector<std::string>& parameters, User
 
                if (ServerInstance->IsChannel(parameters[0].c_str(), ServerInstance->Config->Limits.ChanMax))
                {
-                       Channel::JoinUser(ServerInstance, user, parameters[0].c_str(), false, parameters[1].c_str(), false);
+                       Channel::JoinUser(user, parameters[0].c_str(), false, parameters[1].c_str(), false);
                        return CMD_SUCCESS;
                }
        }
@@ -41,7 +66,7 @@ CmdResult CommandJoin::Handle (const std::vector<std::string>& parameters, User
 
                if (ServerInstance->IsChannel(parameters[0].c_str(), ServerInstance->Config->Limits.ChanMax))
                {
-                       Channel::JoinUser(ServerInstance, user, parameters[0].c_str(), false, "", false);
+                       Channel::JoinUser(user, parameters[0].c_str(), false, "", false);
                        return CMD_SUCCESS;
                }
        }
@@ -49,3 +74,5 @@ CmdResult CommandJoin::Handle (const std::vector<std::string>& parameters, User
        user->WriteNumeric(ERR_NOSUCHCHANNEL, "%s %s :Invalid channel name",user->nick.c_str(), parameters[0].c_str());
        return CMD_FAILURE;
 }
+
+COMMAND_INIT(CommandJoin)