]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/commands/cmd_names.cpp
m_spanningtree Remove duplicate code for sending channel messages from RouteCommand()
[user/henk/code/inspircd.git] / src / commands / cmd_names.cpp
index f34afb361dfd5da334b451dc456da993022e75cd..c74d18c236669cfb83158cd68d86729f6e625820 100644 (file)
 
 #include "inspircd.h"
 
-#ifndef CMD_NAMES_H
-#define CMD_NAMES_H
-
-// include the common header files
-
-#include "users.h"
-#include "channels.h"
-
 /** Handle /NAMES. 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
  */
 class CommandNames : public Command
 {
+       ChanModeReference secretmode;
+
  public:
        /** Constructor for names.
         */
-       CommandNames ( Module* parent) : Command(parent,"NAMES",0,0) { syntax = "{<channel>{,<channel>}}"; }
+       CommandNames(Module* parent)
+               : Command(parent, "NAMES", 0, 0)
+               , secretmode(parent, "secret")
+       {
+               syntax = "{<channel>{,<channel>}}";
+       }
+
        /** Handle command.
         * @param parameters The parameters to the comamnd
         * @param pcnt The number of parameters passed to teh command
@@ -48,9 +48,6 @@ class CommandNames : public Command
        CmdResult Handle(const std::vector<std::string>& parameters, User *user);
 };
 
-#endif
-
-
 /** Handle /NAMES
  */
 CmdResult CommandNames::Handle (const std::vector<std::string>& parameters, User *user)
@@ -63,13 +60,13 @@ CmdResult CommandNames::Handle (const std::vector<std::string>& parameters, User
                return CMD_SUCCESS;
        }
 
-       if (ServerInstance->Parser->LoopCall(user, this, parameters, 0))
+       if (CommandParser::LoopCall(user, this, parameters, 0))
                return CMD_SUCCESS;
 
        c = ServerInstance->FindChan(parameters[0]);
        if (c)
        {
-               if ((c->IsModeSet('s')) && (!c->HasUser(user)))
+               if ((c->IsModeSet(secretmode)) && (!c->HasUser(user)))
                {
                      user->WriteNumeric(401, "%s %s :No such nick/channel",user->nick.c_str(), c->name.c_str());
                      return CMD_FAILURE;