]>
Commit | Line | Data |
---|---|---|
524d28f9 CP |
1 | #include <stdio.h> |
2 | ||
b2b36016 | 3 | #include "../chanserv.h" |
4 | #include "../../newsearch/newsearch.h" | |
5 | #include "../../control/control.h" | |
6d349eb0 | 6 | #include "../../lib/stringbuf.h" |
b2b36016 | 7 | |
b888ae09 | 8 | void printchannel_qusers(searchCtx *ctx, nick *sender, chanindex *cip) { |
bbef4b5d | 9 | regchanuser *rcup; |
10 | regchan *rcp; | |
11 | int i; | |
12 | int own=0,mas=0,op=0,voi=0,kno=0,ban=0,tot=0; | |
13 | ||
14 | if (!(rcp=cip->exts[chanservext])) { | |
b888ae09 | 15 | ctx->reply(sender,"[ - not registered - ] %s",cip->name->content); |
bbef4b5d | 16 | return; |
17 | } | |
18 | ||
19 | for (i=0;i<REGCHANUSERHASHSIZE;i++) { | |
20 | for (rcup=rcp->regusers[i];rcup;rcup=rcup->nextbychan) { | |
21 | tot++; | |
22 | ||
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++; | |
28 | ||
29 | if (CUIsBanned(rcup)) ban++; | |
30 | } | |
31 | } | |
32 | ||
b888ae09 | 33 | ctx->reply(sender,"[%4dn %4dm %4do %4dv %4dk %4db - %4d total ] %s",own,mas,op,voi,kno,ban,tot,cip->name->content); |
bbef4b5d | 34 | } |
35 | ||
36 | ||
b888ae09 | 37 | void printnick_auth(searchCtx *ctx, nick *sender, nick *np) { |
b2b36016 | 38 | struct reguser *rup; |
39 | ||
40 | if (!(rup=getreguserfromnick(np))) { | |
b888ae09 | 41 | ctx->reply(sender,"%s (not authed)",np->nick); |
b2b36016 | 42 | } else { |
b888ae09 | 43 | ctx->reply(sender,"%s (%s/%u) (%s) (%s)",np->nick,rup->username,rup->ID, |
b2b36016 | 44 | rup->email ? rup->email->content : "no email", |
45 | rup->comment ? rup->comment->content : "no comment" ); | |
46 | } | |
47 | } | |
48 | ||
b888ae09 | 49 | void printnick_authchans(searchCtx *ctx, nick *sender, nick *np) { |
b2b36016 | 50 | struct reguser *rup; |
51 | struct regchanuser *rcup; | |
52 | char thebuf[1024]; | |
53 | char buf2[512]; | |
54 | unsigned int bufpos=0, buf2len; | |
55 | unsigned char ch; | |
56 | ||
b888ae09 | 57 | printnick_auth(ctx, sender,np); |
b2b36016 | 58 | |
59 | if (!(rup=getreguserfromnick(np))) | |
60 | return; | |
61 | ||
62 | if (!rup->knownon) { | |
b888ae09 | 63 | ctx->reply(sender, " (no channels)"); |
b2b36016 | 64 | } else { |
65 | for (rcup=rup->knownon;rcup;rcup=rcup->nextbyuser) { | |
66 | if (CUIsOwner(rcup)) | |
67 | ch='*'; | |
68 | else if (CUHasMasterPriv(rcup)) | |
69 | ch='&'; | |
70 | else if (CUHasOpPriv(rcup)) | |
71 | ch='@'; | |
72 | else if (CUHasVoicePriv(rcup)) | |
73 | ch='+'; | |
74 | else if (CUKnown(rcup)) | |
75 | ch=' '; | |
76 | else | |
77 | ch='!'; | |
78 | ||
79 | buf2len=sprintf(buf2,"%c%s",ch,rcup->chan->index->name->content); | |
80 | ||
81 | if (buf2len+bufpos > 400) { | |
b888ae09 | 82 | ctx->reply(sender," %s", thebuf); |
b2b36016 | 83 | bufpos=0; |
84 | } | |
85 | bufpos+=sprintf(thebuf+bufpos,"%s ",buf2); | |
86 | } | |
87 | if (bufpos) | |
b888ae09 | 88 | ctx->reply(sender," %s", thebuf); |
b2b36016 | 89 | } |
90 | } | |
6d349eb0 CP |
91 | |
92 | void printauth(searchCtx *ctx, nick *sender, authname *anp) { | |
93 | reguser *rup; | |
2181a10f | 94 | char *la; |
0b78df7d GB |
95 | char timebuf[TIMELEN]; |
96 | ||
2181a10f | 97 | /* StringBuf b; |
6d349eb0 CP |
98 | char output[1024]; |
99 | nick *tnp; | |
100 | int space = 0; | |
2181a10f | 101 | */ |
6d349eb0 CP |
102 | |
103 | if (!(rup=anp->exts[chanservaext])) | |
104 | return; | |
105 | ||
2181a10f | 106 | /* |
6d349eb0 CP |
107 | output[0] = '\0'; |
108 | ||
109 | b.capacity = sizeof(output); | |
110 | b.len = 0; | |
111 | b.buf = output; | |
112 | ||
113 | for(tnp=anp->nicks;tnp;tnp=tnp->next) { | |
114 | if(space) | |
115 | sbaddchar(&b, ' '); | |
116 | space = 1; | |
117 | sbaddstr(&b, tnp->nick); | |
118 | } | |
119 | sbterminate(&b); | |
120 | ||
121 | ctx->reply(sender, " %s%s%s%s", rup->username, *output?" (":"", output, *output?")":""); | |
2181a10f CP |
122 | */ |
123 | ||
124 | if (rup->lastauth) { | |
b7eebdcc | 125 | q9strftime(timebuf, sizeof(timebuf), rup->lastauth); |
2181a10f CP |
126 | la = timebuf; |
127 | } else { | |
128 | la = "(never)"; | |
129 | } | |
130 | ||
131 | 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)"); | |
6d349eb0 | 132 | } |