]>
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"
6 #include "../../lib/stringbuf.h"
8 void printchannel_qusers(searchCtx
*ctx
, nick
*sender
, chanindex
*cip
) {
12 int own
=0,mas
=0,op
=0,voi
=0,kno
=0,ban
=0,tot
=0;
14 if (!(rcp
=cip
->exts
[chanservext
])) {
15 ctx
->reply(sender
,"[ - not registered - ] %s",cip
->name
->content
);
19 for (i
=0;i
<REGCHANUSERHASHSIZE
;i
++) {
20 for (rcup
=rcp
->regusers
[i
];rcup
;rcup
=rcup
->nextbychan
) {
23 if (CUIsOwner(rcup
)) own
++; else
24 if (CUIsMaster(rcup
)) mas
++; else
25 if (CUIsOp(rcup
)) op
++; else
26 if (CUIsVoice(rcup
)) voi
++; else
27 if (CUIsKnown(rcup
)) kno
++;
29 if (CUIsBanned(rcup
)) ban
++;
33 ctx
->reply(sender
,"[%4dn %4dm %4do %4dv %4dk %4db - %4d total ] %s",own
,mas
,op
,voi
,kno
,ban
,tot
,cip
->name
->content
);
37 void printnick_auth(searchCtx
*ctx
, nick
*sender
, nick
*np
) {
40 if (!(rup
=getreguserfromnick(np
))) {
41 ctx
->reply(sender
,"%s (not authed)",np
->nick
);
43 ctx
->reply(sender
,"%s (%s/%u) (%s) (%s)",np
->nick
,rup
->username
,rup
->ID
,
44 rup
->email
? rup
->email
->content
: "no email",
45 rup
->comment
? rup
->comment
->content
: "no comment" );
49 void printnick_authchans(searchCtx
*ctx
, nick
*sender
, nick
*np
) {
51 struct regchanuser
*rcup
;
54 unsigned int bufpos
=0, buf2len
;
57 printnick_auth(ctx
, sender
,np
);
59 if (!(rup
=getreguserfromnick(np
)))
63 ctx
->reply(sender
, " (no channels)");
65 for (rcup
=rup
->knownon
;rcup
;rcup
=rcup
->nextbyuser
) {
68 else if (CUHasMasterPriv(rcup
))
70 else if (CUHasOpPriv(rcup
))
72 else if (CUHasVoicePriv(rcup
))
74 else if (CUKnown(rcup
))
79 buf2len
=sprintf(buf2
,"%c%s",ch
,rcup
->chan
->index
->name
->content
);
81 if (buf2len
+bufpos
> 400) {
82 ctx
->reply(sender
," %s", thebuf
);
85 bufpos
+=sprintf(thebuf
+bufpos
,"%s ",buf2
);
88 ctx
->reply(sender
," %s", thebuf
);
92 void printauth(searchCtx
*ctx
, nick
*sender
, authname
*anp
) {
101 if (!(rup
=anp
->exts
[chanservaext
]))
107 b.capacity = sizeof(output);
111 for(tnp=anp->nicks;tnp;tnp=tnp->next) {
115 sbaddstr(&b, tnp->nick);
119 ctx->reply(sender, " %s%s%s%s", rup->username, *output?" (":"", output, *output?")":"");
123 char timebuf
[TIMELEN
];
124 q9strftime(timebuf
, sizeof(timebuf
), rup
->lastauth
);
130 ctx
->reply(sender
, "%-15s %-10s %-30s %-15s %s", rup
->username
, UHasSuspension(rup
)?"yes":"no", rup
->email
?rup
->email
->content
:"(no email)", la
, rup
->lastuserhost
?rup
->lastuserhost
->content
:"(no last host)");