]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/commands/cmd_kline.cpp
Remove out of date doc and fix typo in commands/cmd_*.cpp
[user/henk/code/inspircd.git] / src / commands / cmd_kline.cpp
index b1f5f62db8959dfacc65777c4bfb91c7412a9bca..c6a8c7cad6b46483a5d5603ffe30f0cfaee1847d 100644 (file)
 #include "inspircd.h"
 #include "xline.h"
 
-/** Handle /KLINE. 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.
+/** Handle /KLINE.
  */
 class CommandKline : public Command
 {
@@ -33,8 +30,7 @@ class CommandKline : public Command
         */
        CommandKline ( Module* parent) : Command(parent,"KLINE",1,3) { flags_needed = 'o'; Penalty = 0; syntax = "<ident@host> [<duration> :<reason>]"; }
        /** Handle command.
-        * @param parameters The parameters to the comamnd
-        * @param pcnt The number of parameters passed to teh command
+        * @param parameters The parameters to the command
         * @param user The user issuing the command
         * @return A value from CmdResult to indicate command success or failure.
         */
@@ -51,19 +47,19 @@ CmdResult CommandKline::Handle (const std::vector<std::string>& parameters, User
        if (parameters.size() >= 3)
        {
                IdentHostPair ih;
-               User* find = ServerInstance->FindNick(target.c_str());
-               if (find)
+               User* find = ServerInstance->FindNick(target);
+               if ((find) && (find->registered == REG_ALL))
                {
                        ih.first = "*";
                        ih.second = find->GetIPString();
                        target = std::string("*@") + find->GetIPString();
                }
                else
-                       ih = ServerInstance->XLines->IdentSplit(target.c_str());
+                       ih = ServerInstance->XLines->IdentSplit(target);
 
         if (ih.first.empty())
         {
-            user->WriteServ("NOTICE %s :*** Target not found", user->nick.c_str());
+            user->WriteNotice("*** Target not found");
             return CMD_FAILURE;
         }
 
@@ -72,11 +68,11 @@ CmdResult CommandKline::Handle (const std::vector<std::string>& parameters, User
 
                if (target.find('!') != std::string::npos)
                {
-                       user->WriteServ("NOTICE %s :*** K-Line cannot operate on nick!user@host masks",user->nick.c_str());
+                       user->WriteNotice("*** K-Line cannot operate on nick!user@host masks");
                        return CMD_FAILURE;
                }
 
-               long duration = ServerInstance->Duration(parameters[1].c_str());
+               unsigned long duration = InspIRCd::Duration(parameters[1]);
                KLine* kl = new KLine(ServerInstance->Time(), duration, user->nick.c_str(), parameters[2].c_str(), ih.first.c_str(), ih.second.c_str());
                if (ServerInstance->XLines->AddLine(kl,user))
                {
@@ -87,7 +83,7 @@ CmdResult CommandKline::Handle (const std::vector<std::string>& parameters, User
                        else
                        {
                                time_t c_requires_crap = duration + ServerInstance->Time();
-                               std::string timestr = ServerInstance->TimeString(c_requires_crap);
+                               std::string timestr = InspIRCd::TimeString(c_requires_crap);
                                ServerInstance->SNO->WriteToSnoMask('x',"%s added timed K-line for %s, expires on %s: %s",user->nick.c_str(),target.c_str(),
                                                timestr.c_str(), parameters[2].c_str());
                        }
@@ -97,7 +93,7 @@ CmdResult CommandKline::Handle (const std::vector<std::string>& parameters, User
                else
                {
                        delete kl;
-                       user->WriteServ("NOTICE %s :*** K-Line for %s already exists",user->nick.c_str(),target.c_str());
+                       user->WriteNotice("*** K-Line for " + target + " already exists");
                }
        }
        else
@@ -108,7 +104,7 @@ CmdResult CommandKline::Handle (const std::vector<std::string>& parameters, User
                }
                else
                {
-                       user->WriteServ("NOTICE %s :*** K-Line %s not found in list, try /stats k.",user->nick.c_str(),target.c_str());
+                       user->WriteNotice("*** K-Line " + target + " not found in list, try /stats k.");
                }
        }