]> git.netwichtig.de Git - user/henk/code/inspircd.git/blobdiff - src/cmd_list.cpp
Optimizations
[user/henk/code/inspircd.git] / src / cmd_list.cpp
index ded20d077bc9bbcc34652a531ab80470f93c8bad..eaf96c097a7ab9fbb93627846d6d780ca4a93ace 100644 (file)
  */
 
 #include "users.h"
-#include "ctables.h"
-#include "commands.h"
-#include "helperfuncs.h"
 #include "inspircd.h"
 #include "commands/cmd_list.h"
+#include "wildcard.h"
 
-extern InspIRCd* ServerInstance;
+/** Handle /LIST
+ */
+extern "C" command_t* init_command(InspIRCd* Instance)
+{
+       return new cmd_list(Instance);
+}
 
-void cmd_list::Handle (const char** parameters, int pcnt, userrec *user)
+CmdResult cmd_list::Handle (const char** parameters, int pcnt, userrec *user)
 {
        user->WriteServ("321 %s Channel :Users Name",user->nick);
        for (chan_hash::const_iterator i = ServerInstance->chanlist.begin(); i != ServerInstance->chanlist.end(); i++)
        {
+               // attempt to match a glob pattern
+               if (pcnt && !match(i->second->name, parameters[0]))
+                       continue;
                // if the channel is not private/secret, OR the user is on the channel anyway
                bool n = i->second->HasUser(user);
                if (((!(i->second->modes[CM_PRIVATE])) && (!(i->second->modes[CM_SECRET]))) || (n))
@@ -38,4 +44,6 @@ void cmd_list::Handle (const char** parameters, int pcnt, userrec *user)
                }
        }
        user->WriteServ("323 %s :End of channel list.",user->nick);
+
+       return CMD_SUCCESS;
 }