X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=src%2Fcmd_lusers.cpp;h=1a16ddc863b4979b0a6cd1ef147156c51beb3066;hb=b844d1cbbe79585facc69b9247baa8427cff0b62;hp=8933efa048cb60108f1416f88fc36eb28f03c7f8;hpb=77123f4dec9f29105f6c0ceea0262cfe8e9eaa1a;p=user%2Fhenk%2Fcode%2Finspircd.git diff --git a/src/cmd_lusers.cpp b/src/cmd_lusers.cpp index 8933efa04..1a16ddc86 100644 --- a/src/cmd_lusers.cpp +++ b/src/cmd_lusers.cpp @@ -2,12 +2,9 @@ * | Inspire Internet Relay Chat Daemon | * +------------------------------------+ * - * InspIRCd is copyright (C) 2002-2006 ChatSpike-Dev. - * E-mail: - * - * + * InspIRCd: (C) 2002-2007 InspIRCd Development Team + * See: http://www.inspircd.org/wiki/index.php/Credits * - * Written by Craig Edwards, Craig McLure, and others. * This program is free but copyrighted software; see * the file COPYING for details. * @@ -15,17 +12,30 @@ */ #include "users.h" -#include "commands.h" -#include "helperfuncs.h" -#include "cmd_lusers.h" +#include "inspircd.h" +#include "commands/cmd_lusers.h" -void cmd_lusers::Handle (char **parameters, int pcnt, userrec *user) +extern "C" command_t* init_command(InspIRCd* Instance) +{ + return new cmd_lusers(Instance); +} + +/** Handle /LUSERS + */ +CmdResult cmd_lusers::Handle (const char** parameters, int pcnt, userrec *user) { // this lusers command shows one server at all times because // a protocol module must override it to show those stats. - WriteServ(user->fd,"251 %s :There are %d users and %d invisible on 1 server",user->nick,usercnt()-usercount_invisible(),usercount_invisible()); - WriteServ(user->fd,"252 %s %d :operator(s) online",user->nick,usercount_opers()); - WriteServ(user->fd,"253 %s %d :unknown connections",user->nick,usercount_unknown()); - WriteServ(user->fd,"254 %s %d :channels formed",user->nick,chancount()); - WriteServ(user->fd,"254 %s :I have %d clients and 0 servers",user->nick,local_count()); + user->WriteServ("251 %s :There are %d users and %d invisible on 1 server",user->nick,ServerInstance->UserCount()-ServerInstance->InvisibleUserCount(),ServerInstance->InvisibleUserCount()); + if (ServerInstance->OperCount()) + user->WriteServ("252 %s %d :operator(s) online",user->nick,ServerInstance->OperCount()); + if (ServerInstance->UnregisteredUserCount()) + user->WriteServ("253 %s %d :unknown connections",user->nick,ServerInstance->UnregisteredUserCount()); + if (ServerInstance->ChannelCount()) + user->WriteServ("254 %s %d :channels formed",user->nick,ServerInstance->ChannelCount()); + if (ServerInstance->LocalUserCount()) + user->WriteServ("254 %s :I have %d clients and 0 servers",user->nick,ServerInstance->LocalUserCount()); + + return CMD_SUCCESS; } +