]>
jfr.im git - irc/quakenet/newserv.git/blob - chanserv/newsearch/formats.c
3 #include "../chanserv.h"
4 #include "../../newsearch/newsearch.h"
5 #include "../../control/control.h"
7 void printchannel_qusers(searchCtx
*ctx
, nick
*sender
, chanindex
*cip
) {
11 int own
=0,mas
=0,op
=0,voi
=0,kno
=0,ban
=0,tot
=0;
13 if (!(rcp
=cip
->exts
[chanservext
])) {
14 ctx
->reply(sender
,"[ - not registered - ] %s",cip
->name
->content
);
18 for (i
=0;i
<REGCHANUSERHASHSIZE
;i
++) {
19 for (rcup
=rcp
->regusers
[i
];rcup
;rcup
=rcup
->nextbychan
) {
22 if (CUIsOwner(rcup
)) own
++; else
23 if (CUIsMaster(rcup
)) mas
++; else
24 if (CUIsOp(rcup
)) op
++; else
25 if (CUIsVoice(rcup
)) voi
++; else
26 if (CUIsKnown(rcup
)) kno
++;
28 if (CUIsBanned(rcup
)) ban
++;
32 ctx
->reply(sender
,"[%4dn %4dm %4do %4dv %4dk %4db - %4d total ] %s",own
,mas
,op
,voi
,kno
,ban
,tot
,cip
->name
->content
);
36 void printnick_auth(searchCtx
*ctx
, nick
*sender
, nick
*np
) {
39 if (!(rup
=getreguserfromnick(np
))) {
40 ctx
->reply(sender
,"%s (not authed)",np
->nick
);
42 ctx
->reply(sender
,"%s (%s/%u) (%s) (%s)",np
->nick
,rup
->username
,rup
->ID
,
43 rup
->email
? rup
->email
->content
: "no email",
44 rup
->comment
? rup
->comment
->content
: "no comment" );
48 void printnick_authchans(searchCtx
*ctx
, nick
*sender
, nick
*np
) {
50 struct regchanuser
*rcup
;
53 unsigned int bufpos
=0, buf2len
;
56 printnick_auth(ctx
, sender
,np
);
58 if (!(rup
=getreguserfromnick(np
)))
62 ctx
->reply(sender
, " (no channels)");
64 for (rcup
=rup
->knownon
;rcup
;rcup
=rcup
->nextbyuser
) {
67 else if (CUHasMasterPriv(rcup
))
69 else if (CUHasOpPriv(rcup
))
71 else if (CUHasVoicePriv(rcup
))
73 else if (CUKnown(rcup
))
78 buf2len
=sprintf(buf2
,"%c%s",ch
,rcup
->chan
->index
->name
->content
);
80 if (buf2len
+bufpos
> 400) {
81 ctx
->reply(sender
," %s", thebuf
);
84 bufpos
+=sprintf(thebuf
+bufpos
,"%s ",buf2
);
87 ctx
->reply(sender
," %s", thebuf
);