]>
jfr.im git - irc/quakenet/newserv.git/blob - chanserv/usercmds/listflags.c
1 /* Automatically generated by refactor.pl.
7 * CMDDESC: List users with the specified user flags.
8 * CMDFUNC: csu_dolistflags
9 * CMDPROTO: int csu_dolistflags(void *source, int cargc, char **cargv);
10 * CMDHELP: Usage: listflags <flags>
11 * CMDHELP: Shows a list of all users with the specified user flags.
14 #include "../chanserv.h"
15 #include "../../lib/irc_string.h"
19 int csu_dolistflags(void *source
, int cargc
, char **cargv
) {
21 reguser
*rup
=getreguserfromnick(sender
);
23 flag_t matchflags
= 0;
32 chanservstdmessage(sender
, QM_NOTENOUGHPARAMS
, "listflags");
36 ch
=cargv
[0][0]=='+'?cargv
[0]+1:cargv
[0];
38 for (i
=0; ch
[i
]; i
++) {
39 for (j
= 0; ruflags
[j
].flagchar
; j
++) {
40 if (ruflags
[j
].flagchar
== ch
[i
]) {
41 matchflags
|=ruflags
[j
].flagbit
;
47 chanservstdmessage(sender
, QM_LISTFLAGSHEADER
);
48 for (i
=0;i
<REGUSERHASHSIZE
;i
++) {
49 for (dbrup
=regusernicktable
[i
]; dbrup
; dbrup
=dbrup
->nextbyname
) {
50 if ((dbrup
->flags
& matchflags
) == matchflags
) {
51 chanservsendmessage(sender
, "%-15s %-17s %-10s %-30s %s", dbrup
->username
, printflags(dbrup
->flags
, ruflags
),
52 UHasSuspension(dbrup
)?"yes":"no", dbrup
->email
?dbrup
->email
->content
:"none set",
53 dbrup
->lastuserhost
?dbrup
->lastuserhost
->content
:"none");
56 chanservstdmessage(sender
, QM_TOOMANYRESULTS
, 2000, "users");
62 chanservstdmessage(sender
, QM_RESULTCOUNT
, count
, "user", (count
==1)?"":"s");