]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/cmd_topic.cpp
Annotations
[user/henk/code/inspircd.git] / src / cmd_topic.cpp
index 1939af7b23cf78bebd6258ac55453a3ded0d8f33..6d2f6cf9e38b303408de09f0b1b7488310c23355 100644 (file)
  * ---------------------------------------------------
  */
 
-#include "inspircd_config.h"
 #include "configreader.h"
 #include "users.h"
 #include "modules.h"
-#include "commands.h"
 #include "commands/cmd_topic.h"
 
 
-void cmd_topic::Handle (const char** parameters, int pcnt, userrec *user)
+
+extern "C" command_t* init_command(InspIRCd* Instance)
+{
+       return new cmd_topic(Instance);
+}
+
+CmdResult cmd_topic::Handle (const char** parameters, int pcnt, userrec *user)
 {
        chanrec* Ptr;
 
@@ -34,7 +38,7 @@ void cmd_topic::Handle (const char** parameters, int pcnt, userrec *user)
                        if ((Ptr->modes[CM_SECRET]) && (!Ptr->HasUser(user)))
                        {
                                user->WriteServ("401 %s %s :No such nick/channel",user->nick, Ptr->name);
-                               return;
+                               return CMD_FAILURE;
                        }
                        if (Ptr->topicset)
                        {
@@ -49,8 +53,9 @@ void cmd_topic::Handle (const char** parameters, int pcnt, userrec *user)
                else
                {
                        user->WriteServ("401 %s %s :No such nick/channel",user->nick, parameters[0]);
+                       return CMD_FAILURE;
                }
-               return;
+               return CMD_SUCCESS;
        }
        else if (pcnt>1)
        {
@@ -62,12 +67,12 @@ void cmd_topic::Handle (const char** parameters, int pcnt, userrec *user)
                                if (!Ptr->HasUser(user))
                                {
                                        user->WriteServ("442 %s %s :You're not on that channel!",user->nick, Ptr->name);
-                                       return;
+                                       return CMD_FAILURE;
                                }
                                if ((Ptr->modes[CM_TOPICLOCK]) && (Ptr->GetStatus(user) < STATUS_HOP))
                                {
                                        user->WriteServ("482 %s %s :You must be at least a half-operator to change modes on this channel", user->nick, Ptr->name);
-                                       return;
+                                       return CMD_FAILURE;
                                }
                        }
                        char topic[MAXTOPIC];
@@ -78,7 +83,7 @@ void cmd_topic::Handle (const char** parameters, int pcnt, userrec *user)
                                int MOD_RESULT = 0;
                                FOREACH_RESULT(I_OnLocalTopicChange,OnLocalTopicChange(user,Ptr,topic));
                                if (MOD_RESULT)
-                                       return;
+                                       return CMD_FAILURE;
                        }
 
                        strlcpy(Ptr->topic,topic,MAXTOPIC-1);
@@ -93,7 +98,9 @@ void cmd_topic::Handle (const char** parameters, int pcnt, userrec *user)
                else
                {
                        user->WriteServ("401 %s %s :No such nick/channel",user->nick, parameters[0]);
+                       return CMD_FAILURE;
                }
        }
+       return CMD_SUCCESS;
 }