]> jfr.im git - irc/quakenet/newserv.git/blob - chanserv/newsearch/formats.c
Merge
[irc/quakenet/newserv.git] / chanserv / newsearch / formats.c
1 #include "../chanserv.h"
2 #include "../../newsearch/newsearch.h"
3 #include "../../control/control.h"
4
5 void printnick_auth(nick *sender, nick *np) {
6 struct reguser *rup;
7
8 if (!(rup=getreguserfromnick(np))) {
9 controlreply(sender,"%s (not authed)",np->nick);
10 } else {
11 controlreply(sender,"%s (%s/%u) (%s) (%s)",np->nick,rup->username,rup->ID,
12 rup->email ? rup->email->content : "no email",
13 rup->comment ? rup->comment->content : "no comment" );
14 }
15 }
16
17 void printnick_authchans(nick *sender, nick *np) {
18 struct reguser *rup;
19 struct regchanuser *rcup;
20 char thebuf[1024];
21 char buf2[512];
22 unsigned int bufpos=0, buf2len;
23 unsigned char ch;
24
25 printnick_auth(sender,np);
26
27 if (!(rup=getreguserfromnick(np)))
28 return;
29
30 if (!rup->knownon) {
31 controlreply(sender, " (no channels)");
32 } else {
33 for (rcup=rup->knownon;rcup;rcup=rcup->nextbyuser) {
34 if (CUIsOwner(rcup))
35 ch='*';
36 else if (CUHasMasterPriv(rcup))
37 ch='&';
38 else if (CUHasOpPriv(rcup))
39 ch='@';
40 else if (CUHasVoicePriv(rcup))
41 ch='+';
42 else if (CUKnown(rcup))
43 ch=' ';
44 else
45 ch='!';
46
47 buf2len=sprintf(buf2,"%c%s",ch,rcup->chan->index->name->content);
48
49 if (buf2len+bufpos > 400) {
50 controlreply(sender," %s", thebuf);
51 bufpos=0;
52 }
53 bufpos+=sprintf(thebuf+bufpos,"%s ",buf2);
54 }
55 if (bufpos)
56 controlreply(sender," %s", thebuf);
57 }
58 }