]>
Commit | Line | Data |
---|---|---|
212380e3 | 1 | /* |
2 | * ircd-ratbox: A slightly useful ircd. | |
3 | * m_message.c: Sends a (PRIVMSG|NOTICE) message to a user or channel. | |
4 | * | |
5 | * Copyright (C) 1990 Jarkko Oikarinen and University of Oulu, Co Center | |
6 | * Copyright (C) 1996-2002 Hybrid Development Team | |
7 | * Copyright (C) 2002-2005 ircd-ratbox development team | |
8 | * | |
9 | * This program is free software; you can redistribute it and/or modify | |
10 | * it under the terms of the GNU General Public License as published by | |
11 | * the Free Software Foundation; either version 2 of the License, or | |
12 | * (at your option) any later version. | |
13 | * | |
14 | * This program is distributed in the hope that it will be useful, | |
15 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
16 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
17 | * GNU General Public License for more details. | |
18 | * | |
19 | * You should have received a copy of the GNU General Public License | |
20 | * along with this program; if not, write to the Free Software | |
21 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |
22 | * USA | |
23 | * | |
63aecfb9 | 24 | * $Id: m_message.c 3173 2007-01-31 23:57:18Z jilles $ |
212380e3 | 25 | */ |
26 | ||
27 | #include "stdinc.h" | |
28 | #include "client.h" | |
29 | #include "ircd.h" | |
30 | #include "numeric.h" | |
31 | #include "common.h" | |
32 | #include "s_conf.h" | |
33 | #include "s_serv.h" | |
34 | #include "msg.h" | |
35 | #include "parse.h" | |
36 | #include "modules.h" | |
37 | #include "channel.h" | |
13ae2f4b | 38 | #include "match.h" |
212380e3 | 39 | #include "hash.h" |
40 | #include "class.h" | |
41 | #include "msg.h" | |
42 | #include "packet.h" | |
43 | #include "send.h" | |
212380e3 | 44 | #include "s_newconf.h" |
26f754d9 | 45 | #include "s_stats.h" |
878733fd | 46 | #include "tgchange.h" |
7e8e21a4 | 47 | #include "inline/stringops.h" |
75a9b0c8 | 48 | #include "irc_dictionary.h" |
212380e3 | 49 | |
50 | static int m_message(int, const char *, struct Client *, struct Client *, int, const char **); | |
51 | static int m_privmsg(struct Client *, struct Client *, int, const char **); | |
52 | static int m_notice(struct Client *, struct Client *, int, const char **); | |
53 | ||
54 | static void expire_tgchange(void *unused); | |
bfccb2c0 | 55 | static struct ev_entry *expire_tgchange_event; |
212380e3 | 56 | |
57 | static int | |
58 | modinit(void) | |
59 | { | |
bfccb2c0 | 60 | expire_tgchange_event = rb_event_addish("expire_tgchange", expire_tgchange, NULL, 300); |
212380e3 | 61 | expire_tgchange(NULL); |
62 | return 0; | |
63 | } | |
64 | ||
65 | static void | |
66 | moddeinit(void) | |
67 | { | |
bfccb2c0 | 68 | rb_event_delete(expire_tgchange_event); |
212380e3 | 69 | } |
70 | ||
71 | struct Message privmsg_msgtab = { | |
72 | "PRIVMSG", 0, 0, 0, MFLG_SLOW | MFLG_UNREG, | |
73 | {mg_unreg, {m_privmsg, 0}, {m_privmsg, 0}, mg_ignore, mg_ignore, {m_privmsg, 0}} | |
74 | }; | |
75 | struct Message notice_msgtab = { | |
76 | "NOTICE", 0, 0, 0, MFLG_SLOW, | |
77 | {mg_unreg, {m_notice, 0}, {m_notice, 0}, {m_notice, 0}, mg_ignore, {m_notice, 0}} | |
78 | }; | |
79 | ||
80 | mapi_clist_av1 message_clist[] = { &privmsg_msgtab, ¬ice_msgtab, NULL }; | |
81 | ||
63aecfb9 | 82 | DECLARE_MODULE_AV1(message, modinit, moddeinit, message_clist, NULL, NULL, "$Revision: 3173 $"); |
212380e3 | 83 | |
84 | struct entity | |
85 | { | |
86 | void *ptr; | |
87 | int type; | |
88 | int flags; | |
89 | }; | |
90 | ||
91 | static int build_target_list(int p_or_n, const char *command, | |
92 | struct Client *client_p, | |
93 | struct Client *source_p, const char *nicks_channels, const char *text); | |
94 | ||
95 | static int flood_attack_client(int p_or_n, struct Client *source_p, struct Client *target_p); | |
96 | static int flood_attack_channel(int p_or_n, struct Client *source_p, | |
97 | struct Channel *chptr, char *chname); | |
212380e3 | 98 | |
fcda5662 JT |
99 | /* Fifteen seconds should be plenty for a client to reply a ctcp */ |
100 | #define LARGE_CTCP_TIME 15 | |
101 | ||
212380e3 | 102 | #define ENTITY_NONE 0 |
103 | #define ENTITY_CHANNEL 1 | |
6ce8910d JT |
104 | #define ENTITY_CHANNEL_OPMOD 2 |
105 | #define ENTITY_CHANOPS_ON_CHANNEL 3 | |
106 | #define ENTITY_CLIENT 4 | |
212380e3 | 107 | |
108 | static struct entity targets[512]; | |
109 | static int ntargets = 0; | |
110 | ||
111 | static int duplicate_ptr(void *); | |
112 | ||
113 | static void msg_channel(int p_or_n, const char *command, | |
114 | struct Client *client_p, | |
115 | struct Client *source_p, struct Channel *chptr, const char *text); | |
116 | ||
6ce8910d JT |
117 | static void msg_channel_opmod(int p_or_n, const char *command, |
118 | struct Client *client_p, | |
119 | struct Client *source_p, struct Channel *chptr, | |
120 | const char *text); | |
121 | ||
212380e3 | 122 | static void msg_channel_flags(int p_or_n, const char *command, |
123 | struct Client *client_p, | |
124 | struct Client *source_p, | |
125 | struct Channel *chptr, int flags, const char *text); | |
126 | ||
127 | static void msg_client(int p_or_n, const char *command, | |
128 | struct Client *source_p, struct Client *target_p, const char *text); | |
129 | ||
130 | static void handle_special(int p_or_n, const char *command, | |
131 | struct Client *client_p, struct Client *source_p, const char *nick, | |
132 | const char *text); | |
133 | ||
134 | /* | |
135 | ** m_privmsg | |
136 | ** | |
137 | ** massive cleanup | |
138 | ** rev argv 6/91 | |
139 | ** | |
140 | ** Another massive cleanup Nov, 2000 | |
141 | ** (I don't think there is a single line left from 6/91. Maybe.) | |
142 | ** m_privmsg and m_notice do basically the same thing. | |
143 | ** in the original 2.8.2 code base, they were the same function | |
144 | ** "m_message.c." When we did the great cleanup in conjuncton with bleep | |
145 | ** of ircu fame, we split m_privmsg.c and m_notice.c. | |
146 | ** I don't see the point of that now. Its harder to maintain, its | |
147 | ** easier to introduce bugs into one version and not the other etc. | |
148 | ** Really, the penalty of an extra function call isn't that big a deal folks. | |
149 | ** -db Nov 13, 2000 | |
150 | ** | |
151 | */ | |
152 | ||
153 | #define PRIVMSG 0 | |
154 | #define NOTICE 1 | |
155 | ||
156 | static int | |
157 | m_privmsg(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) | |
158 | { | |
159 | return m_message(PRIVMSG, "PRIVMSG", client_p, source_p, parc, parv); | |
160 | } | |
161 | ||
162 | static int | |
163 | m_notice(struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) | |
164 | { | |
165 | return m_message(NOTICE, "NOTICE", client_p, source_p, parc, parv); | |
166 | } | |
167 | ||
168 | /* | |
169 | * inputs - flag privmsg or notice | |
170 | * - pointer to command "PRIVMSG" or "NOTICE" | |
171 | * - pointer to client_p | |
172 | * - pointer to source_p | |
173 | * - pointer to channel | |
174 | */ | |
175 | static int | |
176 | m_message(int p_or_n, | |
177 | const char *command, | |
178 | struct Client *client_p, struct Client *source_p, int parc, const char *parv[]) | |
179 | { | |
180 | int i; | |
181 | ||
182 | if(parc < 2 || EmptyString(parv[1])) | |
183 | { | |
184 | if(p_or_n != NOTICE) | |
185 | sendto_one(source_p, form_str(ERR_NORECIPIENT), me.name, | |
186 | source_p->name, command); | |
187 | return 0; | |
188 | } | |
189 | ||
190 | if(parc < 3 || EmptyString(parv[2])) | |
191 | { | |
192 | if(p_or_n != NOTICE) | |
193 | sendto_one(source_p, form_str(ERR_NOTEXTTOSEND), me.name, source_p->name); | |
194 | return 0; | |
195 | } | |
196 | ||
197 | /* Finish the flood grace period if theyre not messaging themselves | |
198 | * as some clients (ircN) do this as a "lag check" | |
199 | */ | |
200 | if(MyClient(source_p) && !IsFloodDone(source_p) && irccmp(source_p->name, parv[1])) | |
201 | flood_endgrace(source_p); | |
202 | ||
203 | if(build_target_list(p_or_n, command, client_p, source_p, parv[1], parv[2]) < 0) | |
204 | { | |
205 | return 0; | |
206 | } | |
207 | ||
208 | for(i = 0; i < ntargets; i++) | |
209 | { | |
210 | switch (targets[i].type) | |
211 | { | |
212 | case ENTITY_CHANNEL: | |
213 | msg_channel(p_or_n, command, client_p, source_p, | |
214 | (struct Channel *) targets[i].ptr, parv[2]); | |
215 | break; | |
216 | ||
6ce8910d JT |
217 | case ENTITY_CHANNEL_OPMOD: |
218 | msg_channel_opmod(p_or_n, command, client_p, source_p, | |
219 | (struct Channel *) targets[i].ptr, parv[2]); | |
220 | break; | |
221 | ||
212380e3 | 222 | case ENTITY_CHANOPS_ON_CHANNEL: |
223 | msg_channel_flags(p_or_n, command, client_p, source_p, | |
224 | (struct Channel *) targets[i].ptr, | |
225 | targets[i].flags, parv[2]); | |
226 | break; | |
227 | ||
228 | case ENTITY_CLIENT: | |
229 | msg_client(p_or_n, command, source_p, | |
230 | (struct Client *) targets[i].ptr, parv[2]); | |
231 | break; | |
232 | } | |
233 | } | |
234 | ||
235 | return 0; | |
236 | } | |
237 | ||
238 | /* | |
239 | * build_target_list | |
240 | * | |
241 | * inputs - pointer to given client_p (server) | |
242 | * - pointer to given source (oper/client etc.) | |
243 | * - pointer to list of nicks/channels | |
244 | * - pointer to table to place results | |
245 | * - pointer to text (only used if source_p is an oper) | |
246 | * output - number of valid entities | |
247 | * side effects - target_table is modified to contain a list of | |
248 | * pointers to channels or clients | |
249 | * if source client is an oper | |
250 | * all the classic old bizzare oper privmsg tricks | |
251 | * are parsed and sent as is, if prefixed with $ | |
252 | * to disambiguate. | |
253 | * | |
254 | */ | |
255 | ||
256 | static int | |
257 | build_target_list(int p_or_n, const char *command, struct Client *client_p, | |
258 | struct Client *source_p, const char *nicks_channels, const char *text) | |
259 | { | |
260 | int type; | |
261 | char *p, *nick, *target_list; | |
262 | struct Channel *chptr = NULL; | |
263 | struct Client *target_p; | |
264 | ||
265 | target_list = LOCAL_COPY(nicks_channels); /* skip strcpy for non-lazyleafs */ | |
266 | ||
267 | ntargets = 0; | |
268 | ||
dcbd1d07 | 269 | for(nick = rb_strtok_r(target_list, ",", &p); nick; nick = rb_strtok_r(NULL, ",", &p)) |
212380e3 | 270 | { |
271 | char *with_prefix; | |
272 | /* | |
273 | * channels are privmsg'd a lot more than other clients, moved up | |
274 | * here plain old channel msg? | |
275 | */ | |
276 | ||
277 | if(IsChanPrefix(*nick)) | |
278 | { | |
279 | /* ignore send of local channel to a server (should not happen) */ | |
280 | if(IsServer(client_p) && *nick == '&') | |
281 | continue; | |
282 | ||
283 | if((chptr = find_channel(nick)) != NULL) | |
284 | { | |
285 | if(!duplicate_ptr(chptr)) | |
286 | { | |
287 | if(ntargets >= ConfigFileEntry.max_targets) | |
288 | { | |
289 | sendto_one(source_p, form_str(ERR_TOOMANYTARGETS), | |
290 | me.name, source_p->name, nick); | |
291 | return (1); | |
292 | } | |
293 | targets[ntargets].ptr = (void *) chptr; | |
294 | targets[ntargets++].type = ENTITY_CHANNEL; | |
295 | } | |
296 | } | |
297 | ||
298 | /* non existant channel */ | |
299 | else if(p_or_n != NOTICE) | |
300 | sendto_one_numeric(source_p, ERR_NOSUCHNICK, | |
301 | form_str(ERR_NOSUCHNICK), nick); | |
302 | ||
303 | continue; | |
304 | } | |
305 | ||
306 | if(MyClient(source_p)) | |
307 | target_p = find_named_person(nick); | |
308 | else | |
309 | target_p = find_person(nick); | |
310 | ||
311 | /* look for a privmsg to another client */ | |
312 | if(target_p) | |
313 | { | |
314 | if(!duplicate_ptr(target_p)) | |
315 | { | |
316 | if(ntargets >= ConfigFileEntry.max_targets) | |
317 | { | |
318 | sendto_one(source_p, form_str(ERR_TOOMANYTARGETS), | |
319 | me.name, source_p->name, nick); | |
320 | return (1); | |
321 | } | |
322 | targets[ntargets].ptr = (void *) target_p; | |
323 | targets[ntargets].type = ENTITY_CLIENT; | |
324 | targets[ntargets++].flags = 0; | |
325 | } | |
326 | continue; | |
327 | } | |
328 | ||
329 | /* @#channel or +#channel message ? */ | |
330 | ||
331 | type = 0; | |
332 | with_prefix = nick; | |
333 | /* allow %+@ if someone wants to do that */ | |
334 | for(;;) | |
335 | { | |
336 | if(*nick == '@') | |
337 | type |= CHFL_CHANOP; | |
338 | else if(*nick == '+') | |
339 | type |= CHFL_CHANOP | CHFL_VOICE; | |
340 | else | |
341 | break; | |
342 | nick++; | |
343 | } | |
344 | ||
345 | if(type != 0) | |
346 | { | |
347 | /* no recipient.. */ | |
348 | if(EmptyString(nick)) | |
349 | { | |
350 | sendto_one(source_p, form_str(ERR_NORECIPIENT), | |
351 | me.name, source_p->name, command); | |
352 | continue; | |
353 | } | |
354 | ||
355 | /* At this point, nick+1 should be a channel name i.e. #foo or &foo | |
356 | * if the channel is found, fine, if not report an error | |
357 | */ | |
358 | ||
359 | if((chptr = find_channel(nick)) != NULL) | |
360 | { | |
361 | struct membership *msptr; | |
362 | ||
363 | msptr = find_channel_membership(chptr, source_p); | |
364 | ||
13a467bb | 365 | if(!IsServer(source_p) && !IsService(source_p) && !is_chanop_voiced(msptr) && !IsOverride(source_p)) |
212380e3 | 366 | { |
367 | sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED), | |
c925bc77 JT |
368 | get_id(&me, source_p), |
369 | get_id(source_p, source_p), | |
370 | with_prefix); | |
212380e3 | 371 | return (-1); |
372 | } | |
373 | ||
374 | if(!duplicate_ptr(chptr)) | |
375 | { | |
376 | if(ntargets >= ConfigFileEntry.max_targets) | |
377 | { | |
378 | sendto_one(source_p, form_str(ERR_TOOMANYTARGETS), | |
379 | me.name, source_p->name, nick); | |
380 | return (1); | |
381 | } | |
382 | targets[ntargets].ptr = (void *) chptr; | |
383 | targets[ntargets].type = ENTITY_CHANOPS_ON_CHANNEL; | |
384 | targets[ntargets++].flags = type; | |
385 | } | |
386 | } | |
387 | else if(p_or_n != NOTICE) | |
388 | { | |
389 | sendto_one_numeric(source_p, ERR_NOSUCHNICK, | |
390 | form_str(ERR_NOSUCHNICK), nick); | |
391 | } | |
392 | ||
393 | continue; | |
394 | } | |
395 | ||
6ce8910d JT |
396 | if(IsServer(client_p) && *nick == '=' && nick[1] == '#') |
397 | { | |
398 | nick++; | |
399 | if((chptr = find_channel(nick)) != NULL) | |
400 | { | |
401 | if(!duplicate_ptr(chptr)) | |
402 | { | |
403 | if(ntargets >= ConfigFileEntry.max_targets) | |
404 | { | |
405 | sendto_one(source_p, form_str(ERR_TOOMANYTARGETS), | |
406 | me.name, source_p->name, nick); | |
407 | return (1); | |
408 | } | |
409 | targets[ntargets].ptr = (void *) chptr; | |
410 | targets[ntargets++].type = ENTITY_CHANNEL_OPMOD; | |
411 | } | |
412 | } | |
413 | ||
414 | /* non existant channel */ | |
415 | else if(p_or_n != NOTICE) | |
416 | sendto_one_numeric(source_p, ERR_NOSUCHNICK, | |
417 | form_str(ERR_NOSUCHNICK), nick); | |
418 | ||
419 | continue; | |
420 | } | |
421 | ||
04bf0760 JT |
422 | if(strchr(nick, '@') || (IsOper(source_p) && (*nick == '$'))) |
423 | { | |
424 | handle_special(p_or_n, command, client_p, source_p, nick, text); | |
425 | continue; | |
426 | } | |
427 | ||
212380e3 | 428 | /* no matching anything found - error if not NOTICE */ |
429 | if(p_or_n != NOTICE) | |
430 | { | |
431 | /* dont give this numeric when source is local, | |
432 | * because its misleading --anfl | |
433 | */ | |
434 | if(!MyClient(source_p) && IsDigit(*nick)) | |
435 | sendto_one(source_p, ":%s %d %s * :Target left IRC. " | |
436 | "Failed to deliver: [%.20s]", | |
437 | get_id(&me, source_p), ERR_NOSUCHNICK, | |
438 | get_id(source_p, source_p), text); | |
439 | else | |
440 | sendto_one_numeric(source_p, ERR_NOSUCHNICK, | |
441 | form_str(ERR_NOSUCHNICK), nick); | |
442 | } | |
443 | ||
444 | } | |
445 | return (1); | |
446 | } | |
447 | ||
448 | /* | |
449 | * duplicate_ptr | |
450 | * | |
451 | * inputs - pointer to check | |
452 | * - pointer to table of entities | |
453 | * - number of valid entities so far | |
454 | * output - YES if duplicate pointer in table, NO if not. | |
455 | * note, this does the canonize using pointers | |
456 | * side effects - NONE | |
457 | */ | |
458 | static int | |
459 | duplicate_ptr(void *ptr) | |
460 | { | |
461 | int i; | |
462 | for(i = 0; i < ntargets; i++) | |
463 | if(targets[i].ptr == ptr) | |
464 | return YES; | |
465 | return NO; | |
466 | } | |
467 | ||
468 | /* | |
469 | * msg_channel | |
470 | * | |
471 | * inputs - flag privmsg or notice | |
472 | * - pointer to command "PRIVMSG" or "NOTICE" | |
473 | * - pointer to client_p | |
474 | * - pointer to source_p | |
475 | * - pointer to channel | |
476 | * output - NONE | |
477 | * side effects - message given channel | |
478 | * | |
479 | * XXX - We need to rework this a bit, it's a tad ugly. --nenolod | |
480 | */ | |
481 | static void | |
482 | msg_channel(int p_or_n, const char *command, | |
483 | struct Client *client_p, struct Client *source_p, struct Channel *chptr, | |
484 | const char *text) | |
485 | { | |
486 | int result; | |
487 | char text2[BUFSIZE]; | |
2b3c7c29 G |
488 | int contor; |
489 | int caps = 0; | |
490 | int len = 0; | |
5ad94b50 | 491 | struct membership *msptr = find_channel_membership(chptr, source_p); |
9a4dc29c | 492 | struct Metadata *md; |
212380e3 | 493 | |
494 | if(MyClient(source_p)) | |
495 | { | |
496 | /* idle time shouldnt be reset by notices --fl */ | |
497 | if(p_or_n != NOTICE) | |
9f6bbe3c | 498 | source_p->localClient->last = rb_current_time(); |
212380e3 | 499 | } |
500 | ||
9a4dc29c G |
501 | if(chptr->mode.mode & MODE_NOREPEAT) |
502 | { | |
503 | md = channel_metadata_find(chptr, "NOREPEAT"); | |
504 | if(md && (!ConfigChannel.exempt_cmode_K || !is_any_op(msptr))) | |
505 | { | |
506 | if(!(strcmp(md->value, strip_colour(text)))) | |
507 | { | |
508 | if(p_or_n != NOTICE) | |
509 | sendto_one_numeric(source_p, ERR_CANNOTSENDTOCHAN, | |
510 | form_str(ERR_CANNOTSENDTOCHAN), chptr->chname); | |
511 | return; | |
512 | } | |
513 | } | |
514 | channel_metadata_delete(chptr, "NOREPEAT", 0); | |
515 | channel_metadata_add(chptr, "NOREPEAT", strip_colour(text), 0); | |
516 | } | |
517 | ||
5ad94b50 | 518 | if(chptr->mode.mode & MODE_NOCOLOR && (!ConfigChannel.exempt_cmode_c || !is_any_op(msptr))) |
212380e3 | 519 | { |
907468c4 | 520 | rb_strlcpy(text2, text, BUFSIZE); |
212380e3 | 521 | strip_colour(text2); |
522 | text = text2; | |
523 | if (EmptyString(text)) | |
524 | { | |
525 | /* could be empty after colour stripping and | |
526 | * that would cause problems later */ | |
527 | if(p_or_n != NOTICE) | |
528 | sendto_one(source_p, form_str(ERR_NOTEXTTOSEND), me.name, source_p->name); | |
529 | return; | |
530 | } | |
531 | } | |
532 | ||
533 | /* chanops and voiced can flood their own channel with impunity */ | |
534 | if((result = can_send(chptr, source_p, NULL))) | |
535 | { | |
536 | if(result == CAN_SEND_OPV || | |
537 | !flood_attack_channel(p_or_n, source_p, chptr, chptr->chname)) | |
538 | { | |
5ad94b50 | 539 | if (strlen(text) > 10 && chptr->mode.mode & MODE_NOCAPS && (!ConfigChannel.exempt_cmode_G || !is_any_op(msptr))) |
2b3c7c29 G |
540 | { |
541 | for(contor=0; contor < strlen(text); contor++) | |
542 | { | |
543 | if(IsUpper(text[contor]) && !isdigit(text[contor])) | |
544 | caps++; | |
545 | len++; | |
546 | } | |
547 | if(((caps*100)/(len)) >= 50) | |
548 | { | |
549 | sendto_one_numeric(source_p, ERR_CANNOTSENDTOCHAN, | |
550 | form_str(ERR_CANNOTSENDTOCHAN), chptr->chname); | |
551 | return; | |
552 | } | |
553 | } | |
5ad94b50 | 554 | if (p_or_n != PRIVMSG && chptr->mode.mode & MODE_NONOTICE && (!ConfigChannel.exempt_cmode_T || !is_any_op(msptr))) |
6afd4b91 G |
555 | { |
556 | sendto_one_numeric(source_p, ERR_CANNOTSENDTOCHAN, | |
7e6c9180 G |
557 | form_str(ERR_CANNOTSENDTOCHAN), chptr->chname); |
558 | return; | |
559 | } | |
0bd6cfbe | 560 | if (p_or_n != NOTICE && chptr->mode.mode & MODE_NOACTION && |
5ad94b50 G |
561 | !strncasecmp(text + 1, "ACTION", 6) && |
562 | (!ConfigChannel.exempt_cmode_D || !is_any_op(msptr))) | |
7e6c9180 G |
563 | { |
564 | sendto_one_numeric(source_p, ERR_CANNOTSENDTOCHAN, | |
6afd4b91 G |
565 | form_str(ERR_CANNOTSENDTOCHAN), chptr->chname); |
566 | return; | |
567 | } | |
343e2395 JT |
568 | if (p_or_n != NOTICE && *text == '\001' && |
569 | strncasecmp(text + 1, "ACTION", 6)) | |
92a79951 | 570 | { |
5ad94b50 | 571 | if (chptr->mode.mode & MODE_NOCTCP && (!ConfigChannel.exempt_cmode_C || !is_any_op(msptr))) |
92a79951 WP |
572 | { |
573 | sendto_one_numeric(source_p, ERR_CANNOTSENDTOCHAN, | |
574 | form_str(ERR_CANNOTSENDTOCHAN), chptr->chname); | |
575 | return; | |
576 | } | |
577 | else if (rb_dlink_list_length(&chptr->locmembers) > (unsigned)(GlobalSetOptions.floodcount / 2)) | |
578 | source_p->large_ctcp_sent = rb_current_time(); | |
579 | } | |
212380e3 | 580 | sendto_channel_flags(client_p, ALL_MEMBERS, source_p, chptr, |
581 | "%s %s :%s", command, chptr->chname, text); | |
582 | } | |
583 | } | |
584 | else if(chptr->mode.mode & MODE_OPMODERATE && | |
59eedf15 JT |
585 | (!(chptr->mode.mode & MODE_NOPRIVMSGS) || |
586 | IsMember(source_p, chptr))) | |
212380e3 | 587 | { |
212380e3 | 588 | if(!flood_attack_channel(p_or_n, source_p, chptr, chptr->chname)) |
589 | { | |
6ce8910d JT |
590 | sendto_channel_opmod(client_p, source_p, chptr, |
591 | command, text); | |
592 | } | |
593 | } | |
594 | else | |
595 | { | |
596 | if(p_or_n != NOTICE) | |
597 | sendto_one_numeric(source_p, ERR_CANNOTSENDTOCHAN, | |
598 | form_str(ERR_CANNOTSENDTOCHAN), chptr->chname); | |
599 | } | |
600 | } | |
601 | /* | |
602 | * msg_channel_opmod | |
603 | * | |
604 | * inputs - flag privmsg or notice | |
605 | * - pointer to command "PRIVMSG" or "NOTICE" | |
606 | * - pointer to client_p | |
607 | * - pointer to source_p | |
608 | * - pointer to channel | |
609 | * output - NONE | |
610 | * side effects - message given channel ops | |
611 | * | |
612 | * XXX - We need to rework this a bit, it's a tad ugly. --nenolod | |
613 | */ | |
614 | static void | |
615 | msg_channel_opmod(int p_or_n, const char *command, | |
616 | struct Client *client_p, struct Client *source_p, | |
617 | struct Channel *chptr, const char *text) | |
618 | { | |
619 | char text2[BUFSIZE]; | |
620 | ||
621 | if(chptr->mode.mode & MODE_NOCOLOR) | |
622 | { | |
623 | rb_strlcpy(text2, text, BUFSIZE); | |
624 | strip_colour(text2); | |
625 | text = text2; | |
626 | if (EmptyString(text)) | |
627 | { | |
628 | /* could be empty after colour stripping and | |
629 | * that would cause problems later */ | |
630 | if(p_or_n != NOTICE) | |
631 | sendto_one(source_p, form_str(ERR_NOTEXTTOSEND), me.name, source_p->name); | |
632 | return; | |
633 | } | |
634 | } | |
635 | ||
636 | if(chptr->mode.mode & MODE_OPMODERATE && | |
637 | (!(chptr->mode.mode & MODE_NOPRIVMSGS) || | |
638 | IsMember(source_p, chptr))) | |
639 | { | |
640 | if(!flood_attack_channel(p_or_n, source_p, chptr, chptr->chname)) | |
641 | { | |
642 | sendto_channel_opmod(client_p, source_p, chptr, | |
643 | command, text); | |
212380e3 | 644 | } |
645 | } | |
646 | else | |
647 | { | |
648 | if(p_or_n != NOTICE) | |
649 | sendto_one_numeric(source_p, ERR_CANNOTSENDTOCHAN, | |
650 | form_str(ERR_CANNOTSENDTOCHAN), chptr->chname); | |
651 | } | |
652 | } | |
653 | ||
654 | /* | |
655 | * msg_channel_flags | |
656 | * | |
657 | * inputs - flag 0 if PRIVMSG 1 if NOTICE. RFC | |
658 | * say NOTICE must not auto reply | |
659 | * - pointer to command, "PRIVMSG" or "NOTICE" | |
660 | * - pointer to client_p | |
661 | * - pointer to source_p | |
662 | * - pointer to channel | |
663 | * - flags | |
664 | * - pointer to text to send | |
665 | * output - NONE | |
666 | * side effects - message given channel either chanop or voice | |
667 | */ | |
668 | static void | |
669 | msg_channel_flags(int p_or_n, const char *command, struct Client *client_p, | |
670 | struct Client *source_p, struct Channel *chptr, int flags, const char *text) | |
671 | { | |
672 | int type; | |
673 | char c; | |
674 | ||
675 | if(flags & CHFL_VOICE) | |
676 | { | |
677 | type = ONLY_CHANOPSVOICED; | |
678 | c = '+'; | |
679 | } | |
680 | else | |
681 | { | |
682 | type = ONLY_CHANOPS; | |
683 | c = '@'; | |
684 | } | |
685 | ||
686 | if(MyClient(source_p)) | |
687 | { | |
688 | /* idletime shouldnt be reset by notice --fl */ | |
689 | if(p_or_n != NOTICE) | |
9f6bbe3c | 690 | source_p->localClient->last = rb_current_time(); |
212380e3 | 691 | } |
692 | ||
693 | sendto_channel_flags(client_p, type, source_p, chptr, "%s %c%s :%s", | |
694 | command, c, chptr->chname, text); | |
695 | } | |
696 | ||
212380e3 | 697 | static void |
698 | expire_tgchange(void *unused) | |
699 | { | |
700 | tgchange *target; | |
90a3c35b | 701 | rb_dlink_node *ptr, *next_ptr; |
212380e3 | 702 | |
90a3c35b | 703 | RB_DLINK_FOREACH_SAFE(ptr, next_ptr, tgchange_list.head) |
212380e3 | 704 | { |
705 | target = ptr->data; | |
706 | ||
9f6bbe3c | 707 | if(target->expiry < rb_current_time()) |
212380e3 | 708 | { |
31c047d7 WP |
709 | rb_dlinkDelete(ptr, &tgchange_list); |
710 | rb_patricia_remove(tgchange_tree, target->pnode); | |
a55e5724 VY |
711 | rb_free(target->ip); |
712 | rb_free(target); | |
212380e3 | 713 | } |
714 | } | |
715 | } | |
716 | ||
212380e3 | 717 | /* |
718 | * msg_client | |
719 | * | |
720 | * inputs - flag 0 if PRIVMSG 1 if NOTICE. RFC | |
721 | * say NOTICE must not auto reply | |
722 | * - pointer to command, "PRIVMSG" or "NOTICE" | |
723 | * - pointer to source_p source (struct Client *) | |
724 | * - pointer to target_p target (struct Client *) | |
725 | * - pointer to text | |
726 | * output - NONE | |
727 | * side effects - message given channel either chanop or voice | |
728 | */ | |
729 | static void | |
730 | msg_client(int p_or_n, const char *command, | |
731 | struct Client *source_p, struct Client *target_p, const char *text) | |
732 | { | |
8acef9de | 733 | int do_floodcount = 0; |
1fbf6db6 | 734 | struct Metadata *md; |
75a9b0c8 | 735 | struct DictionaryIter iter; |
8acef9de | 736 | |
212380e3 | 737 | if(MyClient(source_p)) |
738 | { | |
739 | /* reset idle time for message only if its not to self | |
740 | * and its not a notice */ | |
741 | if(p_or_n != NOTICE) | |
9f6bbe3c | 742 | source_p->localClient->last = rb_current_time(); |
212380e3 | 743 | |
8acef9de JT |
744 | /* auto cprivmsg/cnotice */ |
745 | do_floodcount = !IsOper(source_p) && | |
746 | !find_allowing_channel(source_p, target_p); | |
747 | ||
212380e3 | 748 | /* target change stuff, dont limit ctcp replies as that |
749 | * would allow people to start filling up random users | |
750 | * targets just by ctcping them | |
751 | */ | |
752 | if((p_or_n != NOTICE || *text != '\001') && | |
8acef9de | 753 | ConfigFileEntry.target_change && do_floodcount) |
212380e3 | 754 | { |
755 | if(!add_target(source_p, target_p)) | |
756 | { | |
757 | sendto_one(source_p, form_str(ERR_TARGCHANGE), | |
758 | me.name, source_p->name, target_p->name); | |
759 | return; | |
760 | } | |
761 | } | |
cb9345dc | 762 | |
fcda5662 JT |
763 | if (do_floodcount && p_or_n == NOTICE && *text == '\001' && |
764 | target_p->large_ctcp_sent + LARGE_CTCP_TIME >= rb_current_time()) | |
765 | do_floodcount = 0; | |
766 | ||
cb9345dc JT |
767 | if (do_floodcount && |
768 | flood_attack_client(p_or_n, source_p, target_p)) | |
769 | return; | |
212380e3 | 770 | } |
771 | else if(source_p->from == target_p->from) | |
772 | { | |
773 | sendto_realops_snomask(SNO_DEBUG, L_ALL, | |
774 | "Send message to %s[%s] dropped from %s(Fake Dir)", | |
775 | target_p->name, target_p->from->name, source_p->name); | |
776 | return; | |
777 | } | |
778 | ||
c387fc41 | 779 | if(MyConnect(source_p) && (p_or_n != NOTICE) && target_p->user && target_p->user->away) |
212380e3 | 780 | sendto_one_numeric(source_p, RPL_AWAY, form_str(RPL_AWAY), |
c387fc41 | 781 | target_p->name, target_p->user->away); |
212380e3 | 782 | |
783 | if(MyClient(target_p)) | |
784 | { | |
0099f31a G |
785 | if (IsSetNoCTCP(target_p) && p_or_n != NOTICE && *text == '\001' && strncasecmp(text + 1, "ACTION", 6)) |
786 | { | |
787 | sendto_one_numeric(source_p, ERR_NOCTCP, | |
788 | form_str(ERR_NOCTCP), | |
789 | target_p->name); | |
790 | } | |
1fbf6db6 | 791 | /* If opers want to go through +g, they should load oaccept.*/ |
85465c43 | 792 | else if(!IsServer(source_p) && !IsService(source_p) && (IsSetCallerId(target_p) || |
99c78094 G |
793 | (IsSetSCallerId(target_p) && !has_common_channel(source_p, target_p)) || |
794 | (IsSetRegOnlyMsg(target_p) && !source_p->user->suser[0]))) | |
212380e3 | 795 | { |
796 | /* Here is the anti-flood bot/spambot code -db */ | |
1fbf6db6 | 797 | if(accept_message(source_p, target_p)) |
212380e3 | 798 | { |
7eb93077 | 799 | add_reply_target(target_p, source_p); |
212380e3 | 800 | sendto_one(target_p, ":%s!%s@%s %s %s :%s", |
801 | source_p->name, | |
802 | source_p->username, | |
803 | source_p->host, command, target_p->name, text); | |
804 | } | |
75a9b0c8 | 805 | else if (IsOper(source_p)) |
1fbf6db6 | 806 | { |
75a9b0c8 | 807 | DICTIONARY_FOREACH(md, &iter, target_p->user->metadata) |
1fbf6db6 | 808 | { |
75a9b0c8 G |
809 | if(!strcmp(md->value, source_p->name)) |
810 | { | |
811 | add_reply_target(target_p, source_p); | |
812 | sendto_one(target_p, ":%s!%s@%s %s %s :%s", | |
813 | source_p->name, | |
814 | source_p->username, | |
815 | source_p->host, command, target_p->name, text); | |
816 | break; | |
817 | } | |
1fbf6db6 G |
818 | } |
819 | } | |
99c78094 | 820 | else if (IsSetRegOnlyMsg(target_p) && !source_p->user->suser[0]) |
212380e3 | 821 | { |
99c78094 G |
822 | if (p_or_n != NOTICE) |
823 | sendto_one_numeric(source_p, ERR_NONONREG, | |
824 | form_str(ERR_NONONREG), | |
825 | target_p->name); | |
61ffa214 | 826 | } |
99c78094 | 827 | else if (IsSetSCallerId(target_p) && !has_common_channel(source_p, target_p)) |
61ffa214 | 828 | { |
99c78094 G |
829 | if (p_or_n != NOTICE) |
830 | sendto_one_numeric(source_p, ERR_NOCOMMONCHAN, | |
831 | form_str(ERR_NOCOMMONCHAN), | |
832 | target_p->name); | |
61ffa214 | 833 | } |
99c78094 | 834 | else |
212380e3 | 835 | { |
99c78094 | 836 | /* check for accept, flag recipient incoming message */ |
212380e3 | 837 | if(p_or_n != NOTICE) |
99c78094 G |
838 | { |
839 | sendto_one_numeric(source_p, ERR_TARGUMODEG, | |
840 | form_str(ERR_TARGUMODEG), | |
212380e3 | 841 | target_p->name); |
99c78094 | 842 | } |
212380e3 | 843 | |
99c78094 G |
844 | if((target_p->localClient->last_caller_id_time + |
845 | ConfigFileEntry.caller_id_wait) < rb_current_time()) | |
846 | { | |
847 | if(p_or_n != NOTICE) | |
848 | sendto_one_numeric(source_p, RPL_TARGNOTIFY, | |
849 | form_str(RPL_TARGNOTIFY), | |
850 | target_p->name); | |
212380e3 | 851 | |
99c78094 G |
852 | add_reply_target(target_p, source_p); |
853 | sendto_one(target_p, form_str(RPL_UMODEGMSG), | |
854 | me.name, target_p->name, source_p->name, | |
855 | source_p->username, source_p->host); | |
856 | ||
857 | target_p->localClient->last_caller_id_time = rb_current_time(); | |
858 | } | |
212380e3 | 859 | } |
860 | } | |
861 | else | |
7eb93077 JT |
862 | { |
863 | add_reply_target(target_p, source_p); | |
cb9345dc | 864 | sendto_anywhere(target_p, source_p, command, ":%s", text); |
7eb93077 | 865 | } |
212380e3 | 866 | } |
cb9345dc | 867 | else |
212380e3 | 868 | sendto_anywhere(target_p, source_p, command, ":%s", text); |
869 | ||
870 | return; | |
871 | } | |
872 | ||
873 | /* | |
874 | * flood_attack_client | |
875 | * inputs - flag 0 if PRIVMSG 1 if NOTICE. RFC | |
876 | * say NOTICE must not auto reply | |
877 | * - pointer to source Client | |
878 | * - pointer to target Client | |
879 | * output - 1 if target is under flood attack | |
880 | * side effects - check for flood attack on target target_p | |
881 | */ | |
882 | static int | |
883 | flood_attack_client(int p_or_n, struct Client *source_p, struct Client *target_p) | |
884 | { | |
885 | int delta; | |
886 | ||
dada366b JT |
887 | /* Services could get many messages legitimately and |
888 | * can be messaged without rate limiting via aliases | |
889 | * and msg user@server. | |
890 | * -- jilles | |
891 | */ | |
892 | if(GlobalSetOptions.floodcount && IsClient(source_p) && source_p != target_p && !IsService(target_p)) | |
212380e3 | 893 | { |
dada366b | 894 | if((target_p->first_received_message_time + 1) < rb_current_time()) |
212380e3 | 895 | { |
dada366b JT |
896 | delta = rb_current_time() - target_p->first_received_message_time; |
897 | target_p->received_number_of_privmsgs -= delta; | |
898 | target_p->first_received_message_time = rb_current_time(); | |
899 | if(target_p->received_number_of_privmsgs <= 0) | |
212380e3 | 900 | { |
dada366b JT |
901 | target_p->received_number_of_privmsgs = 0; |
902 | target_p->flood_noticed = 0; | |
212380e3 | 903 | } |
904 | } | |
905 | ||
dada366b JT |
906 | if((target_p->received_number_of_privmsgs >= |
907 | GlobalSetOptions.floodcount) || target_p->flood_noticed) | |
212380e3 | 908 | { |
dada366b | 909 | if(target_p->flood_noticed == 0) |
212380e3 | 910 | { |
9f8d60cc | 911 | sendto_realops_snomask(SNO_BOTS, L_NETWIDE, |
212380e3 | 912 | "Possible Flooder %s[%s@%s] on %s target: %s", |
913 | source_p->name, source_p->username, | |
63aecfb9 | 914 | source_p->orighost, |
c88cdb00 | 915 | source_p->servptr->name, target_p->name); |
dada366b | 916 | target_p->flood_noticed = 1; |
212380e3 | 917 | /* add a bit of penalty */ |
dada366b | 918 | target_p->received_number_of_privmsgs += 2; |
212380e3 | 919 | } |
920 | if(MyClient(source_p) && (p_or_n != NOTICE)) | |
921 | sendto_one(source_p, | |
922 | ":%s NOTICE %s :*** Message to %s throttled due to flooding", | |
923 | me.name, source_p->name, target_p->name); | |
924 | return 1; | |
925 | } | |
926 | else | |
dada366b | 927 | target_p->received_number_of_privmsgs++; |
212380e3 | 928 | } |
929 | ||
930 | return 0; | |
931 | } | |
932 | ||
933 | /* | |
934 | * flood_attack_channel | |
935 | * inputs - flag 0 if PRIVMSG 1 if NOTICE. RFC | |
936 | * says NOTICE must not auto reply | |
937 | * - pointer to source Client | |
938 | * - pointer to target channel | |
939 | * output - 1 if target is under flood attack | |
940 | * side effects - check for flood attack on target chptr | |
941 | */ | |
942 | static int | |
943 | flood_attack_channel(int p_or_n, struct Client *source_p, struct Channel *chptr, char *chname) | |
944 | { | |
945 | int delta; | |
946 | ||
947 | if(GlobalSetOptions.floodcount && MyClient(source_p)) | |
948 | { | |
9f6bbe3c | 949 | if((chptr->first_received_message_time + 1) < rb_current_time()) |
212380e3 | 950 | { |
9f6bbe3c | 951 | delta = rb_current_time() - chptr->first_received_message_time; |
212380e3 | 952 | chptr->received_number_of_privmsgs -= delta; |
9f6bbe3c | 953 | chptr->first_received_message_time = rb_current_time(); |
212380e3 | 954 | if(chptr->received_number_of_privmsgs <= 0) |
955 | { | |
956 | chptr->received_number_of_privmsgs = 0; | |
957 | chptr->flood_noticed = 0; | |
958 | } | |
959 | } | |
960 | ||
961 | if((chptr->received_number_of_privmsgs >= GlobalSetOptions.floodcount) | |
962 | || chptr->flood_noticed) | |
963 | { | |
964 | if(chptr->flood_noticed == 0) | |
965 | { | |
9f8d60cc | 966 | sendto_realops_snomask(SNO_BOTS, *chptr->chname == '&' ? L_ALL : L_NETWIDE, |
212380e3 | 967 | "Possible Flooder %s[%s@%s] on %s target: %s", |
968 | source_p->name, source_p->username, | |
63aecfb9 | 969 | source_p->orighost, |
c88cdb00 | 970 | source_p->servptr->name, chptr->chname); |
212380e3 | 971 | chptr->flood_noticed = 1; |
972 | ||
973 | /* Add a bit of penalty */ | |
974 | chptr->received_number_of_privmsgs += 2; | |
975 | } | |
976 | if(MyClient(source_p) && (p_or_n != NOTICE)) | |
977 | sendto_one(source_p, | |
978 | ":%s NOTICE %s :*** Message to %s throttled due to flooding", | |
979 | me.name, source_p->name, chptr->chname); | |
980 | return 1; | |
981 | } | |
982 | else | |
983 | chptr->received_number_of_privmsgs++; | |
984 | } | |
985 | ||
986 | return 0; | |
987 | } | |
988 | ||
989 | ||
990 | /* | |
991 | * handle_special | |
992 | * | |
993 | * inputs - server pointer | |
994 | * - client pointer | |
995 | * - nick stuff to grok for opers | |
996 | * - text to send if grok | |
997 | * output - none | |
998 | * side effects - all the traditional oper type messages are parsed here. | |
999 | * i.e. "/msg #some.host." | |
1000 | * However, syntax has been changed. | |
1001 | * previous syntax "/msg #some.host.mask" | |
1002 | * now becomes "/msg $#some.host.mask" | |
1003 | * previous syntax of: "/msg $some.server.mask" remains | |
1004 | * This disambiguates the syntax. | |
1005 | */ | |
1006 | static void | |
1007 | handle_special(int p_or_n, const char *command, struct Client *client_p, | |
1008 | struct Client *source_p, const char *nick, const char *text) | |
1009 | { | |
1010 | struct Client *target_p; | |
212380e3 | 1011 | char *server; |
1012 | char *s; | |
212380e3 | 1013 | |
1014 | /* user[%host]@server addressed? | |
1015 | * NOTE: users can send to user@server, but not user%host@server | |
1016 | * or opers@server | |
1017 | */ | |
1018 | if((server = strchr(nick, '@')) != NULL) | |
1019 | { | |
1020 | if((target_p = find_server(source_p, server + 1)) == NULL) | |
1021 | { | |
1022 | sendto_one_numeric(source_p, ERR_NOSUCHSERVER, | |
1023 | form_str(ERR_NOSUCHSERVER), server + 1); | |
1024 | return; | |
1025 | } | |
1026 | ||
212380e3 | 1027 | if(!IsOper(source_p)) |
1028 | { | |
1029 | if(strchr(nick, '%') || (strncmp(nick, "opers", 5) == 0)) | |
1030 | { | |
1031 | sendto_one_numeric(source_p, ERR_NOSUCHNICK, | |
1032 | form_str(ERR_NOSUCHNICK), nick); | |
1033 | return; | |
1034 | } | |
1035 | } | |
1036 | ||
1037 | /* somewhere else.. */ | |
1038 | if(!IsMe(target_p)) | |
1039 | { | |
1040 | sendto_one(target_p, ":%s %s %s :%s", | |
1041 | get_id(source_p, target_p), command, nick, text); | |
1042 | return; | |
1043 | } | |
1044 | ||
212380e3 | 1045 | /* Check if someones msg'ing opers@our.server */ |
ceac83d9 | 1046 | if(strncmp(nick, "opers@", 6) == 0) |
212380e3 | 1047 | { |
1048 | sendto_realops_snomask(SNO_GENERAL, L_ALL, "To opers: From: %s: %s", | |
1049 | source_p->name, text); | |
1050 | return; | |
1051 | } | |
1052 | ||
ceac83d9 JT |
1053 | /* This was not very useful except for bypassing certain |
1054 | * restrictions. Note that we still allow sending to | |
1055 | * remote servers this way, for messaging pseudoservers | |
1056 | * securely whether they have a service{} block or not. | |
1057 | * -- jilles | |
212380e3 | 1058 | */ |
ceac83d9 JT |
1059 | sendto_one_numeric(source_p, ERR_NOSUCHNICK, |
1060 | form_str(ERR_NOSUCHNICK), nick); | |
1061 | return; | |
212380e3 | 1062 | } |
1063 | ||
1064 | /* | |
1065 | * the following two cases allow masks in NOTICEs | |
1066 | * (for OPERs only) | |
1067 | * | |
1068 | * Armin, 8Jun90 (gruner@informatik.tu-muenchen.de) | |
1069 | */ | |
1070 | if(IsOper(source_p) && *nick == '$') | |
1071 | { | |
1072 | if((*(nick + 1) == '$' || *(nick + 1) == '#')) | |
1073 | nick++; | |
1074 | else if(MyOper(source_p)) | |
1075 | { | |
1076 | sendto_one(source_p, | |
1077 | ":%s NOTICE %s :The command %s %s is no longer supported, please use $%s", | |
1078 | me.name, source_p->name, command, nick, nick); | |
1079 | return; | |
1080 | } | |
1081 | ||
c13a2d9a JT |
1082 | if(MyClient(source_p) && !IsOperMassNotice(source_p)) |
1083 | { | |
1084 | sendto_one(source_p, form_str(ERR_NOPRIVS), | |
1085 | me.name, source_p->name, "mass_notice"); | |
1086 | return; | |
1087 | } | |
1088 | ||
212380e3 | 1089 | if((s = strrchr(nick, '.')) == NULL) |
1090 | { | |
1091 | sendto_one_numeric(source_p, ERR_NOTOPLEVEL, | |
1092 | form_str(ERR_NOTOPLEVEL), nick); | |
1093 | return; | |
1094 | } | |
1095 | while(*++s) | |
1096 | if(*s == '.' || *s == '*' || *s == '?') | |
1097 | break; | |
1098 | if(*s == '*' || *s == '?') | |
1099 | { | |
1100 | sendto_one_numeric(source_p, ERR_WILDTOPLEVEL, | |
1101 | form_str(ERR_WILDTOPLEVEL), nick); | |
1102 | return; | |
1103 | } | |
1104 | ||
1105 | sendto_match_butone(IsServer(client_p) ? client_p : NULL, source_p, | |
1106 | nick + 1, | |
1107 | (*nick == '#') ? MATCH_HOST : MATCH_SERVER, | |
1108 | "%s $%s :%s", command, nick, text); | |
fcda5662 JT |
1109 | if (p_or_n != NOTICE && *text == '\001') |
1110 | source_p->large_ctcp_sent = rb_current_time(); | |
212380e3 | 1111 | return; |
1112 | } | |
1113 | } |