]>
jfr.im git - irc/quakenet/newserv.git/blob - chanserv/usercmds/suspenduserlist.c
5e6b27d842fae700592c3f9dfc398d8ac0a93b26
1 /* Automatically generated by refactor.pl.
4 * CMDNAME: suspenduserlist
5 * CMDLEVEL: QCMD_HELPER
7 * CMDDESC: Lists suspended/locked users.
8 * CMDFUNC: csu_dosuspenduserlist
9 * CMDPROTO: int csu_dosuspenduserlist(void *source, int cargc, char **cargv);
10 * CMDHELP: Usage: suspenduserlist <username or pattern>
11 * CMDHELP: Displays all suspend users with usernames matching the specified pattern,
12 * CMDHELP: or the single user with the specified username.
15 #include "../chanserv.h"
16 #include "../../lib/irc_string.h"
20 int csu_dosuspenduserlist(void *source
, int cargc
, char **cargv
) {
22 reguser
*rup
=getreguserfromnick(sender
);
28 char buf
[200], buf2
[200];
34 chanservstdmessage(sender
, QM_NOTENOUGHPARAMS
, "suspenduserlist");
38 vrup
=findreguserbynick(cargv
[0]);
40 chanservstdmessage(sender
, QM_SUSPENDUSERLISTHEADER
);
41 for (i
=0;i
<REGUSERHASHSIZE
;i
++) {
42 for (dbrup
=regusernicktable
[i
]; dbrup
; dbrup
=dbrup
->nextbyname
) {
43 if (!UHasSuspension(dbrup
))
46 /*if (!ircd_strcmp(dbrup->username, cargv[0]) || (dbrup->suspendby == vrup->ID)) {*/
47 if ((vrup
&& (dbrup
->suspendby
== vrup
->ID
))) {
48 char suspendtype
[100];
51 if ((UIsGline(dbrup
) || UIsDelayedGline(dbrup
)) && !UHasOperPriv(rup
))
54 if (UIsDelayedGline(dbrup
))
55 strcpy(suspendtype
, "delayed gline");
56 else if (UIsGline(dbrup
))
57 strcpy(suspendtype
, "instant gline");
58 else if (UIsSuspended(dbrup
))
59 strcpy(suspendtype
, "suspended");
61 strcpy(suspendtype
, "not used");
63 if (vrup
&& (dbrup
->suspendby
== vrup
->ID
)) {
64 bywhom
=vrup
->username
;
67 reguser
* trup
=findreguserbyID(dbrup
->suspendby
);
69 bywhom
=trup
->username
;
72 if (dbrup
->suspendexp
) {
73 tmp
=gmtime(&(dbrup
->suspendexp
));
74 strftime(buf
,15,"%d/%m/%y %H:%M",tmp
);
77 tmp
=gmtime(&(dbrup
->suspendtime
));
78 strftime(buf2
,15,"%d/%m/%y %H:%M",tmp
);
81 chanservsendmessage(sender
, "%-15s %-13s %-15s %-15s %-15s %s", dbrup
->username
, suspendtype
, UHasOperPriv(rup
)?(bywhom
?bywhom
:"unknown"):"not shown", buf2
, (dbrup
->suspendexp
)?((time(0) >= dbrup
->suspendexp
)?"next auth":buf
):"never", dbrup
->suspendreason
?dbrup
->suspendreason
->content
:"(none)");
83 chanservstdmessage(sender
, QM_TOOMANYRESULTS
, 2000, "users");
89 chanservstdmessage(sender
, QM_RESULTCOUNT
, count
, "user", (count
==1)?"":"s");