unrealircd- supernets unrealircd source & configuration |
git clone git://git.acid.vegas/unrealircd.git |
Log | Files | Refs | Archive | README | LICENSE |
lusers.c (2900B)
1 /* 2 * IRC - Internet Relay Chat, src/modules/lusers.c 3 * (C) 2005 The UnrealIRCd Team 4 * 5 * See file AUTHORS in IRC package for additional names of 6 * the programmers. 7 * 8 * This program is free software; you can redistribute it and/or modify 9 * it under the terms of the GNU General Public License as published by 10 * the Free Software Foundation; either version 1, or (at your option) 11 * any later version. 12 * 13 * This program is distributed in the hope that it will be useful, 14 * but WITHOUT ANY WARRANTY; without even the implied warranty of 15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 16 * GNU General Public License for more details. 17 * 18 * You should have received a copy of the GNU General Public License 19 * along with this program; if not, write to the Free Software 20 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. 21 */ 22 23 #include "unrealircd.h" 24 25 CMD_FUNC(cmd_lusers); 26 27 #define MSG_LUSERS "LUSERS" 28 29 ModuleHeader MOD_HEADER 30 = { 31 "lusers", 32 "5.0", 33 "command /lusers", 34 "UnrealIRCd Team", 35 "unrealircd-6", 36 }; 37 38 MOD_INIT() 39 { 40 CommandAdd(modinfo->handle, MSG_LUSERS, cmd_lusers, MAXPARA, CMD_USER|CMD_SERVER); 41 MARK_AS_OFFICIAL_MODULE(modinfo); 42 return MOD_SUCCESS; 43 } 44 45 MOD_LOAD() 46 { 47 return MOD_SUCCESS; 48 } 49 50 MOD_UNLOAD() 51 { 52 return MOD_SUCCESS; 53 } 54 55 /* 56 * parv[1] = server to query 57 */ 58 CMD_FUNC(cmd_lusers) 59 { 60 char flatmap; 61 62 if (hunt_server(client, recv_mtags, "LUSERS", 1, parc, parv) != HUNTED_ISME) 63 return; 64 65 flatmap = (FLAT_MAP && !ValidatePermissionsForPath("server:info:lusers",client,NULL,NULL,NULL)) ? 1 : 0; 66 67 /* Just to correct results ---Stskeeps */ 68 if (irccounts.clients > irccounts.global_max) 69 irccounts.global_max = irccounts.clients; 70 if (irccounts.me_clients > irccounts.me_max) 71 irccounts.me_max = irccounts.me_clients; 72 73 sendnumeric(client, RPL_LUSERCLIENT, 74 irccounts.clients - irccounts.invisible, irccounts.invisible, 75 irccounts.servers); 76 77 if (irccounts.operators) 78 sendnumeric(client, RPL_LUSEROP, irccounts.operators); 79 if (irccounts.unknown) 80 sendnumeric(client, RPL_LUSERUNKNOWN, irccounts.unknown); 81 if (irccounts.channels) 82 sendnumeric(client, RPL_LUSERCHANNELS, irccounts.channels); 83 sendnumeric(client, RPL_LUSERME, irccounts.me_clients, flatmap ? 0 : irccounts.me_servers); 84 sendnumeric(client, RPL_LOCALUSERS, irccounts.me_clients, irccounts.me_max, irccounts.me_clients, irccounts.me_max); 85 sendnumeric(client, RPL_GLOBALUSERS, irccounts.clients, irccounts.global_max, irccounts.clients, irccounts.global_max); 86 if (irccounts.me_clients > max_connection_count) 87 { 88 max_connection_count = irccounts.me_clients; 89 if (max_connection_count % 10 == 0) /* only send on even tens */ 90 { 91 unreal_log(ULOG_INFO, "client", "NEW_USER_RECORD", NULL, 92 "New record on this server: $num_users connections", 93 log_data_integer("num_users", max_connection_count)); 94 } 95 } 96 }