00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025 #include "stdinc.h"
00026 #include "handlers.h"
00027 #include "client.h"
00028 #include "ircd.h"
00029 #include "numeric.h"
00030 #include "s_serv.h"
00031 #include "s_conf.h"
00032 #include "send.h"
00033 #include "msg.h"
00034 #include "parse.h"
00035 #include "modules.h"
00036
00037 static void m_users(struct Client *, struct Client *, int, char *[]);
00038 static void mo_users(struct Client *, struct Client *, int, char *[]);
00039
00040 struct Message users_msgtab = {
00041 "USERS", 0, 0, 0, 0, MFLG_SLOW, 0,
00042 { m_unregistered, m_users, mo_users, m_ignore, mo_users, m_ignore }
00043 };
00044
00045 #ifndef STATIC_MODULES
00046 void
00047 _modinit(void)
00048 {
00049 mod_add_cmd(&users_msgtab);
00050 }
00051
00052 void
00053 _moddeinit(void)
00054 {
00055 mod_del_cmd(&users_msgtab);
00056 }
00057
00058 const char *_version = "$Revision: 435 $";
00059 #endif
00060
00061
00062
00063
00064
00065
00066 static void
00067 m_users(struct Client *client_p, struct Client *source_p,
00068 int parc, char *parv[])
00069 {
00070 static time_t last_used = 0;
00071
00072 if (last_used + ConfigFileEntry.pace_wait_simple > CurrentTime)
00073 {
00074 sendto_one(source_p, form_str(RPL_LOAD2HI), me.name, source_p->name);
00075 return;
00076 }
00077
00078 last_used = CurrentTime;
00079
00080 if (!ConfigFileEntry.disable_remote)
00081 if (hunt_server(client_p, source_p, ":%s USERS :%s", 1,
00082 parc, parv) != HUNTED_ISME)
00083 return;
00084
00085 sendto_one(source_p, form_str(RPL_LOCALUSERS), me.name, source_p->name,
00086 ConfigServerHide.hide_servers ? Count.total : Count.local,
00087 ConfigServerHide.hide_servers ? Count.max_tot : Count.max_loc,
00088 ConfigServerHide.hide_servers ? Count.total : Count.local,
00089 ConfigServerHide.hide_servers ? Count.max_tot : Count.max_loc);
00090
00091 sendto_one(source_p, form_str(RPL_GLOBALUSERS), me.name, source_p->name,
00092 Count.total, Count.max_tot, Count.total, Count.max_tot);
00093 }
00094
00095
00096
00097
00098
00099
00100 static void
00101 mo_users(struct Client *client_p, struct Client *source_p,
00102 int parc, char *parv[])
00103 {
00104 if (hunt_server(client_p, source_p, ":%s USERS :%s", 1,
00105 parc, parv) != HUNTED_ISME)
00106 return;
00107
00108 if (!IsOper(source_p) && ConfigServerHide.hide_servers)
00109 sendto_one(source_p, form_str(RPL_LOCALUSERS), me.name, source_p->name,
00110 Count.total, Count.max_tot, Count.total, Count.max_tot);
00111 else
00112 sendto_one(source_p, form_str(RPL_LOCALUSERS), me.name, source_p->name,
00113 Count.local, Count.max_loc, Count.local, Count.max_loc);
00114
00115 sendto_one(source_p, form_str(RPL_GLOBALUSERS), me.name, source_p->name,
00116 Count.total, Count.max_tot, Count.total, Count.max_tot);
00117 }