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