]>
jfr.im git - irc/quakenet/newserv.git/blob - chanserv/usercmds/suspenduserlist.c
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
);
23 reguser
*dbrup
, *trup
;
26 char buf
[TIMELEN
], buf2
[TIMELEN
], *bywhom
;
27 time_t now
=time(NULL
);
33 chanservstdmessage(sender
, QM_NOTENOUGHPARAMS
, "suspenduserlist");
37 seewhom
= cs_privcheck(QPRIV_VIEWSUSPENDEDBY
, sender
);
42 chanservstdmessage(sender
, QM_SUSPENDUSERLISTHEADER
);
43 for (i
=0;i
<REGUSERHASHSIZE
;i
++) {
44 for (dbrup
=regusernicktable
[i
]; dbrup
; dbrup
=dbrup
->nextbyname
) {
45 if (!UHasSuspension(dbrup
))
48 if (!match(cargv
[0], dbrup
->username
)) {
49 char suspendtype
[100];
51 if (UIsDelayedGline(dbrup
))
52 strcpy(suspendtype
, "delayed gline");
53 else if (UIsGline(dbrup
))
54 strcpy(suspendtype
, "instant gline");
55 else if (UIsSuspended(dbrup
))
56 strcpy(suspendtype
, "suspended");
58 strcpy(suspendtype
, "not used");
61 trup
=findreguserbyID(dbrup
->suspendby
);
63 bywhom
=trup
->username
;
68 if (dbrup
->suspendexp
)
69 q9strftime(buf
,sizeof(buf
),dbrup
->suspendexp
);
71 q9strftime(buf2
,sizeof(buf2
),dbrup
->suspendtime
);
76 chanservsendmessage(sender
, "%-15s %-13s %-15s %-19s %-19s %s", dbrup
->username
, suspendtype
, bywhom
, buf2
, (dbrup
->suspendexp
)?((now
>= dbrup
->suspendexp
)?"next auth":buf
):"never", dbrup
->suspendreason
?dbrup
->suspendreason
->content
:"(none)");
78 chanservstdmessage(sender
, QM_TOOMANYRESULTS
, 2000, "users");
84 chanservstdmessage(sender
, QM_RESULTCOUNT
, count
, "user", (count
==1)?"":"s");