]> jfr.im git - irc/quakenet/snircd-patchqueue.git/blob - checkoutput.patch
remoteglinejupe.patch - add wallops for local jupe actions by remote oper
[irc/quakenet/snircd-patchqueue.git] / checkoutput.patch
1 diff -r 1efc7adbc134 ircd/m_check.c
2 --- a/ircd/m_check.c Wed Jan 28 16:24:48 2009 +0100
3 +++ b/ircd/m_check.c Wed Jan 28 17:36:21 2009 +0100
4 @@ -119,8 +119,10 @@
5 break;
6
7 case 'o':
8 + case 'O':
9 flags |= CHECK_OPSONLY; /* fall through */
10 case 'u':
11 + case 'U':
12 flags &= ~(CHECK_SHOWUSERS);
13 break;
14
15 @@ -128,18 +130,21 @@
16 flags |= CHECK_SHOWIPS;
17 break;
18 case 'l':
19 + case 'L':
20 flags |= CHECK_OPLEVELS;
21 break;
22 case 'C':
23 flags |= CHECK_CLONES;
24 break;
25 case 's':
26 + case 'S':
27 flags |= CHECK_SHOWSERVER;
28 break;
29 case 'I':
30 flags |= CHECK_SHOWHOSTIP;
31 break;
32 case 'e':
33 + case 'E':
34 flags |= CHECK_SHOWMORE;
35 break;
36 default:
37 @@ -238,7 +243,7 @@
38 char *zombie, *showlevel;
39
40 if (flags & CHECK_SHOWUSERS) {
41 - send_reply(sptr, RPL_DATASTR, "Users (@ = op, + = voice)");
42 + send_reply(sptr, RPL_DATASTR, "Users (! = zombie, @ = op, + = voice, < = delayedjoin)");
43 }
44
45 if (flags & CHECK_CLONES) {
46 @@ -369,22 +374,19 @@
47 send_reply(sptr, RPL_DATASTR, " ");
48
49 /* Creation Time */
50 - ircd_snprintf(sptr, outbuf, sizeof(outbuf), " Creation time:: %s (%Tu)", myctime(chptr->creationtime), chptr->creationtime);
51 - send_reply(sptr, RPL_DATASTR, outbuf);
52 + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, " Creation time:: %s (%Tu)",
53 + myctime(chptr->creationtime), chptr->creationtime);
54
55 /* Topic */
56 if (strlen(chptr->topic) <= 0)
57 send_reply(sptr, RPL_DATASTR, " Topic:: <none>");
58 else {
59 - ircd_snprintf(sptr, outbuf, sizeof(outbuf), " Topic:: %s", chptr->topic);
60 - send_reply(sptr, RPL_DATASTR, outbuf);
61 + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, " Topic:: %s", chptr->topic);
62
63 /* ..set by */
64 - ircd_snprintf(sptr, outbuf, sizeof(outbuf), " Set by:: %s", chptr->topic_nick);
65 - send_reply(sptr, RPL_DATASTR, outbuf);
66 + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, " Set by:: %s", chptr->topic_nick);
67
68 - ircd_snprintf(sptr, outbuf, sizeof(outbuf), " Set at:: %s (%Tu)", myctime(chptr->topic_time), chptr->topic_time);
69 - send_reply(sptr, RPL_DATASTR, outbuf);
70 + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, " Set at:: %s (%Tu)", myctime(chptr->topic_time), chptr->topic_time);
71 }
72
73 /* Channel Modes */
74 @@ -393,20 +395,14 @@
75
76 modebuf[0] = '\0';
77 parabuf[0] = '\0';
78 + modebuf[1] = '\0';
79
80 + /* channel_modes(sptr, modebuf, parabuf, sizeof(parabuf), chptr, member);
81 + * from m_mode.c - sizeof(parabuf) instead of sizeof(modebuf) ?
82 + */
83 channel_modes(sptr, modebuf, parabuf, sizeof(modebuf), chptr, NULL);
84 -
85 - if(modebuf[1] == '\0')
86 - strcat(outbuf, "<none>");
87 - else if(*parabuf) {
88 - strcat(outbuf, modebuf);
89 - strcat(outbuf, " ");
90 - strcat(outbuf, parabuf);
91 - }
92 - else
93 - strcat(outbuf, modebuf);
94 -
95 - send_reply(sptr, RPL_DATASTR, outbuf);
96 + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, "Channel mode(s):: %s %s",
97 + modebuf ? modebuf : "<none>", parabuf);
98
99 /* Don't send 'END OF CHECK' message, it's sent in checkUsers, which is called after this. */
100 }
101 @@ -424,44 +420,37 @@
102 send_reply(sptr, RPL_CHKHEAD, "user", cli_name(acptr));
103 send_reply(sptr, RPL_DATASTR, " ");
104
105 - ircd_snprintf(0, outbuf, sizeof(outbuf), " Nick:: %s (%s%s)", cli_name(acptr), NumNick(acptr));
106 - send_reply(sptr, RPL_DATASTR, outbuf);
107 + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, " Nick:: %s (%s%s)", cli_name(acptr), NumNick(acptr));
108
109 - if (MyUser(acptr)) {
110 - ircd_snprintf(0, outbuf, sizeof(outbuf), " Signed on:: %s (%Tu)", myctime(acptr->cli_firsttime), acptr->cli_firsttime);
111 - send_reply(sptr, RPL_DATASTR, outbuf);
112 - }
113 + if (MyUser(acptr))
114 + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, " Signed on:: %s (%Tu)", myctime(acptr->cli_firsttime), acptr->cli_firsttime);
115
116 - ircd_snprintf(0, outbuf, sizeof(outbuf), " Timestamp:: %s (%d)", myctime(acptr->cli_lastnick), acptr->cli_lastnick);
117 - send_reply(sptr, RPL_DATASTR, outbuf);
118 + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, " Timestamp:: %s (%d)", myctime(acptr->cli_lastnick), acptr->cli_lastnick);
119
120 - ircd_snprintf(0, outbuf, sizeof(outbuf), " User/Hostmask:: %s@%s [%s] (Clients: %hu)", cli_user(acptr)->username, cli_user(acptr)->host,
121 - ircd_ntoa(&(cli_ip(acptr))), IPcheck_nr(acptr));
122 - send_reply(sptr, RPL_DATASTR, outbuf);
123 + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, " User/Hostmask:: %s@%s [%s] (Clients: %hu)",
124 + cli_user(acptr)->username, cli_user(acptr)->host, ircd_ntoa(&(cli_ip(acptr))), IPcheck_nr(acptr));
125
126 - if (IsSetHost(acptr) || HasHiddenHost(acptr)) {
127 - ircd_snprintf(0, outbuf, sizeof(outbuf), " Real User/Host:: %s@%s", cli_user(acptr)->realusername, cli_user(acptr)->realhost);
128 - send_reply(sptr, RPL_DATASTR, outbuf);
129 - }
130 + if (IsSetHost(acptr) || HasHiddenHost(acptr))
131 + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, " Real User/Host:: %s@%s", cli_user(acptr)->realusername, cli_user(acptr)->realhost);
132
133 - ircd_snprintf(0, outbuf, sizeof(outbuf), " Real Name:: %s%c", cli_info(acptr), COLOR_OFF);
134 - send_reply(sptr, RPL_DATASTR, outbuf);
135 + /* COLOR_OFF ? */
136 + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, " Real Name:: %s", cli_info(acptr));
137
138 if( IsService(cli_user(acptr)->server)) {
139 if (IsChannelService(acptr))
140 send_reply(sptr, RPL_DATASTR, " Status:: Network Service");
141 else if (IsAnOper(acptr))
142 - send_reply(sptr, RPL_DATASTR, " Status:: IRC Operator (service) (ID: %s)", cli_user(acptr)->opername ? cli_user(acptr)->opername : "<unknown>");
143 + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, " Status:: IRC Operator (service) (ID: %s)", cli_user(acptr)->opername ? cli_user(acptr)->opername : "<unknown>");
144 else
145 send_reply(sptr, RPL_DATASTR, " Status:: Client (service)");
146 - } else if (IsAnOper(acptr)) {
147 - ircd_snprintf(0, outbuf, sizeof(outbuf), " Status:: IRC Operator (ID: %s)", cli_user(acptr)->opername ? cli_user(acptr)->opername : "<unknown>");
148 - send_reply(sptr, RPL_DATASTR, outbuf);
149 - } else
150 + } else if (IsAnOper(acptr))
151 + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, " Status:: IRC Operator (ID: %s)",
152 + cli_user(acptr)->opername ? cli_user(acptr)->opername : "<unknown>");
153 + else
154 + /* this really needed ? */
155 send_reply(sptr, RPL_DATASTR, " Status:: Client");
156
157 - ircd_snprintf(0, outbuf, sizeof(outbuf), " Connected to:: %s (Hops: %d)", cli_name(cli_user(acptr)->server), cli_hopcount(acptr));
158 - send_reply(sptr, RPL_DATASTR, outbuf);
159 + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, " Connected to:: %s (Hops: %d)", cli_name(cli_user(acptr)->server), cli_hopcount(acptr));
160
161 /* +s (SERV_NOTICE) is not relayed to us from remote servers,
162 * so we cannot tell if a remote client has that mode set.
163 @@ -471,8 +460,7 @@
164
165 /* show the usermodes and account info (but not OperID and sethost) */
166 umodes = umode_str(acptr, UMODE_AND_ACCOUNT);
167 - ircd_snprintf(0, outbuf, sizeof(outbuf), " Usermode(s):: %s%s", *umodes ? "+" : "<none>", umodes);
168 - send_reply(sptr, RPL_DATASTR, outbuf);
169 + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, " Usermode(s):: %s%s", *umodes ? "+" : "<none>", umodes);
170
171 if (cli_user(acptr)->joined == 0)
172 send_reply(sptr, RPL_DATASTR, " Channel(s):: <none>");
173 @@ -485,8 +473,7 @@
174 * they are on *that* many).
175 */
176
177 - ircd_snprintf(0, outbuf, sizeof(outbuf), " Channel(s):: - (total: %u)", cli_user(acptr)->joined);
178 - send_reply(sptr, RPL_DATASTR, outbuf);
179 + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, " Channel(s):: - (total: %u)", cli_user(acptr)->joined);
180 }
181 else {
182 char chntext[BUFSIZE];
183 @@ -530,39 +517,31 @@
184
185 if (MyUser(acptr)) {
186 nowr = CurrentTime - cli_user(acptr)->last;
187 - ircd_snprintf(0, outbuf, sizeof(outbuf), " Idle for:: %d days, %02ld:%02ld:%02ld",
188 - nowr / 86400, (nowr / 3600) % 24, (nowr / 60) % 60, nowr % 60);
189 - send_reply(sptr, RPL_DATASTR, outbuf);
190 + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, " Idle for:: %d days, %02ld:%02ld:%02ld",
191 + nowr / 86400, (nowr / 3600) % 24, (nowr / 60) % 60, nowr % 60);
192 }
193
194 /* Away message (if applicable) */
195 - if (cli_user(acptr)->away) {
196 - ircd_snprintf(0, outbuf, sizeof(outbuf), " Away message:: %s", cli_user(acptr)->away);
197 - send_reply(sptr, RPL_DATASTR, outbuf);
198 - }
199 + if (cli_user(acptr)->away)
200 + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, " Away message:: %s", cli_user(acptr)->away);
201
202 /* If local user.. */
203 if (MyUser(acptr)) {
204 os_get_peername(con_fd(cli_connect(sptr)), &sin);
205
206 send_reply(sptr, RPL_DATASTR, " ");
207 - ircd_snprintf(0, outbuf, sizeof(outbuf), " Ports:: %d -> %d (client -> server)",
208 - sin.port, cli_listener(acptr)->addr.port);
209 - send_reply(sptr, RPL_DATASTR, outbuf);
210 + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, " Ports:: %d -> %d (client -> server)",
211 + sin.port, cli_listener(acptr)->addr.port);
212 if (feature_bool(FEAT_EXTENDED_CHECKCMD)) {
213 /* Note: sendq = receiveq for a client (it makes sense really) */
214 - ircd_snprintf(0, outbuf, sizeof(outbuf), " Data sent:: %lu.%0.3u Kb (%u protocol messages)",
215 - (unsigned long)cli_receiveB(acptr) / 1024, (unsigned long)cli_receiveB(acptr) % 1024, cli_receiveM(acptr));
216 - send_reply(sptr, RPL_DATASTR, outbuf);
217 - ircd_snprintf(0, outbuf, sizeof(outbuf), " Data received:: %lu.%0.3lu Kb (%u protocol messages)",
218 - (unsigned long)cli_sendB(acptr) / 1024, (unsigned long)cli_sendB(acptr) % 1024, cli_sendM(acptr));
219 - send_reply(sptr, RPL_DATASTR, outbuf);
220 - ircd_snprintf(0, outbuf, sizeof(outbuf), " receiveQ size:: %d bytes (max. %d bytes)",
221 - DBufLength(&(cli_recvQ(acptr))), feature_int(FEAT_CLIENT_FLOOD));
222 - send_reply(sptr, RPL_DATASTR, outbuf);
223 - ircd_snprintf(0, outbuf, sizeof(outbuf), " sendQ size:: %d bytes (max. %d bytes)",
224 - DBufLength(&(cli_sendQ(acptr))), get_sendq(acptr));
225 - send_reply(sptr, RPL_DATASTR, outbuf);
226 + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, " Data sent:: %lu.%0.3u Kb (%u protocol messages)",
227 + (unsigned long)cli_receiveB(acptr) / 1024, (unsigned long)cli_receiveB(acptr) % 1024, cli_receiveM(acptr));
228 + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, " Data received:: %lu.%0.3lu Kb (%u protocol messages)",
229 + (unsigned long)cli_sendB(acptr) / 1024, (unsigned long)cli_sendB(acptr) % 1024, cli_sendM(acptr));
230 + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, " receiveQ size:: %d bytes (max. %d bytes)",
231 + DBufLength(&(cli_recvQ(acptr))), feature_int(FEAT_CLIENT_FLOOD));
232 + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, " sendQ size:: %d bytes (max. %d bytes)",
233 + DBufLength(&(cli_sendQ(acptr))), get_sendq(acptr));
234 }
235 }
236
237 @@ -578,18 +557,17 @@
238 send_reply(sptr, RPL_CHKHEAD, "server", acptr->cli_name);
239 send_reply(sptr, RPL_DATASTR, " ");
240
241 - ircd_snprintf(0, outbuf, sizeof(outbuf), " Connected at:: %s (%Tu)", myctime(acptr->cli_serv->timestamp), acptr->cli_serv->timestamp);
242 - send_reply(sptr, RPL_DATASTR, outbuf);
243 + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, " Connected at:: %s (%Tu)",
244 + myctime(acptr->cli_serv->timestamp), acptr->cli_serv->timestamp);
245
246 - ircd_snprintf(0, outbuf, sizeof(outbuf), " Server name:: %s", acptr->cli_name);
247 - send_reply(sptr, RPL_DATASTR, outbuf);
248 + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, " Server name:: %s", acptr->cli_name);
249
250 - ircd_snprintf(0, outbuf, sizeof(outbuf), " Numeric:: %s --> %d", NumServ(acptr), base64toint(acptr->cli_yxx));
251 - send_reply(sptr, RPL_DATASTR, outbuf);
252 + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, " Numeric:: %s --> %d",
253 + NumServ(acptr), base64toint(acptr->cli_yxx));
254
255 - ircd_snprintf(0, outbuf, sizeof(outbuf), " Users:: %d / %d", (acptr == &me) ? UserStats.local_clients : cli_serv(acptr)->clients,
256 + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, " Users:: %d / %d",
257 + (acptr == &me) ? UserStats.local_clients : cli_serv(acptr)->clients,
258 base64toint(cli_serv(acptr)->nn_capacity));
259 - send_reply(sptr, RPL_DATASTR, outbuf);
260
261 if (IsBurst(acptr))
262 send_reply(sptr, RPL_DATASTR, " Status:: Bursting");
263 @@ -606,12 +584,14 @@
264
265 send_reply(sptr, RPL_DATASTR, " ");
266 send_reply(sptr, RPL_DATASTR, "Downlinks::");
267 - for (slink = cli_serv(acptr)->down; slink; slink = slink->next) {
268 - ircd_snprintf(0, outbuf, sizeof(outbuf), "[%d] - %s%s", ++dlinkc,
269 - IsBurst(slink->value.cptr) ? "*" : IsBurstAck(slink->value.cptr) ? "!" : IsService(slink->value.cptr) ? "=" : IsHub(slink->value.cptr) ? "+" : " ",
270 - cli_name(slink->value.cptr));
271 - send_reply(sptr, RPL_DATASTR, outbuf);
272 - }
273 + for (slink = cli_serv(acptr)->down; slink; slink = slink->next)
274 + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, "[%d] - %s%s",
275 + ++dlinkc,
276 + IsBurst(slink->value.cptr) ? "*" :
277 + (IsBurstAck(slink->value.cptr) ? "!" :
278 + (IsService(slink->value.cptr) ? "=" :
279 + (IsHub(slink->value.cptr) ? "+" : " "))),
280 + cli_name(slink->value.cptr));
281
282 if (!dlinkc)
283 send_reply(sptr, RPL_DATASTR, "<none>");
284 @@ -686,8 +666,7 @@
285 break;
286
287 if(count >= 500) { /* sanity stuff */
288 - ircd_snprintf(0, outbuf, sizeof(outbuf), "More than %d results, truncating...", count);
289 - send_reply(sptr, RPL_DATASTR, outbuf);
290 + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, "More than %d results, truncating...", count);
291 break;
292 }
293
294 @@ -723,32 +702,38 @@
295
296 send_reply(sptr, RPL_DATASTR, " ");
297 if (flags & CHECK_SHOWMORE)
298 - ircd_snprintf(0, outbuf, sizeof(outbuf), "No. %s nick user@host [IP] (usermodes) :realname", (flags & CHECK_CLONES) ? "[clients]" : "");
299 + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, "No. %s nick user@host [IP] (usermodes) :realname",
300 + (flags & CHECK_CLONES) ? "[clients]" : "");
301 else
302 - ircd_snprintf(0, outbuf, sizeof(outbuf), "%s %-*s%-*s%s", "No.", (NICKLEN + 2), "Nick",
303 - (USERLEN + 2), "User", "Host");
304 - send_reply(sptr, RPL_DATASTR, outbuf);
305 + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, "%s %-*s%-*s%s", "No.",
306 + (NICKLEN + 2), "Nick", (USERLEN + 2), "User", "Host");
307 }
308
309 if (flags & CHECK_SHOWMORE) {
310 /* show more information */
311 umodes = umode_str(acptr, UMODE_AND_ACCOUNT_SHORT);
312 - ircd_snprintf(0, outbuf, sizeof(outbuf), "%-4d ", (count+1));
313 if (flags & CHECK_CLONES)
314 - ircd_snprintf(0, outbuf, sizeof(outbuf), "%s[%+3hu] ", outbuf, IPcheck_nr(acptr));
315 - ircd_snprintf(0, outbuf, sizeof(outbuf), "%s%s %s@%s [%s] (%s%s) :%s", outbuf,
316 - acptr->cli_name,
317 - cli_user(acptr)->realusername, cli_user(acptr)->realhost,
318 - ircd_ntoa(&(cli_ip(acptr))),
319 - *umodes ? "+" : "<none>", umodes,
320 - (flags & CHECK_SHOWSERVER) ? cli_name(cli_user(acptr)->server) : cli_info(acptr));
321 - } else {
322 + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, "%-4d %s[%+3hu] %s%s %s@%s [%s] (%s%s) :%s",
323 + (count+1),
324 + IPcheck_nr(acptr),
325 + acptr->cli_name,
326 + cli_user(acptr)->realusername, cli_user(acptr)->realhost,
327 + ircd_ntoa(&(cli_ip(acptr))),
328 + *umodes ? "+" : "<none>", umodes,
329 + (flags & CHECK_SHOWSERVER) ? cli_name(cli_user(acptr)->server) : cli_info(acptr));
330 + else
331 + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, "%-4d %s%s %s@%s [%s] (%s%s) :%s",
332 + (count+1),
333 + acptr->cli_name,
334 + cli_user(acptr)->realusername, cli_user(acptr)->realhost,
335 + ircd_ntoa(&(cli_ip(acptr))),
336 + *umodes ? "+" : "<none>", umodes,
337 + (flags & CHECK_SHOWSERVER) ? cli_name(cli_user(acptr)->server) : cli_info(acptr));
338 + } else
339 /* default output */
340 - ircd_snprintf(0, outbuf, sizeof(outbuf), "%-4d %-*s%-*s%s", (count+1), (NICKLEN + 2),
341 - acptr->cli_name, (USERLEN + 2), cli_user(acptr)->realusername,
342 - (flags & CHECK_SHOWIPS) ? ircd_ntoa(&(cli_ip(acptr))) : cli_user(acptr)->realhost);
343 - }
344 - send_reply(sptr, RPL_DATASTR, outbuf);
345 + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, "%-4d %-*s%-*s%s",
346 + (count+1), (NICKLEN + 2), acptr->cli_name, (USERLEN + 2), cli_user(acptr)->realusername,
347 + (flags & CHECK_SHOWIPS) ? ircd_ntoa(&(cli_ip(acptr))) : cli_user(acptr)->realhost);
348
349 /* Show channel output (if applicable) - the 50 channel limit sanity check
350 * is specifically to prevent coredumping when someone lamely tries to /check
351 @@ -802,10 +787,7 @@
352
353 if (count > 0) {
354 send_reply(sptr, RPL_DATASTR, " ");
355 -
356 - ircd_snprintf(0, outbuf, sizeof(outbuf), "Matching records found:: %d", count);
357 - send_reply(sptr, RPL_DATASTR, outbuf);
358 -
359 + send_reply(sptr, SND_EXPLICIT | RPL_DATASTR, "Matching records found:: %d", count);
360 send_reply(sptr, RPL_ENDOFCHECK, " ");
361 }
362