]>
Commit | Line | Data |
---|---|---|
1 | make use of the SND_EXPLICIT flag to specify a pattern, reducing most output from 2 lines to 1 line | |
2 | few minor other changes: | |
3 | changed hidden to delayedjoin, | |
4 | changed no modes <none> to just + same as /MODE shows | |
5 | added zombie and delayedjoin prefix to header for check channel | |
6 | changed all (timestamp) output to [timestamp] seems more consistent with other places (e.g. snomask HACK MODEs) | |
7 | ||
8 | diff -r 8b5e0c204825 ircd/m_check.c | |
9 | --- a/ircd/m_check.c Tue Mar 23 14:12:09 2010 +0100 | |
10 | +++ b/ircd/m_check.c Tue Mar 23 14:13:56 2010 +0100 | |
11 | @@ -238,7 +238,7 @@ | |
12 | char *zombie, *showlevel; | |
13 | ||
14 | if (flags & CHECK_SHOWUSERS) { | |
15 | - send_reply(sptr, RPL_DATASTR, "Users (@ = op, + = voice)"); | |
16 | + send_reply(sptr, RPL_DATASTR, ":Users (! = zombie, @ = op, + = voice, < = delayedjoin)"); | |
17 | } | |
18 | ||
19 | if (flags & CHECK_CLONES) { | |
20 | @@ -324,89 +324,72 @@ | |
21 | cntr++; | |
22 | } | |
23 | ||
24 | - send_reply(sptr, RPL_DATASTR, " "); | |
25 | + send_reply(sptr, RPL_DATASTR, ": "); | |
26 | ||
27 | if (flags & CHECK_CLONES) { | |
28 | - ircd_snprintf(0, outbuf, sizeof(outbuf), | |
29 | - "Total users:: %d (%d ops, %d voiced, %d clones, %d authed, %d hidden)", | |
30 | - cntr, opcntr, vcntr, clones, authed, delayedjoin); | |
31 | + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, | |
32 | + ":Total users:: %d (%d ops, %d voiced, %d clones, %d authed, %d delayedjoin)", | |
33 | + cntr, opcntr, vcntr, clones, authed, delayedjoin); | |
34 | ||
35 | for (lp = chptr->members; lp; lp = lp->next_member) { | |
36 | cli_marker(lp->user) = 0; | |
37 | } | |
38 | } else { | |
39 | - ircd_snprintf(0, outbuf, sizeof(outbuf), | |
40 | - "Total users:: %d (%d ops, %d voiced, %d authed, %d hidden)", | |
41 | - cntr, opcntr, vcntr, authed, delayedjoin); | |
42 | + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, | |
43 | + ":Total users:: %d (%d ops, %d voiced, %d authed, %d delayedjoin)", | |
44 | + cntr, opcntr, vcntr, authed, delayedjoin); | |
45 | } | |
46 | ||
47 | - send_reply(sptr, RPL_DATASTR, outbuf); | |
48 | - send_reply(sptr, RPL_DATASTR, " "); | |
49 | + send_reply(sptr, RPL_DATASTR, ": "); | |
50 | ||
51 | /* Do not display bans if ! flags & CHECK_SHOWUSERS */ | |
52 | if (flags & CHECK_SHOWUSERS) { | |
53 | - send_reply(sptr, RPL_DATASTR, "Bans on channel::"); | |
54 | + send_reply(sptr, RPL_DATASTR, ":Bans on channel::"); | |
55 | ||
56 | for (ban = chptr->banlist; ban; ban = ban->next) { | |
57 | - ircd_snprintf(0, outbuf, sizeof(outbuf), "[%d] - %s - Set by %s, on %s (%Tu)", | |
58 | + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, | |
59 | + ":[%d] - %s - Set by %s, on %s [%Tu]", | |
60 | ++bans, ban->banstr, ban->who, myctime(ban->when), ban->when); | |
61 | - send_reply(sptr, RPL_DATASTR, outbuf); | |
62 | } | |
63 | ||
64 | if (bans == 0) | |
65 | - send_reply(sptr, RPL_DATASTR, "<none>"); | |
66 | + send_reply(sptr, RPL_DATASTR, ":<none>"); | |
67 | } | |
68 | ||
69 | send_reply(sptr, RPL_ENDOFCHECK, " "); | |
70 | } | |
71 | ||
72 | void checkChannel(struct Client *sptr, struct Channel *chptr) { | |
73 | - char outbuf[TOPICLEN + MODEBUFLEN + 64], modebuf[MODEBUFLEN], parabuf[MODEBUFLEN]; | |
74 | + char modebuf[MODEBUFLEN], parabuf[MODEBUFLEN]; | |
75 | ||
76 | /* Header */ | |
77 | - send_reply(sptr, RPL_DATASTR, " "); | |
78 | - send_reply(sptr, RPL_CHKHEAD, "channel", chptr->chname); | |
79 | - send_reply(sptr, RPL_DATASTR, " "); | |
80 | + send_reply(sptr, RPL_DATASTR, ": "); | |
81 | + send_reply(sptr, RPL_CHKHEAD, ":channel", chptr->chname); | |
82 | + send_reply(sptr, RPL_DATASTR, ": "); | |
83 | ||
84 | /* Creation Time */ | |
85 | - ircd_snprintf(sptr, outbuf, sizeof(outbuf), " Creation time:: %s (%Tu)", myctime(chptr->creationtime), chptr->creationtime); | |
86 | - send_reply(sptr, RPL_DATASTR, outbuf); | |
87 | + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, ": Creation time:: %s [%Tu]", | |
88 | + myctime(chptr->creationtime), chptr->creationtime); | |
89 | ||
90 | /* Topic */ | |
91 | if (strlen(chptr->topic) <= 0) | |
92 | - send_reply(sptr, RPL_DATASTR, " Topic:: <none>"); | |
93 | + send_reply(sptr, RPL_DATASTR, ": Topic:: <none>"); | |
94 | else { | |
95 | - ircd_snprintf(sptr, outbuf, sizeof(outbuf), " Topic:: %s", chptr->topic); | |
96 | - send_reply(sptr, RPL_DATASTR, outbuf); | |
97 | + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, ": Topic:: %s", chptr->topic); | |
98 | ||
99 | /* ..set by */ | |
100 | - ircd_snprintf(sptr, outbuf, sizeof(outbuf), " Set by:: %s", chptr->topic_nick); | |
101 | - send_reply(sptr, RPL_DATASTR, outbuf); | |
102 | + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, ": Set by:: %s", chptr->topic_nick); | |
103 | ||
104 | - ircd_snprintf(sptr, outbuf, sizeof(outbuf), " Set at:: %s (%Tu)", myctime(chptr->topic_time), chptr->topic_time); | |
105 | - send_reply(sptr, RPL_DATASTR, outbuf); | |
106 | + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, ": Set at:: %s [%Tu]", myctime(chptr->topic_time), chptr->topic_time); | |
107 | } | |
108 | ||
109 | /* Channel Modes */ | |
110 | - | |
111 | - strcpy(outbuf, "Channel mode(s):: "); | |
112 | - | |
113 | - modebuf[0] = '\0'; | |
114 | - parabuf[0] = '\0'; | |
115 | - | |
116 | - channel_modes(sptr, modebuf, parabuf, sizeof(modebuf), chptr, NULL); | |
117 | - | |
118 | - if(modebuf[1] == '\0') | |
119 | - strcat(outbuf, "<none>"); | |
120 | - else if(*parabuf) { | |
121 | - strcat(outbuf, modebuf); | |
122 | - strcat(outbuf, " "); | |
123 | - strcat(outbuf, parabuf); | |
124 | - } | |
125 | - else | |
126 | - strcat(outbuf, modebuf); | |
127 | - | |
128 | - send_reply(sptr, RPL_DATASTR, outbuf); | |
129 | + *modebuf = '\0'; | |
130 | + *parabuf = '\0'; | |
131 | + modebuf[1] = '\0'; | |
132 | + channel_modes(sptr, modebuf, parabuf, sizeof(parabuf), chptr, NULL); | |
133 | + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, ":Channel mode(s):: %s %s", | |
134 | + modebuf ? modebuf : "+", parabuf); | |
135 | ||
136 | /* Don't send 'END OF CHECK' message, it's sent in checkUsers, which is called after this. */ | |
137 | } | |
138 | @@ -415,53 +398,45 @@ | |
139 | struct Channel *chptr; | |
140 | struct Membership *lp; | |
141 | struct irc_sockaddr sin; | |
142 | - char outbuf[BUFSIZE]; | |
143 | char *umodes; | |
144 | time_t nowr; | |
145 | ||
146 | /* Header */ | |
147 | - send_reply(sptr, RPL_DATASTR, " "); | |
148 | - send_reply(sptr, RPL_CHKHEAD, "user", cli_name(acptr)); | |
149 | - send_reply(sptr, RPL_DATASTR, " "); | |
150 | + send_reply(sptr, RPL_DATASTR, ": "); | |
151 | + send_reply(sptr, RPL_CHKHEAD, ":user", cli_name(acptr)); | |
152 | + send_reply(sptr, RPL_DATASTR, ": "); | |
153 | ||
154 | - ircd_snprintf(0, outbuf, sizeof(outbuf), " Nick:: %s (%s%s)", cli_name(acptr), NumNick(acptr)); | |
155 | - send_reply(sptr, RPL_DATASTR, outbuf); | |
156 | + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, ": Nick:: %s (%s%s)", cli_name(acptr), NumNick(acptr)); | |
157 | ||
158 | - if (MyUser(acptr)) { | |
159 | - ircd_snprintf(0, outbuf, sizeof(outbuf), " Signed on:: %s (%Tu)", myctime(acptr->cli_firsttime), acptr->cli_firsttime); | |
160 | - send_reply(sptr, RPL_DATASTR, outbuf); | |
161 | - } | |
162 | + if (MyUser(acptr)) | |
163 | + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, ": Signed on:: %s [%Tu]", myctime(acptr->cli_firsttime), acptr->cli_firsttime); | |
164 | ||
165 | - ircd_snprintf(0, outbuf, sizeof(outbuf), " Timestamp:: %s (%d)", myctime(acptr->cli_lastnick), acptr->cli_lastnick); | |
166 | - send_reply(sptr, RPL_DATASTR, outbuf); | |
167 | + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, ": Timestamp:: %s [%d]", myctime(acptr->cli_lastnick), acptr->cli_lastnick); | |
168 | ||
169 | - ircd_snprintf(0, outbuf, sizeof(outbuf), " User/Hostmask:: %s@%s [%s] (Clients: %hu)", cli_user(acptr)->username, cli_user(acptr)->host, | |
170 | - ircd_ntoa(&(cli_ip(acptr))), IPcheck_nr(acptr)); | |
171 | - send_reply(sptr, RPL_DATASTR, outbuf); | |
172 | + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, ": User/Hostmask:: %s@%s [%s] (Clients: %hu)", | |
173 | + cli_user(acptr)->username, cli_user(acptr)->host, ircd_ntoa(&(cli_ip(acptr))), IPcheck_nr(acptr)); | |
174 | ||
175 | - if (IsSetHost(acptr) || HasHiddenHost(acptr)) { | |
176 | - ircd_snprintf(0, outbuf, sizeof(outbuf), " Real User/Host:: %s@%s", cli_user(acptr)->realusername, cli_user(acptr)->realhost); | |
177 | - send_reply(sptr, RPL_DATASTR, outbuf); | |
178 | - } | |
179 | + if (IsSetHost(acptr) || HasHiddenHost(acptr)) | |
180 | + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, ": Real User/Host:: %s@%s", cli_user(acptr)->realusername, cli_user(acptr)->realhost); | |
181 | ||
182 | - ircd_snprintf(0, outbuf, sizeof(outbuf), " Real Name:: %s%c", cli_info(acptr), COLOR_OFF); | |
183 | - send_reply(sptr, RPL_DATASTR, outbuf); | |
184 | + /* COLOR_OFF ? */ | |
185 | + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, ": Real Name:: %s", cli_info(acptr)); | |
186 | ||
187 | if( IsService(cli_user(acptr)->server)) { | |
188 | if (IsChannelService(acptr)) | |
189 | - send_reply(sptr, RPL_DATASTR, " Status:: Network Service"); | |
190 | + send_reply(sptr, RPL_DATASTR, ": Status:: Network Service"); | |
191 | else if (IsAnOper(acptr)) | |
192 | - send_reply(sptr, RPL_DATASTR, " Status:: IRC Operator (service) (ID: %s)", cli_user(acptr)->opername ? cli_user(acptr)->opername : "<unknown>"); | |
193 | + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, ": Status:: IRC Operator (service) (ID: %s)", cli_user(acptr)->opername ? cli_user(acptr)->opername : "<unknown>"); | |
194 | else | |
195 | - send_reply(sptr, RPL_DATASTR, " Status:: Client (service)"); | |
196 | - } else if (IsAnOper(acptr)) { | |
197 | - ircd_snprintf(0, outbuf, sizeof(outbuf), " Status:: IRC Operator (ID: %s)", cli_user(acptr)->opername ? cli_user(acptr)->opername : "<unknown>"); | |
198 | - send_reply(sptr, RPL_DATASTR, outbuf); | |
199 | - } else | |
200 | - send_reply(sptr, RPL_DATASTR, " Status:: Client"); | |
201 | + send_reply(sptr, RPL_DATASTR, ": Status:: Client (service)"); | |
202 | + } else if (IsAnOper(acptr)) | |
203 | + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, ": Status:: IRC Operator (ID: %s)", | |
204 | + cli_user(acptr)->opername ? cli_user(acptr)->opername : "<unknown>"); | |
205 | + else | |
206 | + /* this really needed ? */ | |
207 | + send_reply(sptr, RPL_DATASTR, ": Status:: Client"); | |
208 | ||
209 | - ircd_snprintf(0, outbuf, sizeof(outbuf), " Connected to:: %s (Hops: %d)", cli_name(cli_user(acptr)->server), cli_hopcount(acptr)); | |
210 | - send_reply(sptr, RPL_DATASTR, outbuf); | |
211 | + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, ": Connected to:: %s (Hops: %d)", cli_name(cli_user(acptr)->server), cli_hopcount(acptr)); | |
212 | ||
213 | /* +s (SERV_NOTICE) is not relayed to us from remote servers, | |
214 | * so we cannot tell if a remote client has that mode set. | |
215 | @@ -471,11 +446,10 @@ | |
216 | ||
217 | /* show the usermodes and account info (but not OperID and sethost) */ | |
218 | umodes = umode_str(acptr, UMODE_AND_ACCOUNT); | |
219 | - ircd_snprintf(0, outbuf, sizeof(outbuf), " Usermode(s):: %s%s", *umodes ? "+" : "<none>", umodes); | |
220 | - send_reply(sptr, RPL_DATASTR, outbuf); | |
221 | + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, ": Usermode(s):: +%s", umodes); | |
222 | ||
223 | if (cli_user(acptr)->joined == 0) | |
224 | - send_reply(sptr, RPL_DATASTR, " Channel(s):: <none>"); | |
225 | + send_reply(sptr, RPL_DATASTR, ": Channel(s):: <none>"); | |
226 | else if (cli_user(acptr)->joined > 50) { | |
227 | ||
228 | /* NB. As a sanity check, we DO NOT show the individual channels the | |
229 | @@ -485,22 +459,21 @@ | |
230 | * they are on *that* many). | |
231 | */ | |
232 | ||
233 | - ircd_snprintf(0, outbuf, sizeof(outbuf), " Channel(s):: - (total: %u)", cli_user(acptr)->joined); | |
234 | - send_reply(sptr, RPL_DATASTR, outbuf); | |
235 | + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, ": Channel(s):: - (total: %u)", cli_user(acptr)->joined); | |
236 | } | |
237 | else { | |
238 | char chntext[BUFSIZE]; | |
239 | - int len = strlen(" Channel(s):: "); | |
240 | + int len = strlen(": Channel(s):: "); | |
241 | int mlen = strlen(me.cli_name) + len + strlen(cli_name(sptr)); | |
242 | *chntext = '\0'; | |
243 | ||
244 | - strcpy(chntext, " Channel(s):: "); | |
245 | + strcpy(chntext, ": Channel(s):: "); | |
246 | for (lp = cli_user(acptr)->channel; lp; lp = lp->next_channel) { | |
247 | chptr = lp->channel; | |
248 | if (len + strlen(chptr->chname) + mlen > BUFSIZE - 5) { | |
249 | send_reply(sptr, RPL_DATASTR, chntext); | |
250 | *chntext = '\0'; | |
251 | - strcpy(chntext, " Channel(s):: "); | |
252 | + strcpy(chntext, ": Channel(s):: "); | |
253 | len = strlen(chntext); | |
254 | } | |
255 | if (IsDeaf(acptr)) | |
256 | @@ -530,39 +503,31 @@ | |
257 | ||
258 | if (MyUser(acptr)) { | |
259 | nowr = CurrentTime - cli_user(acptr)->last; | |
260 | - ircd_snprintf(0, outbuf, sizeof(outbuf), " Idle for:: %d days, %02ld:%02ld:%02ld", | |
261 | - nowr / 86400, (nowr / 3600) % 24, (nowr / 60) % 60, nowr % 60); | |
262 | - send_reply(sptr, RPL_DATASTR, outbuf); | |
263 | + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, ": Idle for:: %d days, %02ld:%02ld:%02ld", | |
264 | + nowr / 86400, (nowr / 3600) % 24, (nowr / 60) % 60, nowr % 60); | |
265 | } | |
266 | ||
267 | /* Away message (if applicable) */ | |
268 | - if (cli_user(acptr)->away) { | |
269 | - ircd_snprintf(0, outbuf, sizeof(outbuf), " Away message:: %s", cli_user(acptr)->away); | |
270 | - send_reply(sptr, RPL_DATASTR, outbuf); | |
271 | - } | |
272 | + if (cli_user(acptr)->away) | |
273 | + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, ": Away message:: %s", cli_user(acptr)->away); | |
274 | ||
275 | /* If local user.. */ | |
276 | if (MyUser(acptr)) { | |
277 | os_get_peername(con_fd(cli_connect(sptr)), &sin); | |
278 | ||
279 | send_reply(sptr, RPL_DATASTR, " "); | |
280 | - ircd_snprintf(0, outbuf, sizeof(outbuf), " Ports:: %d -> %d (client -> server)", | |
281 | - sin.port, cli_listener(acptr)->addr.port); | |
282 | - send_reply(sptr, RPL_DATASTR, outbuf); | |
283 | + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, ": Ports:: %d -> %d (client -> server)", | |
284 | + sin.port, cli_listener(acptr)->addr.port); | |
285 | if (feature_bool(FEAT_EXTENDED_CHECKCMD)) { | |
286 | /* Note: sendq = receiveq for a client (it makes sense really) */ | |
287 | - ircd_snprintf(0, outbuf, sizeof(outbuf), " Data sent:: %lu.%0.3u Kb (%u protocol messages)", | |
288 | - (unsigned long)cli_receiveB(acptr) / 1024, (unsigned long)cli_receiveB(acptr) % 1024, cli_receiveM(acptr)); | |
289 | - send_reply(sptr, RPL_DATASTR, outbuf); | |
290 | - ircd_snprintf(0, outbuf, sizeof(outbuf), " Data received:: %lu.%0.3lu Kb (%u protocol messages)", | |
291 | - (unsigned long)cli_sendB(acptr) / 1024, (unsigned long)cli_sendB(acptr) % 1024, cli_sendM(acptr)); | |
292 | - send_reply(sptr, RPL_DATASTR, outbuf); | |
293 | - ircd_snprintf(0, outbuf, sizeof(outbuf), " receiveQ size:: %d bytes (max. %d bytes)", | |
294 | - DBufLength(&(cli_recvQ(acptr))), feature_int(FEAT_CLIENT_FLOOD)); | |
295 | - send_reply(sptr, RPL_DATASTR, outbuf); | |
296 | - ircd_snprintf(0, outbuf, sizeof(outbuf), " sendQ size:: %d bytes (max. %d bytes)", | |
297 | - DBufLength(&(cli_sendQ(acptr))), get_sendq(acptr)); | |
298 | - send_reply(sptr, RPL_DATASTR, outbuf); | |
299 | + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, ": Data sent:: %lu.%0.3u Kb (%u protocol messages)", | |
300 | + (unsigned long)cli_receiveB(acptr) / 1024, (unsigned long)cli_receiveB(acptr) % 1024, cli_receiveM(acptr)); | |
301 | + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, ": Data received:: %lu.%0.3lu Kb (%u protocol messages)", | |
302 | + (unsigned long)cli_sendB(acptr) / 1024, (unsigned long)cli_sendB(acptr) % 1024, cli_sendM(acptr)); | |
303 | + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, ": receiveQ size:: %d bytes (max. %d bytes)", | |
304 | + DBufLength(&(cli_recvQ(acptr))), feature_int(FEAT_CLIENT_FLOOD)); | |
305 | + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, ": sendQ size:: %d bytes (max. %d bytes)", | |
306 | + DBufLength(&(cli_sendQ(acptr))), get_sendq(acptr)); | |
307 | } | |
308 | } | |
309 | ||
310 | @@ -571,50 +536,50 @@ | |
311 | } | |
312 | ||
313 | void checkServer(struct Client *sptr, struct Client *acptr) { | |
314 | - char outbuf[BUFSIZE]; | |
315 | ||
316 | /* Header */ | |
317 | - send_reply(sptr, RPL_DATASTR, " "); | |
318 | - send_reply(sptr, RPL_CHKHEAD, "server", acptr->cli_name); | |
319 | - send_reply(sptr, RPL_DATASTR, " "); | |
320 | + send_reply(sptr, RPL_DATASTR, ": "); | |
321 | + send_reply(sptr, RPL_CHKHEAD, ":server", acptr->cli_name); | |
322 | + send_reply(sptr, RPL_DATASTR, ": "); | |
323 | ||
324 | - ircd_snprintf(0, outbuf, sizeof(outbuf), " Connected at:: %s (%Tu)", myctime(acptr->cli_serv->timestamp), acptr->cli_serv->timestamp); | |
325 | - send_reply(sptr, RPL_DATASTR, outbuf); | |
326 | + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, ": Connected at:: %s [%Tu]", | |
327 | + myctime(acptr->cli_serv->timestamp), acptr->cli_serv->timestamp); | |
328 | ||
329 | - ircd_snprintf(0, outbuf, sizeof(outbuf), " Server name:: %s", acptr->cli_name); | |
330 | - send_reply(sptr, RPL_DATASTR, outbuf); | |
331 | + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, ": Server name:: %s", acptr->cli_name); | |
332 | ||
333 | - ircd_snprintf(0, outbuf, sizeof(outbuf), " Numeric:: %s --> %d", NumServ(acptr), base64toint(acptr->cli_yxx)); | |
334 | - send_reply(sptr, RPL_DATASTR, outbuf); | |
335 | + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, ": Numeric:: %s --> %d", | |
336 | + NumServ(acptr), base64toint(acptr->cli_yxx)); | |
337 | ||
338 | - ircd_snprintf(0, outbuf, sizeof(outbuf), " Users:: %d / %d", (acptr == &me) ? UserStats.local_clients : cli_serv(acptr)->clients, | |
339 | + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, ": Users:: %d / %d", | |
340 | + (acptr == &me) ? UserStats.local_clients : cli_serv(acptr)->clients, | |
341 | base64toint(cli_serv(acptr)->nn_capacity)); | |
342 | - send_reply(sptr, RPL_DATASTR, outbuf); | |
343 | ||
344 | if (IsBurst(acptr)) | |
345 | - send_reply(sptr, RPL_DATASTR, " Status:: Bursting"); | |
346 | + send_reply(sptr, RPL_DATASTR, ": Status:: Bursting"); | |
347 | else if (IsBurstAck(acptr)) | |
348 | - send_reply(sptr, RPL_DATASTR, " Status:: Awaiting EOB Ack"); | |
349 | + send_reply(sptr, RPL_DATASTR, ": Status:: Awaiting EOB Ack"); | |
350 | else if (IsService(acptr)) | |
351 | - send_reply(sptr, RPL_DATASTR, " Status:: Network Service"); | |
352 | + send_reply(sptr, RPL_DATASTR, ": Status:: Network Service"); | |
353 | else if (IsHub(acptr)) | |
354 | - send_reply(sptr, RPL_DATASTR, " Status:: Network Hub"); | |
355 | + send_reply(sptr, RPL_DATASTR, ": Status:: Network Hub"); | |
356 | ||
357 | if (feature_bool(FEAT_EXTENDED_CHECKCMD)) { | |
358 | int dlinkc = 0; | |
359 | struct DLink* slink = NULL; | |
360 | ||
361 | - send_reply(sptr, RPL_DATASTR, " "); | |
362 | - send_reply(sptr, RPL_DATASTR, "Downlinks::"); | |
363 | - for (slink = cli_serv(acptr)->down; slink; slink = slink->next) { | |
364 | - ircd_snprintf(0, outbuf, sizeof(outbuf), "[%d] - %s%s", ++dlinkc, | |
365 | - IsBurst(slink->value.cptr) ? "*" : IsBurstAck(slink->value.cptr) ? "!" : IsService(slink->value.cptr) ? "=" : IsHub(slink->value.cptr) ? "+" : " ", | |
366 | - cli_name(slink->value.cptr)); | |
367 | - send_reply(sptr, RPL_DATASTR, outbuf); | |
368 | - } | |
369 | + send_reply(sptr, RPL_DATASTR, ": "); | |
370 | + send_reply(sptr, RPL_DATASTR, ":Downlinks::"); | |
371 | + for (slink = cli_serv(acptr)->down; slink; slink = slink->next) | |
372 | + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, ":[%d] - %s%s", | |
373 | + ++dlinkc, | |
374 | + IsBurst(slink->value.cptr) ? "*" : | |
375 | + (IsBurstAck(slink->value.cptr) ? "!" : | |
376 | + (IsService(slink->value.cptr) ? "=" : | |
377 | + (IsHub(slink->value.cptr) ? "+" : " "))), | |
378 | + cli_name(slink->value.cptr)); | |
379 | ||
380 | if (!dlinkc) | |
381 | - send_reply(sptr, RPL_DATASTR, "<none>"); | |
382 | + send_reply(sptr, RPL_DATASTR, ":<none>"); | |
383 | } | |
384 | ||
385 | /* Send 'END OF CHECK' message */ | |
386 | @@ -626,7 +591,6 @@ | |
387 | struct Channel *chptr; | |
388 | struct Membership *lp; | |
389 | int count = 0, found = 0; | |
390 | - char outbuf[BUFSIZE]; | |
391 | char targhost[NICKLEN + USERLEN + HOSTLEN + 3], curhost[NICKLEN + USERLEN + HOSTLEN + 3]; | |
392 | char hoststr[NICKLEN + USERLEN + HOSTLEN + 3]; | |
393 | char nickm[NICKLEN + 1], userm[USERLEN + 1], hostm[HOSTLEN + 1]; | |
394 | @@ -686,8 +650,7 @@ | |
395 | break; | |
396 | ||
397 | if(count >= 500) { /* sanity stuff */ | |
398 | - ircd_snprintf(0, outbuf, sizeof(outbuf), "More than %d results, truncating...", count); | |
399 | - send_reply(sptr, RPL_DATASTR, outbuf); | |
400 | + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, ":More than %d results, truncating...", count); | |
401 | break; | |
402 | } | |
403 | ||
404 | @@ -718,37 +681,43 @@ | |
405 | /* Show header if we've found at least 1 record */ | |
406 | if (count == 0) { | |
407 | /* Output header */ | |
408 | - send_reply(sptr, RPL_DATASTR, " "); | |
409 | - send_reply(sptr, RPL_CHKHEAD, "host", targhost); | |
410 | + send_reply(sptr, RPL_DATASTR, ": "); | |
411 | + send_reply(sptr, RPL_CHKHEAD, ":host", targhost); | |
412 | ||
413 | - send_reply(sptr, RPL_DATASTR, " "); | |
414 | + send_reply(sptr, RPL_DATASTR, ": "); | |
415 | if (flags & CHECK_SHOWMORE) | |
416 | - ircd_snprintf(0, outbuf, sizeof(outbuf), "No. %s nick user@host [IP] (usermodes) :realname", (flags & CHECK_CLONES) ? "[clients]" : ""); | |
417 | + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, ":No. %s nick user@host [IP] (usermodes) :realname", | |
418 | + (flags & CHECK_CLONES) ? "[clients]" : ""); | |
419 | else | |
420 | - ircd_snprintf(0, outbuf, sizeof(outbuf), "%s %-*s%-*s%s", "No.", (NICKLEN + 2), "Nick", | |
421 | - (USERLEN + 2), "User", "Host"); | |
422 | - send_reply(sptr, RPL_DATASTR, outbuf); | |
423 | + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, ":%s %-*s%-*s%s", "No.", | |
424 | + (NICKLEN + 2), "Nick", (USERLEN + 2), "User", "Host"); | |
425 | } | |
426 | ||
427 | if (flags & CHECK_SHOWMORE) { | |
428 | /* show more information */ | |
429 | umodes = umode_str(acptr, UMODE_AND_ACCOUNT_SHORT); | |
430 | - ircd_snprintf(0, outbuf, sizeof(outbuf), "%-4d ", (count+1)); | |
431 | if (flags & CHECK_CLONES) | |
432 | - ircd_snprintf(0, outbuf, sizeof(outbuf), "%s[%+3hu] ", outbuf, IPcheck_nr(acptr)); | |
433 | - ircd_snprintf(0, outbuf, sizeof(outbuf), "%s%s %s@%s [%s] (%s%s) :%s", outbuf, | |
434 | - acptr->cli_name, | |
435 | - cli_user(acptr)->realusername, cli_user(acptr)->realhost, | |
436 | - ircd_ntoa(&(cli_ip(acptr))), | |
437 | - *umodes ? "+" : "<none>", umodes, | |
438 | - (flags & CHECK_SHOWSERVER) ? cli_name(cli_user(acptr)->server) : cli_info(acptr)); | |
439 | - } else { | |
440 | + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, ":%-4d [%+3hu] %s %s@%s [%s] (+%s) :%s", | |
441 | + (count+1), | |
442 | + IPcheck_nr(acptr), | |
443 | + acptr->cli_name, | |
444 | + cli_user(acptr)->realusername, cli_user(acptr)->realhost, | |
445 | + ircd_ntoa(&(cli_ip(acptr))), | |
446 | + umodes, | |
447 | + (flags & CHECK_SHOWSERVER) ? cli_name(cli_user(acptr)->server) : cli_info(acptr)); | |
448 | + else | |
449 | + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, ":%-4d %s %s@%s [%s] (+%s) :%s", | |
450 | + (count+1), | |
451 | + acptr->cli_name, | |
452 | + cli_user(acptr)->realusername, cli_user(acptr)->realhost, | |
453 | + ircd_ntoa(&(cli_ip(acptr))), | |
454 | + umodes, | |
455 | + (flags & CHECK_SHOWSERVER) ? cli_name(cli_user(acptr)->server) : cli_info(acptr)); | |
456 | + } else | |
457 | /* default output */ | |
458 | - ircd_snprintf(0, outbuf, sizeof(outbuf), "%-4d %-*s%-*s%s", (count+1), (NICKLEN + 2), | |
459 | - acptr->cli_name, (USERLEN + 2), cli_user(acptr)->realusername, | |
460 | - (flags & CHECK_SHOWIPS) ? ircd_ntoa(&(cli_ip(acptr))) : cli_user(acptr)->realhost); | |
461 | - } | |
462 | - send_reply(sptr, RPL_DATASTR, outbuf); | |
463 | + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, ":%-4d %-*s%-*s%s", | |
464 | + (count+1), (NICKLEN + 2), acptr->cli_name, (USERLEN + 2), cli_user(acptr)->realusername, | |
465 | + (flags & CHECK_SHOWIPS) ? ircd_ntoa(&(cli_ip(acptr))) : cli_user(acptr)->realhost); | |
466 | ||
467 | /* Show channel output (if applicable) - the 50 channel limit sanity check | |
468 | * is specifically to prevent coredumping when someone lamely tries to /check | |
469 | @@ -757,17 +726,17 @@ | |
470 | if (flags & CHECK_CHECKCHAN) { | |
471 | if (cli_user(acptr)->joined > 0 && cli_user(acptr)->joined <= 50) { | |
472 | char chntext[BUFSIZE]; | |
473 | - int len = strlen(" on channels: "); | |
474 | + int len = strlen(": on channels: "); | |
475 | int mlen = strlen(me.cli_name) + len + strlen(sptr->cli_name); | |
476 | *chntext = '\0'; | |
477 | ||
478 | - strcpy(chntext, " on channels: "); | |
479 | + strcpy(chntext, ": on channels: "); | |
480 | for (lp = cli_user(acptr)->channel; lp; lp = lp->next_channel) { | |
481 | chptr = lp->channel; | |
482 | if (len + strlen(chptr->chname) + mlen > BUFSIZE - 5) { | |
483 | send_reply(sptr, RPL_DATASTR, chntext); | |
484 | *chntext = '\0'; | |
485 | - strcpy(chntext, " on channels: "); | |
486 | + strcpy(chntext, ": on channels: "); | |
487 | len = strlen(chntext); | |
488 | } | |
489 | if (IsDeaf(acptr)) | |
490 | @@ -793,7 +762,7 @@ | |
491 | if (chntext[0] != '\0') | |
492 | send_reply(sptr, RPL_DATASTR, chntext); | |
493 | ||
494 | - send_reply(sptr, RPL_DATASTR, " "); | |
495 | + send_reply(sptr, RPL_DATASTR, ": "); | |
496 | } | |
497 | } | |
498 | count++; | |
499 | @@ -801,11 +770,8 @@ | |
500 | } | |
501 | ||
502 | if (count > 0) { | |
503 | - send_reply(sptr, RPL_DATASTR, " "); | |
504 | - | |
505 | - ircd_snprintf(0, outbuf, sizeof(outbuf), "Matching records found:: %d", count); | |
506 | - send_reply(sptr, RPL_DATASTR, outbuf); | |
507 | - | |
508 | + send_reply(sptr, RPL_DATASTR, ": "); | |
509 | + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, ":Matching records found:: %d", count); | |
510 | send_reply(sptr, RPL_ENDOFCHECK, " "); | |
511 | } | |
512 | ||
513 | diff -r 8b5e0c204825 ircd/s_err.c | |
514 | --- a/ircd/s_err.c Tue Mar 23 14:12:09 2010 +0100 | |
515 | +++ b/ircd/s_err.c Tue Mar 23 14:13:56 2010 +0100 | |
516 | @@ -612,7 +612,7 @@ | |
517 | /* 289 */ | |
518 | { 0 }, | |
519 | /* 290 */ | |
520 | - { RPL_DATASTR, ":%s", "290" }, | |
521 | + { RPL_DATASTR, "%s", "290" }, | |
522 | /* 291 */ | |
523 | { RPL_ENDOFCHECK, ":%s", "291" }, | |
524 | /* 292 */ |