]>
Commit | Line | Data |
---|---|---|
212380e3 AC |
1 | /* |
2 | * charybdis: A slightly useful ircd. | |
3 | * chmode.c: channel mode management | |
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 | * Copyright (C) 2005-2006 charybdis development team | |
9 | * | |
10 | * This program is free software; you can redistribute it and/or modify | |
11 | * it under the terms of the GNU General Public License as published by | |
12 | * the Free Software Foundation; either version 2 of the License, or | |
13 | * (at your option) any later version. | |
14 | * | |
15 | * This program is distributed in the hope that it will be useful, | |
16 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | |
17 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
18 | * GNU General Public License for more details. | |
19 | * | |
20 | * You should have received a copy of the GNU General Public License | |
21 | * along with this program; if not, write to the Free Software | |
22 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 | |
23 | * USA | |
24 | * | |
11781253 | 25 | * $Id: chmode.c 3213 2007-02-21 19:52:51Z jilles $ |
212380e3 AC |
26 | */ |
27 | ||
28 | #include "stdinc.h" | |
29 | #include "tools.h" | |
30 | #include "channel.h" | |
31 | #include "client.h" | |
32 | #include "common.h" | |
33 | #include "hash.h" | |
34 | #include "hook.h" | |
35 | #include "irc_string.h" | |
36 | #include "sprintf_irc.h" | |
37 | #include "ircd.h" | |
38 | #include "numeric.h" | |
39 | #include "s_serv.h" /* captab */ | |
40 | #include "s_user.h" | |
41 | #include "send.h" | |
42 | #include "whowas.h" | |
43 | #include "s_conf.h" /* ConfigFileEntry, ConfigChannel */ | |
44 | #include "s_newconf.h" | |
45 | #include "event.h" | |
46 | #include "memory.h" | |
47 | #include "balloc.h" | |
48 | #include "s_log.h" | |
49 | ||
50 | /* bitmasks for error returns, so we send once per call */ | |
51 | #define SM_ERR_NOTS 0x00000001 /* No TS on channel */ | |
52 | #define SM_ERR_NOOPS 0x00000002 /* No chan ops */ | |
53 | #define SM_ERR_UNKNOWN 0x00000004 | |
54 | #define SM_ERR_RPL_C 0x00000008 | |
55 | #define SM_ERR_RPL_B 0x00000010 | |
56 | #define SM_ERR_RPL_E 0x00000020 | |
57 | #define SM_ERR_NOTONCHANNEL 0x00000040 /* Not on channel */ | |
58 | #define SM_ERR_RPL_I 0x00000100 | |
59 | #define SM_ERR_RPL_D 0x00000200 | |
60 | #define SM_ERR_NOPRIVS 0x00000400 | |
61 | #define SM_ERR_RPL_Q 0x00000800 | |
62 | #define SM_ERR_RPL_F 0x00001000 | |
63 | ||
64 | void set_channel_mode(struct Client *, struct Client *, | |
65 | struct Channel *, struct membership *, int, const char **); | |
66 | ||
67 | int add_id(struct Client *source_p, struct Channel *chptr, | |
68 | const char *banid, dlink_list * list, long mode_type); | |
69 | ||
70 | static struct ChModeChange mode_changes[BUFSIZE]; | |
71 | static int mode_count; | |
72 | static int mode_limit; | |
73 | static int mask_pos; | |
74 | ||
75 | int | |
76 | get_channel_access(struct Client *source_p, struct membership *msptr) | |
77 | { | |
78 | if(!MyClient(source_p) || is_chanop(msptr)) | |
79 | return CHFL_CHANOP; | |
80 | ||
81 | return CHFL_PEON; | |
82 | } | |
83 | ||
84 | /* add_id() | |
85 | * | |
86 | * inputs - client, channel, id to add, type | |
87 | * outputs - 0 on failure, 1 on success | |
88 | * side effects - given id is added to the appropriate list | |
89 | */ | |
90 | int | |
91 | add_id(struct Client *source_p, struct Channel *chptr, const char *banid, | |
92 | dlink_list * list, long mode_type) | |
93 | { | |
94 | struct Ban *actualBan; | |
95 | static char who[BANLEN]; | |
96 | char *realban = LOCAL_COPY(banid); | |
97 | dlink_node *ptr; | |
98 | ||
99 | /* dont let local clients overflow the banlist, or set redundant | |
100 | * bans | |
101 | */ | |
102 | if(MyClient(source_p)) | |
103 | { | |
104 | if((dlink_list_length(&chptr->banlist) + dlink_list_length(&chptr->exceptlist) + dlink_list_length(&chptr->invexlist) + dlink_list_length(&chptr->quietlist)) >= (chptr->mode.mode & MODE_EXLIMIT ? ConfigChannel.max_bans_large : ConfigChannel.max_bans)) | |
105 | { | |
106 | sendto_one(source_p, form_str(ERR_BANLISTFULL), | |
107 | me.name, source_p->name, chptr->chname, realban); | |
108 | return 0; | |
109 | } | |
110 | ||
111 | collapse(realban); | |
112 | ||
113 | DLINK_FOREACH(ptr, list->head) | |
114 | { | |
115 | actualBan = ptr->data; | |
116 | if(match(actualBan->banstr, realban)) | |
117 | return 0; | |
118 | } | |
119 | } | |
120 | /* dont let remotes set duplicates */ | |
121 | else | |
122 | { | |
123 | DLINK_FOREACH(ptr, list->head) | |
124 | { | |
125 | actualBan = ptr->data; | |
126 | if(!irccmp(actualBan->banstr, realban)) | |
127 | return 0; | |
128 | } | |
129 | } | |
130 | ||
131 | ||
132 | if(IsPerson(source_p)) | |
133 | ircsprintf(who, "%s!%s@%s", source_p->name, source_p->username, source_p->host); | |
134 | else | |
135 | strlcpy(who, source_p->name, sizeof(who)); | |
136 | ||
137 | actualBan = allocate_ban(realban, who); | |
138 | actualBan->when = CurrentTime; | |
139 | ||
140 | dlinkAdd(actualBan, &actualBan->node, list); | |
141 | ||
142 | /* invalidate the can_send() cache */ | |
143 | if(mode_type == CHFL_BAN || mode_type == CHFL_QUIET || mode_type == CHFL_EXCEPTION) | |
144 | chptr->bants++; | |
145 | ||
146 | return 1; | |
147 | } | |
148 | ||
149 | /* del_id() | |
150 | * | |
151 | * inputs - channel, id to remove, type | |
152 | * outputs - 0 on failure, 1 on success | |
153 | * side effects - given id is removed from the appropriate list | |
154 | */ | |
155 | int | |
156 | del_id(struct Channel *chptr, const char *banid, dlink_list * list, long mode_type) | |
157 | { | |
158 | dlink_node *ptr; | |
159 | struct Ban *banptr; | |
160 | ||
161 | if(EmptyString(banid)) | |
162 | return 0; | |
163 | ||
164 | DLINK_FOREACH(ptr, list->head) | |
165 | { | |
166 | banptr = ptr->data; | |
167 | ||
168 | if(irccmp(banid, banptr->banstr) == 0) | |
169 | { | |
170 | dlinkDelete(&banptr->node, list); | |
171 | free_ban(banptr); | |
172 | ||
173 | /* invalidate the can_send() cache */ | |
174 | if(mode_type == CHFL_BAN || mode_type == CHFL_QUIET || mode_type == CHFL_EXCEPTION) | |
175 | chptr->bants++; | |
176 | ||
177 | return 1; | |
178 | } | |
179 | } | |
180 | ||
181 | return 0; | |
182 | } | |
183 | ||
184 | /* check_string() | |
185 | * | |
186 | * input - string to check | |
187 | * output - pointer to 'fixed' string, or "*" if empty | |
188 | * side effects - any white space found becomes \0 | |
189 | */ | |
190 | static char * | |
191 | check_string(char *s) | |
192 | { | |
193 | char *str = s; | |
194 | static char splat[] = "*"; | |
195 | if(!(s && *s)) | |
196 | return splat; | |
197 | ||
198 | for(; *s; ++s) | |
199 | { | |
200 | if(IsSpace(*s)) | |
201 | { | |
202 | *s = '\0'; | |
203 | break; | |
204 | } | |
205 | } | |
206 | return str; | |
207 | } | |
208 | ||
209 | /* pretty_mask() | |
210 | * | |
211 | * inputs - mask to pretty | |
212 | * outputs - better version of the mask | |
213 | * side effects - mask is chopped to limits, and transformed: | |
214 | * x!y@z => x!y@z | |
215 | * y@z => *!y@z | |
216 | * x!y => x!y@* | |
217 | * x => x!*@* | |
218 | * z.d => *!*@z.d | |
219 | */ | |
220 | static char * | |
221 | pretty_mask(const char *idmask) | |
222 | { | |
223 | static char mask_buf[BUFSIZE]; | |
224 | int old_mask_pos; | |
225 | char *nick, *user, *host; | |
226 | char splat[] = "*"; | |
227 | char *t, *at, *ex; | |
228 | char ne = 0, ue = 0, he = 0; /* save values at nick[NICKLEN], et all */ | |
229 | char *mask; | |
230 | ||
231 | mask = LOCAL_COPY(idmask); | |
232 | mask = check_string(mask); | |
233 | collapse(mask); | |
234 | ||
235 | nick = user = host = splat; | |
236 | ||
237 | if((size_t) BUFSIZE - mask_pos < strlen(mask) + 5) | |
238 | return NULL; | |
239 | ||
240 | old_mask_pos = mask_pos; | |
241 | ||
242 | if (*mask == '$') | |
243 | { | |
244 | mask_pos += ircsprintf(mask_buf + mask_pos, "%s", mask) + 1; | |
245 | t = mask_buf + old_mask_pos + 1; | |
246 | if (*t == '!') | |
247 | *t = '~'; | |
248 | if (*t == '~') | |
249 | t++; | |
250 | *t = ToLower(*t); | |
251 | return mask_buf + old_mask_pos; | |
252 | } | |
253 | ||
254 | at = ex = NULL; | |
255 | if((t = strchr(mask, '@')) != NULL) | |
256 | { | |
257 | at = t; | |
258 | *t++ = '\0'; | |
259 | if(*t != '\0') | |
260 | host = t; | |
261 | ||
262 | if((t = strchr(mask, '!')) != NULL) | |
263 | { | |
264 | ex = t; | |
265 | *t++ = '\0'; | |
266 | if(*t != '\0') | |
267 | user = t; | |
268 | if(*mask != '\0') | |
269 | nick = mask; | |
270 | } | |
271 | else | |
272 | { | |
273 | if(*mask != '\0') | |
274 | user = mask; | |
275 | } | |
276 | } | |
277 | else if((t = strchr(mask, '!')) != NULL) | |
278 | { | |
279 | ex = t; | |
280 | *t++ = '\0'; | |
281 | if(*mask != '\0') | |
282 | nick = mask; | |
283 | if(*t != '\0') | |
284 | user = t; | |
285 | } | |
286 | else if(strchr(mask, '.') != NULL || strchr(mask, ':') != NULL) | |
287 | { | |
288 | if(*mask != '\0') | |
289 | host = mask; | |
290 | } | |
291 | else | |
292 | { | |
293 | if(*mask != '\0') | |
294 | nick = mask; | |
295 | } | |
296 | ||
297 | /* truncate values to max lengths */ | |
298 | if(strlen(nick) > NICKLEN - 1) | |
299 | { | |
300 | ne = nick[NICKLEN - 1]; | |
301 | nick[NICKLEN - 1] = '\0'; | |
302 | } | |
303 | if(strlen(user) > USERLEN) | |
304 | { | |
305 | ue = user[USERLEN]; | |
306 | user[USERLEN] = '\0'; | |
307 | } | |
308 | if(strlen(host) > HOSTLEN) | |
309 | { | |
310 | he = host[HOSTLEN]; | |
311 | host[HOSTLEN] = '\0'; | |
312 | } | |
313 | ||
314 | mask_pos += ircsprintf(mask_buf + mask_pos, "%s!%s@%s", nick, user, host) + 1; | |
315 | ||
316 | /* restore mask, since we may need to use it again later */ | |
317 | if(at) | |
318 | *at = '@'; | |
319 | if(ex) | |
320 | *ex = '!'; | |
321 | if(ne) | |
322 | nick[NICKLEN - 1] = ne; | |
323 | if(ue) | |
324 | user[USERLEN] = ue; | |
325 | if(he) | |
326 | host[HOSTLEN] = he; | |
327 | ||
328 | return mask_buf + old_mask_pos; | |
329 | } | |
330 | ||
331 | /* fix_key() | |
332 | * | |
333 | * input - key to fix | |
334 | * output - the same key, fixed | |
335 | * side effects - anything below ascii 13 is discarded, ':' discarded, | |
336 | * high ascii is dropped to lower half of ascii table | |
337 | */ | |
338 | static char * | |
339 | fix_key(char *arg) | |
340 | { | |
341 | u_char *s, *t, c; | |
342 | ||
343 | for(s = t = (u_char *) arg; (c = *s); s++) | |
344 | { | |
345 | c &= 0x7f; | |
346 | if(c != ':' && c != ',' && c > ' ') | |
347 | *t++ = c; | |
348 | } | |
349 | ||
350 | *t = '\0'; | |
351 | return arg; | |
352 | } | |
353 | ||
354 | /* fix_key_remote() | |
355 | * | |
356 | * input - key to fix | |
357 | * ouput - the same key, fixed | |
358 | * side effects - high ascii dropped to lower half of table, | |
359 | * CR/LF/':' are dropped | |
360 | */ | |
361 | static char * | |
362 | fix_key_remote(char *arg) | |
363 | { | |
364 | u_char *s, *t, c; | |
365 | ||
366 | for(s = t = (u_char *) arg; (c = *s); s++) | |
367 | { | |
368 | c &= 0x7f; | |
369 | if((c != 0x0a) && (c != ':') && (c != ',') && (c != 0x0d) && (c != ' ')) | |
370 | *t++ = c; | |
371 | } | |
372 | ||
373 | *t = '\0'; | |
374 | return arg; | |
375 | } | |
376 | ||
377 | /* chm_*() | |
378 | * | |
379 | * The handlers for each specific mode. | |
380 | */ | |
381 | void | |
382 | chm_nosuch(struct Client *source_p, struct Channel *chptr, | |
383 | int alevel, int parc, int *parn, | |
384 | const char **parv, int *errors, int dir, char c, long mode_type) | |
385 | { | |
386 | if(*errors & SM_ERR_UNKNOWN) | |
387 | return; | |
388 | *errors |= SM_ERR_UNKNOWN; | |
389 | sendto_one(source_p, form_str(ERR_UNKNOWNMODE), me.name, source_p->name, c); | |
390 | } | |
391 | ||
392 | void | |
393 | chm_simple(struct Client *source_p, struct Channel *chptr, | |
394 | int alevel, int parc, int *parn, | |
395 | const char **parv, int *errors, int dir, char c, long mode_type) | |
396 | { | |
397 | if(alevel != CHFL_CHANOP) | |
398 | { | |
399 | if(!(*errors & SM_ERR_NOOPS)) | |
400 | sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED), | |
401 | me.name, source_p->name, chptr->chname); | |
402 | *errors |= SM_ERR_NOOPS; | |
403 | return; | |
404 | } | |
405 | ||
406 | /* +ntspmaikl == 9 + MAXMODEPARAMS (4 * +o) */ | |
407 | if(MyClient(source_p) && (++mode_limit > (9 + MAXMODEPARAMS))) | |
408 | return; | |
409 | ||
410 | /* setting + */ | |
411 | if((dir == MODE_ADD) && !(chptr->mode.mode & mode_type)) | |
412 | { | |
413 | /* if +f is disabled, ignore an attempt to set +QF locally */ | |
414 | if(!ConfigChannel.use_forward && MyClient(source_p) && | |
415 | (c == 'Q' || c == 'F')) | |
416 | return; | |
417 | ||
418 | chptr->mode.mode |= mode_type; | |
419 | ||
420 | mode_changes[mode_count].letter = c; | |
421 | mode_changes[mode_count].dir = MODE_ADD; | |
422 | mode_changes[mode_count].caps = 0; | |
423 | mode_changes[mode_count].nocaps = 0; | |
424 | mode_changes[mode_count].id = NULL; | |
425 | mode_changes[mode_count].mems = ALL_MEMBERS; | |
426 | mode_changes[mode_count++].arg = NULL; | |
427 | } | |
428 | else if((dir == MODE_DEL) && (chptr->mode.mode & mode_type)) | |
429 | { | |
430 | chptr->mode.mode &= ~mode_type; | |
431 | ||
432 | mode_changes[mode_count].letter = c; | |
433 | mode_changes[mode_count].dir = MODE_DEL; | |
434 | mode_changes[mode_count].caps = 0; | |
435 | mode_changes[mode_count].nocaps = 0; | |
436 | mode_changes[mode_count].mems = ALL_MEMBERS; | |
437 | mode_changes[mode_count].id = NULL; | |
438 | mode_changes[mode_count++].arg = NULL; | |
439 | } | |
440 | } | |
441 | ||
442 | void | |
443 | chm_staff(struct Client *source_p, struct Channel *chptr, | |
444 | int alevel, int parc, int *parn, | |
445 | const char **parv, int *errors, int dir, char c, long mode_type) | |
446 | { | |
447 | if(!IsOper(source_p) && !IsServer(source_p)) | |
448 | { | |
449 | if(!(*errors & SM_ERR_NOPRIVS)) | |
450 | sendto_one_numeric(source_p, ERR_NOPRIVILEGES, form_str(ERR_NOPRIVILEGES)); | |
451 | *errors |= SM_ERR_NOPRIVS; | |
452 | return; | |
453 | } | |
454 | ||
455 | /* setting + */ | |
456 | if((dir == MODE_ADD) && !(chptr->mode.mode & mode_type)) | |
457 | { | |
458 | chptr->mode.mode |= mode_type; | |
459 | ||
460 | mode_changes[mode_count].letter = c; | |
461 | mode_changes[mode_count].dir = MODE_ADD; | |
462 | mode_changes[mode_count].caps = 0; | |
463 | mode_changes[mode_count].nocaps = 0; | |
464 | mode_changes[mode_count].id = NULL; | |
465 | mode_changes[mode_count].mems = ALL_MEMBERS; | |
466 | mode_changes[mode_count++].arg = NULL; | |
467 | } | |
468 | else if((dir == MODE_DEL) && (chptr->mode.mode & mode_type)) | |
469 | { | |
470 | chptr->mode.mode &= ~mode_type; | |
471 | ||
472 | mode_changes[mode_count].letter = c; | |
473 | mode_changes[mode_count].dir = MODE_DEL; | |
474 | mode_changes[mode_count].caps = 0; | |
475 | mode_changes[mode_count].nocaps = 0; | |
476 | mode_changes[mode_count].mems = ALL_MEMBERS; | |
477 | mode_changes[mode_count].id = NULL; | |
478 | mode_changes[mode_count++].arg = NULL; | |
479 | } | |
480 | } | |
481 | ||
482 | void | |
483 | chm_ban(struct Client *source_p, struct Channel *chptr, | |
484 | int alevel, int parc, int *parn, | |
485 | const char **parv, int *errors, int dir, char c, long mode_type) | |
486 | { | |
487 | const char *mask; | |
488 | const char *raw_mask; | |
489 | dlink_list *list; | |
490 | dlink_node *ptr; | |
491 | struct Ban *banptr; | |
492 | int errorval; | |
493 | int rpl_list; | |
494 | int rpl_endlist; | |
495 | int caps; | |
496 | int mems; | |
497 | ||
498 | switch (mode_type) | |
499 | { | |
500 | case CHFL_BAN: | |
501 | list = &chptr->banlist; | |
502 | errorval = SM_ERR_RPL_B; | |
503 | rpl_list = RPL_BANLIST; | |
504 | rpl_endlist = RPL_ENDOFBANLIST; | |
505 | mems = ALL_MEMBERS; | |
506 | caps = 0; | |
507 | break; | |
508 | ||
509 | case CHFL_EXCEPTION: | |
510 | /* if +e is disabled, allow all but +e locally */ | |
511 | if(!ConfigChannel.use_except && MyClient(source_p) && | |
512 | ((dir == MODE_ADD) && (parc > *parn))) | |
513 | return; | |
514 | ||
515 | list = &chptr->exceptlist; | |
516 | errorval = SM_ERR_RPL_E; | |
517 | rpl_list = RPL_EXCEPTLIST; | |
518 | rpl_endlist = RPL_ENDOFEXCEPTLIST; | |
519 | caps = CAP_EX; | |
520 | ||
521 | if(ConfigChannel.use_except || (dir == MODE_DEL)) | |
522 | mems = ONLY_CHANOPS; | |
523 | else | |
524 | mems = ONLY_SERVERS; | |
525 | break; | |
526 | ||
527 | case CHFL_INVEX: | |
528 | /* if +I is disabled, allow all but +I locally */ | |
529 | if(!ConfigChannel.use_invex && MyClient(source_p) && | |
530 | (dir == MODE_ADD) && (parc > *parn)) | |
531 | return; | |
532 | ||
533 | list = &chptr->invexlist; | |
534 | errorval = SM_ERR_RPL_I; | |
535 | rpl_list = RPL_INVITELIST; | |
536 | rpl_endlist = RPL_ENDOFINVITELIST; | |
537 | caps = CAP_IE; | |
538 | ||
539 | if(ConfigChannel.use_invex || (dir == MODE_DEL)) | |
540 | mems = ONLY_CHANOPS; | |
541 | else | |
542 | mems = ONLY_SERVERS; | |
543 | break; | |
544 | ||
545 | case CHFL_QUIET: | |
546 | list = &chptr->quietlist; | |
547 | errorval = SM_ERR_RPL_Q; | |
548 | rpl_list = RPL_BANLIST; | |
549 | rpl_endlist = RPL_ENDOFBANLIST; | |
550 | mems = ALL_MEMBERS; | |
551 | caps = 0; | |
552 | break; | |
553 | ||
554 | default: | |
555 | sendto_realops_snomask(SNO_GENERAL, L_ALL, "chm_ban() called with unknown type!"); | |
556 | return; | |
557 | break; | |
558 | } | |
559 | ||
560 | if(dir == 0 || parc <= *parn) | |
561 | { | |
562 | if((*errors & errorval) != 0) | |
563 | return; | |
564 | *errors |= errorval; | |
565 | ||
566 | /* non-ops cant see +eI lists.. */ | |
567 | if(alevel != CHFL_CHANOP && mode_type != CHFL_BAN && | |
568 | mode_type != CHFL_QUIET) | |
569 | { | |
570 | if(!(*errors & SM_ERR_NOOPS)) | |
571 | sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED), | |
572 | me.name, source_p->name, chptr->chname); | |
573 | *errors |= SM_ERR_NOOPS; | |
574 | return; | |
575 | } | |
576 | ||
577 | DLINK_FOREACH(ptr, list->head) | |
578 | { | |
579 | banptr = ptr->data; | |
580 | sendto_one(source_p, form_str(rpl_list), | |
581 | me.name, source_p->name, chptr->chname, | |
582 | banptr->banstr, banptr->who, banptr->when); | |
583 | } | |
11781253 JT |
584 | if (mode_type == CHFL_QUIET) |
585 | sendto_one(source_p, ":%s %d %s %s :End of Channel Quiet List", me.name, rpl_endlist, source_p->name, chptr->chname); | |
586 | else | |
587 | sendto_one(source_p, form_str(rpl_endlist), me.name, source_p->name, chptr->chname); | |
212380e3 AC |
588 | return; |
589 | } | |
590 | ||
591 | if(alevel != CHFL_CHANOP) | |
592 | { | |
593 | if(!(*errors & SM_ERR_NOOPS)) | |
594 | sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED), | |
595 | me.name, source_p->name, chptr->chname); | |
596 | *errors |= SM_ERR_NOOPS; | |
597 | return; | |
598 | } | |
599 | ||
600 | if(MyClient(source_p) && (++mode_limit > MAXMODEPARAMS)) | |
601 | return; | |
602 | ||
603 | raw_mask = parv[(*parn)]; | |
604 | (*parn)++; | |
605 | ||
606 | /* empty ban, or starts with ':' which messes up s2s, ignore it */ | |
607 | if(EmptyString(raw_mask) || *raw_mask == ':') | |
608 | return; | |
609 | ||
610 | if(!MyClient(source_p)) | |
611 | { | |
612 | if(strchr(raw_mask, ' ')) | |
613 | return; | |
614 | ||
615 | mask = raw_mask; | |
616 | } | |
617 | else | |
618 | mask = pretty_mask(raw_mask); | |
619 | ||
620 | /* we'd have problems parsing this, hyb6 does it too */ | |
621 | if(strlen(mask) > (MODEBUFLEN - 2)) | |
622 | return; | |
623 | ||
624 | /* if we're adding a NEW id */ | |
625 | if(dir == MODE_ADD) | |
626 | { | |
627 | if (*mask == '$' && MyClient(source_p)) | |
628 | { | |
629 | if (!valid_extban(mask, source_p, chptr, mode_type)) | |
630 | /* XXX perhaps return an error message here */ | |
631 | return; | |
632 | } | |
633 | ||
634 | /* dont allow local clients to overflow the banlist, dont | |
635 | * let remote servers set duplicate bans | |
636 | */ | |
637 | if(!add_id(source_p, chptr, mask, list, mode_type)) | |
638 | return; | |
639 | ||
640 | mode_changes[mode_count].letter = c; | |
641 | mode_changes[mode_count].dir = MODE_ADD; | |
642 | mode_changes[mode_count].caps = caps; | |
643 | mode_changes[mode_count].nocaps = 0; | |
644 | mode_changes[mode_count].mems = mems; | |
645 | mode_changes[mode_count].id = NULL; | |
646 | mode_changes[mode_count++].arg = mask; | |
647 | } | |
648 | else if(dir == MODE_DEL) | |
649 | { | |
650 | if(del_id(chptr, mask, list, mode_type) == 0) | |
651 | { | |
652 | /* mask isn't a valid ban, check raw_mask */ | |
653 | if(del_id(chptr, raw_mask, list, mode_type)) | |
654 | mask = raw_mask; | |
655 | } | |
656 | ||
657 | mode_changes[mode_count].letter = c; | |
658 | mode_changes[mode_count].dir = MODE_DEL; | |
659 | mode_changes[mode_count].caps = caps; | |
660 | mode_changes[mode_count].nocaps = 0; | |
661 | mode_changes[mode_count].mems = mems; | |
662 | mode_changes[mode_count].id = NULL; | |
663 | mode_changes[mode_count++].arg = mask; | |
664 | } | |
665 | } | |
666 | ||
667 | void | |
668 | chm_op(struct Client *source_p, struct Channel *chptr, | |
669 | int alevel, int parc, int *parn, | |
670 | const char **parv, int *errors, int dir, char c, long mode_type) | |
671 | { | |
672 | struct membership *mstptr; | |
673 | const char *opnick; | |
674 | struct Client *targ_p; | |
675 | ||
676 | if(alevel != CHFL_CHANOP) | |
677 | { | |
678 | if(!(*errors & SM_ERR_NOOPS)) | |
679 | sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED), | |
680 | me.name, source_p->name, chptr->chname); | |
681 | *errors |= SM_ERR_NOOPS; | |
682 | return; | |
683 | } | |
684 | ||
685 | if((dir == MODE_QUERY) || (parc <= *parn)) | |
686 | return; | |
687 | ||
688 | opnick = parv[(*parn)]; | |
689 | (*parn)++; | |
690 | ||
691 | /* empty nick */ | |
692 | if(EmptyString(opnick)) | |
693 | { | |
694 | sendto_one_numeric(source_p, ERR_NOSUCHNICK, form_str(ERR_NOSUCHNICK), "*"); | |
695 | return; | |
696 | } | |
697 | ||
698 | if((targ_p = find_chasing(source_p, opnick, NULL)) == NULL) | |
699 | { | |
700 | return; | |
701 | } | |
702 | ||
703 | mstptr = find_channel_membership(chptr, targ_p); | |
704 | ||
705 | if(mstptr == NULL) | |
706 | { | |
707 | if(!(*errors & SM_ERR_NOTONCHANNEL) && MyClient(source_p)) | |
708 | sendto_one_numeric(source_p, ERR_USERNOTINCHANNEL, | |
709 | form_str(ERR_USERNOTINCHANNEL), opnick, chptr->chname); | |
710 | *errors |= SM_ERR_NOTONCHANNEL; | |
711 | return; | |
712 | } | |
713 | ||
714 | if(MyClient(source_p) && (++mode_limit > MAXMODEPARAMS)) | |
715 | return; | |
716 | ||
717 | if(dir == MODE_ADD) | |
718 | { | |
719 | if(targ_p == source_p) | |
720 | return; | |
721 | ||
722 | mode_changes[mode_count].letter = c; | |
723 | mode_changes[mode_count].dir = MODE_ADD; | |
724 | mode_changes[mode_count].caps = 0; | |
725 | mode_changes[mode_count].nocaps = 0; | |
726 | mode_changes[mode_count].mems = ALL_MEMBERS; | |
727 | mode_changes[mode_count].id = targ_p->id; | |
728 | mode_changes[mode_count].arg = targ_p->name; | |
729 | mode_changes[mode_count++].client = targ_p; | |
730 | ||
731 | mstptr->flags |= CHFL_CHANOP; | |
732 | mstptr->flags &= ~CHFL_DEOPPED; | |
733 | } | |
734 | else | |
735 | { | |
736 | if(MyClient(source_p) && IsService(targ_p)) | |
737 | { | |
738 | sendto_one(source_p, form_str(ERR_ISCHANSERVICE), | |
739 | me.name, source_p->name, targ_p->name, chptr->chname); | |
740 | return; | |
741 | } | |
742 | ||
743 | mode_changes[mode_count].letter = c; | |
744 | mode_changes[mode_count].dir = MODE_DEL; | |
745 | mode_changes[mode_count].caps = 0; | |
746 | mode_changes[mode_count].nocaps = 0; | |
747 | mode_changes[mode_count].mems = ALL_MEMBERS; | |
748 | mode_changes[mode_count].id = targ_p->id; | |
749 | mode_changes[mode_count].arg = targ_p->name; | |
750 | mode_changes[mode_count++].client = targ_p; | |
751 | ||
752 | mstptr->flags &= ~CHFL_CHANOP; | |
753 | } | |
754 | } | |
755 | ||
756 | void | |
757 | chm_voice(struct Client *source_p, struct Channel *chptr, | |
758 | int alevel, int parc, int *parn, | |
759 | const char **parv, int *errors, int dir, char c, long mode_type) | |
760 | { | |
761 | struct membership *mstptr; | |
762 | const char *opnick; | |
763 | struct Client *targ_p; | |
764 | ||
765 | if(alevel != CHFL_CHANOP) | |
766 | { | |
767 | if(!(*errors & SM_ERR_NOOPS)) | |
768 | sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED), | |
769 | me.name, source_p->name, chptr->chname); | |
770 | *errors |= SM_ERR_NOOPS; | |
771 | return; | |
772 | } | |
773 | ||
774 | if((dir == MODE_QUERY) || parc <= *parn) | |
775 | return; | |
776 | ||
777 | opnick = parv[(*parn)]; | |
778 | (*parn)++; | |
779 | ||
780 | /* empty nick */ | |
781 | if(EmptyString(opnick)) | |
782 | { | |
783 | sendto_one_numeric(source_p, ERR_NOSUCHNICK, form_str(ERR_NOSUCHNICK), "*"); | |
784 | return; | |
785 | } | |
786 | ||
787 | if((targ_p = find_chasing(source_p, opnick, NULL)) == NULL) | |
788 | { | |
789 | return; | |
790 | } | |
791 | ||
792 | mstptr = find_channel_membership(chptr, targ_p); | |
793 | ||
794 | if(mstptr == NULL) | |
795 | { | |
796 | if(!(*errors & SM_ERR_NOTONCHANNEL) && MyClient(source_p)) | |
797 | sendto_one_numeric(source_p, ERR_USERNOTINCHANNEL, | |
798 | form_str(ERR_USERNOTINCHANNEL), opnick, chptr->chname); | |
799 | *errors |= SM_ERR_NOTONCHANNEL; | |
800 | return; | |
801 | } | |
802 | ||
803 | if(MyClient(source_p) && (++mode_limit > MAXMODEPARAMS)) | |
804 | return; | |
805 | ||
806 | if(dir == MODE_ADD) | |
807 | { | |
808 | mode_changes[mode_count].letter = c; | |
809 | mode_changes[mode_count].dir = MODE_ADD; | |
810 | mode_changes[mode_count].caps = 0; | |
811 | mode_changes[mode_count].nocaps = 0; | |
812 | mode_changes[mode_count].mems = ALL_MEMBERS; | |
813 | mode_changes[mode_count].id = targ_p->id; | |
814 | mode_changes[mode_count].arg = targ_p->name; | |
815 | mode_changes[mode_count++].client = targ_p; | |
816 | ||
817 | mstptr->flags |= CHFL_VOICE; | |
818 | } | |
819 | else | |
820 | { | |
821 | mode_changes[mode_count].letter = 'v'; | |
822 | mode_changes[mode_count].dir = MODE_DEL; | |
823 | mode_changes[mode_count].caps = 0; | |
824 | mode_changes[mode_count].nocaps = 0; | |
825 | mode_changes[mode_count].mems = ALL_MEMBERS; | |
826 | mode_changes[mode_count].id = targ_p->id; | |
827 | mode_changes[mode_count].arg = targ_p->name; | |
828 | mode_changes[mode_count++].client = targ_p; | |
829 | ||
830 | mstptr->flags &= ~CHFL_VOICE; | |
831 | } | |
832 | } | |
833 | ||
834 | void | |
835 | chm_limit(struct Client *source_p, struct Channel *chptr, | |
836 | int alevel, int parc, int *parn, | |
837 | const char **parv, int *errors, int dir, char c, long mode_type) | |
838 | { | |
839 | const char *lstr; | |
840 | static char limitstr[30]; | |
841 | int limit; | |
842 | ||
843 | if(alevel != CHFL_CHANOP) | |
844 | { | |
845 | if(!(*errors & SM_ERR_NOOPS)) | |
846 | sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED), | |
847 | me.name, source_p->name, chptr->chname); | |
848 | *errors |= SM_ERR_NOOPS; | |
849 | return; | |
850 | } | |
851 | ||
852 | if(dir == MODE_QUERY) | |
853 | return; | |
854 | ||
855 | if((dir == MODE_ADD) && parc > *parn) | |
856 | { | |
857 | lstr = parv[(*parn)]; | |
858 | (*parn)++; | |
859 | ||
860 | if(EmptyString(lstr) || (limit = atoi(lstr)) <= 0) | |
861 | return; | |
862 | ||
863 | ircsprintf(limitstr, "%d", limit); | |
864 | ||
865 | mode_changes[mode_count].letter = c; | |
866 | mode_changes[mode_count].dir = MODE_ADD; | |
867 | mode_changes[mode_count].caps = 0; | |
868 | mode_changes[mode_count].nocaps = 0; | |
869 | mode_changes[mode_count].mems = ALL_MEMBERS; | |
870 | mode_changes[mode_count].id = NULL; | |
871 | mode_changes[mode_count++].arg = limitstr; | |
872 | ||
873 | chptr->mode.limit = limit; | |
874 | } | |
875 | else if(dir == MODE_DEL) | |
876 | { | |
877 | if(!chptr->mode.limit) | |
878 | return; | |
879 | ||
880 | chptr->mode.limit = 0; | |
881 | ||
882 | mode_changes[mode_count].letter = c; | |
883 | mode_changes[mode_count].dir = MODE_DEL; | |
884 | mode_changes[mode_count].caps = 0; | |
885 | mode_changes[mode_count].nocaps = 0; | |
886 | mode_changes[mode_count].mems = ALL_MEMBERS; | |
887 | mode_changes[mode_count].id = NULL; | |
888 | mode_changes[mode_count++].arg = NULL; | |
889 | } | |
890 | } | |
891 | ||
892 | void | |
893 | chm_throttle(struct Client *source_p, struct Channel *chptr, | |
894 | int alevel, int parc, int *parn, | |
895 | const char **parv, int *errors, int dir, char c, long mode_type) | |
896 | { | |
897 | int joins = 0, timeslice = 0; | |
898 | ||
899 | if(alevel != CHFL_CHANOP) | |
900 | { | |
901 | if(!(*errors & SM_ERR_NOOPS)) | |
902 | sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED), | |
903 | me.name, source_p->name, chptr->chname); | |
904 | *errors |= SM_ERR_NOOPS; | |
905 | return; | |
906 | } | |
907 | ||
908 | if(dir == MODE_QUERY) | |
909 | return; | |
910 | ||
911 | if((dir == MODE_ADD) && parc > *parn) | |
912 | { | |
913 | sscanf(parv[(*parn)], "%d:%d", &joins, ×lice); | |
914 | ||
915 | if(!joins || !timeslice) | |
916 | return; | |
917 | ||
918 | mode_changes[mode_count].letter = c; | |
919 | mode_changes[mode_count].dir = MODE_ADD; | |
920 | mode_changes[mode_count].caps = 0; | |
921 | mode_changes[mode_count].nocaps = 0; | |
922 | mode_changes[mode_count].mems = ALL_MEMBERS; | |
923 | mode_changes[mode_count].id = NULL; | |
924 | mode_changes[mode_count++].arg = parv[(*parn)]; | |
925 | ||
926 | (*parn)++; | |
927 | ||
928 | chptr->mode.join_num = joins; | |
929 | chptr->mode.join_time = timeslice; | |
930 | } | |
931 | else if(dir == MODE_DEL) | |
932 | { | |
933 | if(!chptr->mode.join_num) | |
934 | return; | |
935 | ||
936 | chptr->mode.join_num = 0; | |
937 | chptr->mode.join_time = 0; | |
938 | chptr->join_count = 0; | |
939 | chptr->join_delta = 0; | |
940 | ||
941 | mode_changes[mode_count].letter = c; | |
942 | mode_changes[mode_count].dir = MODE_DEL; | |
943 | mode_changes[mode_count].caps = 0; | |
944 | mode_changes[mode_count].nocaps = 0; | |
945 | mode_changes[mode_count].mems = ALL_MEMBERS; | |
946 | mode_changes[mode_count].id = NULL; | |
947 | mode_changes[mode_count++].arg = NULL; | |
948 | } | |
949 | } | |
950 | ||
951 | void | |
952 | chm_forward(struct Client *source_p, struct Channel *chptr, | |
953 | int alevel, int parc, int *parn, | |
954 | const char **parv, int *errors, int dir, char c, long mode_type) | |
955 | { | |
956 | struct Channel *targptr = NULL; | |
957 | struct membership *msptr; | |
958 | const char *forward; | |
959 | ||
960 | /* if +f is disabled, ignore local attempts to set it */ | |
961 | if(!ConfigChannel.use_forward && MyClient(source_p) && | |
962 | (dir == MODE_ADD) && (parc > *parn)) | |
963 | return; | |
964 | ||
965 | if(dir == MODE_QUERY || (dir == MODE_ADD && parc <= *parn)) | |
966 | { | |
967 | if (!(*errors & SM_ERR_RPL_F)) | |
968 | { | |
969 | if (*chptr->mode.forward == '\0') | |
5366977b | 970 | sendto_one_notice(source_p, ":%s has no forward channel", chptr->chname); |
212380e3 | 971 | else |
5366977b | 972 | sendto_one_notice(source_p, ":%s forward channel is %s", chptr->chname, chptr->mode.forward); |
212380e3 AC |
973 | *errors |= SM_ERR_RPL_F; |
974 | } | |
975 | return; | |
976 | } | |
977 | ||
978 | #ifndef FORWARD_OPERONLY | |
979 | if(alevel != CHFL_CHANOP) | |
980 | { | |
981 | if(!(*errors & SM_ERR_NOOPS)) | |
982 | sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED), | |
983 | me.name, source_p->name, chptr->chname); | |
984 | *errors |= SM_ERR_NOOPS; | |
985 | return; | |
986 | } | |
987 | #else | |
988 | if(!IsOper(source_p) && !IsServer(source_p)) | |
989 | { | |
990 | if(!(*errors & SM_ERR_NOPRIVS)) | |
991 | sendto_one_numeric(source_p, ERR_NOPRIVILEGES, form_str(ERR_NOPRIVILEGES)); | |
992 | *errors |= SM_ERR_NOPRIVS; | |
993 | return; | |
994 | } | |
995 | #endif | |
996 | ||
997 | if(dir == MODE_ADD && parc > *parn) | |
998 | { | |
999 | forward = parv[(*parn)]; | |
1000 | (*parn)++; | |
1001 | ||
1002 | if(EmptyString(forward)) | |
1003 | return; | |
1004 | if(!check_channel_name(forward) || | |
1005 | (MyClient(source_p) && (strlen(forward) > LOC_CHANNELLEN || hash_find_resv(forward)))) | |
1006 | { | |
1007 | sendto_one_numeric(source_p, ERR_BADCHANNAME, form_str(ERR_BADCHANNAME), forward); | |
1008 | return; | |
1009 | } | |
1010 | /* don't forward to inconsistent target -- jilles */ | |
1011 | if(chptr->chname[0] == '#' && forward[0] == '&') | |
1012 | { | |
1013 | sendto_one_numeric(source_p, ERR_BADCHANNAME, | |
1014 | form_str(ERR_BADCHANNAME), forward); | |
1015 | return; | |
1016 | } | |
1017 | if(MyClient(source_p) && (targptr = find_channel(forward)) == NULL) | |
1018 | { | |
1019 | sendto_one_numeric(source_p, ERR_NOSUCHCHANNEL, | |
1020 | form_str(ERR_NOSUCHCHANNEL), forward); | |
1021 | return; | |
1022 | } | |
1023 | if(MyClient(source_p) && !(targptr->mode.mode & MODE_FREETARGET)) | |
1024 | { | |
1025 | if((msptr = find_channel_membership(targptr, source_p)) == NULL || | |
1026 | get_channel_access(source_p, msptr) != CHFL_CHANOP) | |
1027 | { | |
1028 | sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED), | |
1029 | me.name, source_p->name, targptr->chname); | |
1030 | return; | |
1031 | } | |
1032 | } | |
1033 | ||
1034 | strlcpy(chptr->mode.forward, forward, sizeof(chptr->mode.forward)); | |
1035 | ||
1036 | mode_changes[mode_count].letter = c; | |
1037 | mode_changes[mode_count].dir = MODE_ADD; | |
1038 | mode_changes[mode_count].caps = 0; | |
1039 | mode_changes[mode_count].nocaps = 0; | |
1040 | mode_changes[mode_count].mems = ConfigChannel.use_forward ? ALL_MEMBERS : ONLY_SERVERS; | |
1041 | mode_changes[mode_count].id = NULL; | |
1042 | mode_changes[mode_count++].arg = forward; | |
1043 | } | |
1044 | else if(dir == MODE_DEL) | |
1045 | { | |
1046 | if(!(*chptr->mode.forward)) | |
1047 | return; | |
1048 | ||
1049 | *chptr->mode.forward = '\0'; | |
1050 | ||
1051 | mode_changes[mode_count].letter = c; | |
1052 | mode_changes[mode_count].dir = MODE_DEL; | |
1053 | mode_changes[mode_count].caps = 0; | |
1054 | mode_changes[mode_count].nocaps = 0; | |
1055 | mode_changes[mode_count].mems = ALL_MEMBERS; | |
1056 | mode_changes[mode_count].id = NULL; | |
1057 | mode_changes[mode_count++].arg = NULL; | |
1058 | } | |
1059 | } | |
1060 | ||
1061 | void | |
1062 | chm_key(struct Client *source_p, struct Channel *chptr, | |
1063 | int alevel, int parc, int *parn, | |
1064 | const char **parv, int *errors, int dir, char c, long mode_type) | |
1065 | { | |
1066 | char *key; | |
1067 | ||
1068 | if(alevel != CHFL_CHANOP) | |
1069 | { | |
1070 | if(!(*errors & SM_ERR_NOOPS)) | |
1071 | sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED), | |
1072 | me.name, source_p->name, chptr->chname); | |
1073 | *errors |= SM_ERR_NOOPS; | |
1074 | return; | |
1075 | } | |
1076 | ||
1077 | if(dir == MODE_QUERY) | |
1078 | return; | |
1079 | ||
1080 | if((dir == MODE_ADD) && parc > *parn) | |
1081 | { | |
1082 | key = LOCAL_COPY(parv[(*parn)]); | |
1083 | (*parn)++; | |
1084 | ||
1085 | if(MyClient(source_p)) | |
1086 | fix_key(key); | |
1087 | else | |
1088 | fix_key_remote(key); | |
1089 | ||
1090 | if(EmptyString(key)) | |
1091 | return; | |
1092 | ||
1093 | s_assert(key[0] != ' '); | |
1094 | strlcpy(chptr->mode.key, key, sizeof(chptr->mode.key)); | |
1095 | ||
1096 | mode_changes[mode_count].letter = c; | |
1097 | mode_changes[mode_count].dir = MODE_ADD; | |
1098 | mode_changes[mode_count].caps = 0; | |
1099 | mode_changes[mode_count].nocaps = 0; | |
1100 | mode_changes[mode_count].mems = ALL_MEMBERS; | |
1101 | mode_changes[mode_count].id = NULL; | |
1102 | mode_changes[mode_count++].arg = chptr->mode.key; | |
1103 | } | |
1104 | else if(dir == MODE_DEL) | |
1105 | { | |
1106 | static char splat[] = "*"; | |
1107 | int i; | |
1108 | ||
1109 | if(parc > *parn) | |
1110 | (*parn)++; | |
1111 | ||
1112 | if(!(*chptr->mode.key)) | |
1113 | return; | |
1114 | ||
1115 | /* hack time. when we get a +k-k mode, the +k arg is | |
1116 | * chptr->mode.key, which the -k sets to \0, so hunt for a | |
1117 | * +k when we get a -k, and set the arg to splat. --anfl | |
1118 | */ | |
1119 | for(i = 0; i < mode_count; i++) | |
1120 | { | |
1121 | if(mode_changes[i].letter == 'k' && mode_changes[i].dir == MODE_ADD) | |
1122 | mode_changes[i].arg = splat; | |
1123 | } | |
1124 | ||
1125 | *chptr->mode.key = 0; | |
1126 | ||
1127 | mode_changes[mode_count].letter = c; | |
1128 | mode_changes[mode_count].dir = MODE_DEL; | |
1129 | mode_changes[mode_count].caps = 0; | |
1130 | mode_changes[mode_count].nocaps = 0; | |
1131 | mode_changes[mode_count].mems = ALL_MEMBERS; | |
1132 | mode_changes[mode_count].id = NULL; | |
1133 | mode_changes[mode_count++].arg = "*"; | |
1134 | } | |
1135 | } | |
1136 | ||
1137 | void | |
1138 | chm_regonly(struct Client *source_p, struct Channel *chptr, | |
1139 | int alevel, int parc, int *parn, | |
1140 | const char **parv, int *errors, int dir, char c, long mode_type) | |
1141 | { | |
1142 | if(alevel != CHFL_CHANOP) | |
1143 | { | |
1144 | if(!(*errors & SM_ERR_NOOPS)) | |
1145 | sendto_one(source_p, form_str(ERR_CHANOPRIVSNEEDED), | |
1146 | me.name, source_p->name, chptr->chname); | |
1147 | *errors |= SM_ERR_NOOPS; | |
1148 | return; | |
1149 | } | |
1150 | ||
1151 | if(dir == MODE_QUERY) | |
1152 | return; | |
1153 | ||
1154 | if(((dir == MODE_ADD) && (chptr->mode.mode & MODE_REGONLY)) || | |
1155 | ((dir == MODE_DEL) && !(chptr->mode.mode & MODE_REGONLY))) | |
1156 | return; | |
1157 | ||
1158 | if(dir == MODE_ADD) | |
1159 | chptr->mode.mode |= MODE_REGONLY; | |
1160 | else | |
1161 | chptr->mode.mode &= ~MODE_REGONLY; | |
1162 | ||
1163 | mode_changes[mode_count].letter = c; | |
1164 | mode_changes[mode_count].dir = dir; | |
1165 | mode_changes[mode_count].caps = CAP_SERVICE; | |
1166 | mode_changes[mode_count].nocaps = 0; | |
1167 | mode_changes[mode_count].mems = ALL_MEMBERS; | |
1168 | mode_changes[mode_count].id = NULL; | |
1169 | mode_changes[mode_count++].arg = NULL; | |
1170 | } | |
1171 | ||
1172 | /* *INDENT-OFF* */ | |
1173 | struct ChannelMode chmode_table[256] = | |
1174 | { | |
1175 | {chm_nosuch, 0 }, /* 0x00 */ | |
1176 | {chm_nosuch, 0 }, /* 0x01 */ | |
1177 | {chm_nosuch, 0 }, /* 0x02 */ | |
1178 | {chm_nosuch, 0 }, /* 0x03 */ | |
1179 | {chm_nosuch, 0 }, /* 0x04 */ | |
1180 | {chm_nosuch, 0 }, /* 0x05 */ | |
1181 | {chm_nosuch, 0 }, /* 0x06 */ | |
1182 | {chm_nosuch, 0 }, /* 0x07 */ | |
1183 | {chm_nosuch, 0 }, /* 0x08 */ | |
1184 | {chm_nosuch, 0 }, /* 0x09 */ | |
1185 | {chm_nosuch, 0 }, /* 0x0a */ | |
1186 | {chm_nosuch, 0 }, /* 0x0b */ | |
1187 | {chm_nosuch, 0 }, /* 0x0c */ | |
1188 | {chm_nosuch, 0 }, /* 0x0d */ | |
1189 | {chm_nosuch, 0 }, /* 0x0e */ | |
1190 | {chm_nosuch, 0 }, /* 0x0f */ | |
1191 | {chm_nosuch, 0 }, /* 0x10 */ | |
1192 | {chm_nosuch, 0 }, /* 0x11 */ | |
1193 | {chm_nosuch, 0 }, /* 0x12 */ | |
1194 | {chm_nosuch, 0 }, /* 0x13 */ | |
1195 | {chm_nosuch, 0 }, /* 0x14 */ | |
1196 | {chm_nosuch, 0 }, /* 0x15 */ | |
1197 | {chm_nosuch, 0 }, /* 0x16 */ | |
1198 | {chm_nosuch, 0 }, /* 0x17 */ | |
1199 | {chm_nosuch, 0 }, /* 0x18 */ | |
1200 | {chm_nosuch, 0 }, /* 0x19 */ | |
1201 | {chm_nosuch, 0 }, /* 0x1a */ | |
1202 | {chm_nosuch, 0 }, /* 0x1b */ | |
1203 | {chm_nosuch, 0 }, /* 0x1c */ | |
1204 | {chm_nosuch, 0 }, /* 0x1d */ | |
1205 | {chm_nosuch, 0 }, /* 0x1e */ | |
1206 | {chm_nosuch, 0 }, /* 0x1f */ | |
1207 | {chm_nosuch, 0 }, /* 0x20 */ | |
1208 | {chm_nosuch, 0 }, /* 0x21 */ | |
1209 | {chm_nosuch, 0 }, /* 0x22 */ | |
1210 | {chm_nosuch, 0 }, /* 0x23 */ | |
1211 | {chm_nosuch, 0 }, /* 0x24 */ | |
1212 | {chm_nosuch, 0 }, /* 0x25 */ | |
1213 | {chm_nosuch, 0 }, /* 0x26 */ | |
1214 | {chm_nosuch, 0 }, /* 0x27 */ | |
1215 | {chm_nosuch, 0 }, /* 0x28 */ | |
1216 | {chm_nosuch, 0 }, /* 0x29 */ | |
1217 | {chm_nosuch, 0 }, /* 0x2a */ | |
1218 | {chm_nosuch, 0 }, /* 0x2b */ | |
1219 | {chm_nosuch, 0 }, /* 0x2c */ | |
1220 | {chm_nosuch, 0 }, /* 0x2d */ | |
1221 | {chm_nosuch, 0 }, /* 0x2e */ | |
1222 | {chm_nosuch, 0 }, /* 0x2f */ | |
1223 | {chm_nosuch, 0 }, /* 0x30 */ | |
1224 | {chm_nosuch, 0 }, /* 0x31 */ | |
1225 | {chm_nosuch, 0 }, /* 0x32 */ | |
1226 | {chm_nosuch, 0 }, /* 0x33 */ | |
1227 | {chm_nosuch, 0 }, /* 0x34 */ | |
1228 | {chm_nosuch, 0 }, /* 0x35 */ | |
1229 | {chm_nosuch, 0 }, /* 0x36 */ | |
1230 | {chm_nosuch, 0 }, /* 0x37 */ | |
1231 | {chm_nosuch, 0 }, /* 0x38 */ | |
1232 | {chm_nosuch, 0 }, /* 0x39 */ | |
1233 | {chm_nosuch, 0 }, /* 0x3a */ | |
1234 | {chm_nosuch, 0 }, /* 0x3b */ | |
1235 | {chm_nosuch, 0 }, /* 0x3c */ | |
1236 | {chm_nosuch, 0 }, /* 0x3d */ | |
1237 | {chm_nosuch, 0 }, /* 0x3e */ | |
1238 | {chm_nosuch, 0 }, /* 0x3f */ | |
1239 | ||
1240 | {chm_nosuch, 0 }, /* @ */ | |
1241 | {chm_nosuch, 0 }, /* A */ | |
1242 | {chm_nosuch, 0 }, /* B */ | |
1243 | {chm_nosuch, 0 }, /* C */ | |
1244 | {chm_nosuch, 0 }, /* D */ | |
1245 | {chm_nosuch, 0 }, /* E */ | |
1246 | {chm_simple, MODE_FREETARGET }, /* F */ | |
1247 | {chm_nosuch, 0 }, /* G */ | |
1248 | {chm_nosuch, 0 }, /* H */ | |
1249 | {chm_ban, CHFL_INVEX }, /* I */ | |
1250 | {chm_nosuch, 0 }, /* J */ | |
1251 | {chm_nosuch, 0 }, /* K */ | |
1252 | {chm_staff, MODE_EXLIMIT }, /* L */ | |
1253 | {chm_nosuch, 0 }, /* M */ | |
1254 | {chm_nosuch, 0 }, /* N */ | |
1255 | {chm_nosuch, 0 }, /* O */ | |
1256 | {chm_staff, MODE_PERMANENT }, /* P */ | |
1257 | {chm_simple, MODE_DISFORWARD }, /* Q */ | |
1258 | {chm_nosuch, 0 }, /* R */ | |
1259 | {chm_nosuch, 0 }, /* S */ | |
1260 | {chm_nosuch, 0 }, /* T */ | |
1261 | {chm_nosuch, 0 }, /* U */ | |
1262 | {chm_nosuch, 0 }, /* V */ | |
1263 | {chm_nosuch, 0 }, /* W */ | |
1264 | {chm_nosuch, 0 }, /* X */ | |
1265 | {chm_nosuch, 0 }, /* Y */ | |
1266 | {chm_nosuch, 0 }, /* Z */ | |
1267 | {chm_nosuch, 0 }, | |
1268 | {chm_nosuch, 0 }, | |
1269 | {chm_nosuch, 0 }, | |
1270 | {chm_nosuch, 0 }, | |
1271 | {chm_nosuch, 0 }, | |
1272 | {chm_nosuch, 0 }, | |
1273 | {chm_nosuch, 0 }, /* a */ | |
1274 | {chm_ban, CHFL_BAN }, /* b */ | |
1275 | {chm_simple, MODE_NOCOLOR }, /* c */ | |
1276 | {chm_nosuch, 0 }, /* d */ | |
1277 | {chm_ban, CHFL_EXCEPTION }, /* e */ | |
1278 | {chm_forward, 0 }, /* f */ | |
1279 | {chm_simple, MODE_FREEINVITE }, /* g */ | |
1280 | {chm_nosuch, 0 }, /* h */ | |
1281 | {chm_simple, MODE_INVITEONLY }, /* i */ | |
1282 | {chm_throttle, 0 }, /* j */ | |
1283 | {chm_key, 0 }, /* k */ | |
1284 | {chm_limit, 0 }, /* l */ | |
1285 | {chm_simple, MODE_MODERATED }, /* m */ | |
1286 | {chm_simple, MODE_NOPRIVMSGS }, /* n */ | |
1287 | {chm_op, 0 }, /* o */ | |
1288 | {chm_simple, MODE_PRIVATE }, /* p */ | |
1289 | {chm_ban, CHFL_QUIET }, /* q */ | |
1290 | {chm_regonly, 0 }, /* r */ | |
1291 | {chm_simple, MODE_SECRET }, /* s */ | |
1292 | {chm_simple, MODE_TOPICLIMIT }, /* t */ | |
1293 | {chm_nosuch, 0 }, /* u */ | |
1294 | {chm_voice, 0 }, /* v */ | |
1295 | {chm_nosuch, 0 }, /* w */ | |
1296 | {chm_nosuch, 0 }, /* x */ | |
1297 | {chm_nosuch, 0 }, /* y */ | |
1298 | {chm_simple, MODE_OPMODERATE }, /* z */ | |
1299 | ||
1300 | {chm_nosuch, 0 }, /* 0x7b */ | |
1301 | {chm_nosuch, 0 }, /* 0x7c */ | |
1302 | {chm_nosuch, 0 }, /* 0x7d */ | |
1303 | {chm_nosuch, 0 }, /* 0x7e */ | |
1304 | {chm_nosuch, 0 }, /* 0x7f */ | |
1305 | ||
1306 | {chm_nosuch, 0 }, /* 0x80 */ | |
1307 | {chm_nosuch, 0 }, /* 0x81 */ | |
1308 | {chm_nosuch, 0 }, /* 0x82 */ | |
1309 | {chm_nosuch, 0 }, /* 0x83 */ | |
1310 | {chm_nosuch, 0 }, /* 0x84 */ | |
1311 | {chm_nosuch, 0 }, /* 0x85 */ | |
1312 | {chm_nosuch, 0 }, /* 0x86 */ | |
1313 | {chm_nosuch, 0 }, /* 0x87 */ | |
1314 | {chm_nosuch, 0 }, /* 0x88 */ | |
1315 | {chm_nosuch, 0 }, /* 0x89 */ | |
1316 | {chm_nosuch, 0 }, /* 0x8a */ | |
1317 | {chm_nosuch, 0 }, /* 0x8b */ | |
1318 | {chm_nosuch, 0 }, /* 0x8c */ | |
1319 | {chm_nosuch, 0 }, /* 0x8d */ | |
1320 | {chm_nosuch, 0 }, /* 0x8e */ | |
1321 | {chm_nosuch, 0 }, /* 0x8f */ | |
1322 | ||
1323 | {chm_nosuch, 0 }, /* 0x90 */ | |
1324 | {chm_nosuch, 0 }, /* 0x91 */ | |
1325 | {chm_nosuch, 0 }, /* 0x92 */ | |
1326 | {chm_nosuch, 0 }, /* 0x93 */ | |
1327 | {chm_nosuch, 0 }, /* 0x94 */ | |
1328 | {chm_nosuch, 0 }, /* 0x95 */ | |
1329 | {chm_nosuch, 0 }, /* 0x96 */ | |
1330 | {chm_nosuch, 0 }, /* 0x97 */ | |
1331 | {chm_nosuch, 0 }, /* 0x98 */ | |
1332 | {chm_nosuch, 0 }, /* 0x99 */ | |
1333 | {chm_nosuch, 0 }, /* 0x9a */ | |
1334 | {chm_nosuch, 0 }, /* 0x9b */ | |
1335 | {chm_nosuch, 0 }, /* 0x9c */ | |
1336 | {chm_nosuch, 0 }, /* 0x9d */ | |
1337 | {chm_nosuch, 0 }, /* 0x9e */ | |
1338 | {chm_nosuch, 0 }, /* 0x9f */ | |
1339 | ||
1340 | {chm_nosuch, 0 }, /* 0xa0 */ | |
1341 | {chm_nosuch, 0 }, /* 0xa1 */ | |
1342 | {chm_nosuch, 0 }, /* 0xa2 */ | |
1343 | {chm_nosuch, 0 }, /* 0xa3 */ | |
1344 | {chm_nosuch, 0 }, /* 0xa4 */ | |
1345 | {chm_nosuch, 0 }, /* 0xa5 */ | |
1346 | {chm_nosuch, 0 }, /* 0xa6 */ | |
1347 | {chm_nosuch, 0 }, /* 0xa7 */ | |
1348 | {chm_nosuch, 0 }, /* 0xa8 */ | |
1349 | {chm_nosuch, 0 }, /* 0xa9 */ | |
1350 | {chm_nosuch, 0 }, /* 0xaa */ | |
1351 | {chm_nosuch, 0 }, /* 0xab */ | |
1352 | {chm_nosuch, 0 }, /* 0xac */ | |
1353 | {chm_nosuch, 0 }, /* 0xad */ | |
1354 | {chm_nosuch, 0 }, /* 0xae */ | |
1355 | {chm_nosuch, 0 }, /* 0xaf */ | |
1356 | ||
1357 | {chm_nosuch, 0 }, /* 0xb0 */ | |
1358 | {chm_nosuch, 0 }, /* 0xb1 */ | |
1359 | {chm_nosuch, 0 }, /* 0xb2 */ | |
1360 | {chm_nosuch, 0 }, /* 0xb3 */ | |
1361 | {chm_nosuch, 0 }, /* 0xb4 */ | |
1362 | {chm_nosuch, 0 }, /* 0xb5 */ | |
1363 | {chm_nosuch, 0 }, /* 0xb6 */ | |
1364 | {chm_nosuch, 0 }, /* 0xb7 */ | |
1365 | {chm_nosuch, 0 }, /* 0xb8 */ | |
1366 | {chm_nosuch, 0 }, /* 0xb9 */ | |
1367 | {chm_nosuch, 0 }, /* 0xba */ | |
1368 | {chm_nosuch, 0 }, /* 0xbb */ | |
1369 | {chm_nosuch, 0 }, /* 0xbc */ | |
1370 | {chm_nosuch, 0 }, /* 0xbd */ | |
1371 | {chm_nosuch, 0 }, /* 0xbe */ | |
1372 | {chm_nosuch, 0 }, /* 0xbf */ | |
1373 | ||
1374 | {chm_nosuch, 0 }, /* 0xc0 */ | |
1375 | {chm_nosuch, 0 }, /* 0xc1 */ | |
1376 | {chm_nosuch, 0 }, /* 0xc2 */ | |
1377 | {chm_nosuch, 0 }, /* 0xc3 */ | |
1378 | {chm_nosuch, 0 }, /* 0xc4 */ | |
1379 | {chm_nosuch, 0 }, /* 0xc5 */ | |
1380 | {chm_nosuch, 0 }, /* 0xc6 */ | |
1381 | {chm_nosuch, 0 }, /* 0xc7 */ | |
1382 | {chm_nosuch, 0 }, /* 0xc8 */ | |
1383 | {chm_nosuch, 0 }, /* 0xc9 */ | |
1384 | {chm_nosuch, 0 }, /* 0xca */ | |
1385 | {chm_nosuch, 0 }, /* 0xcb */ | |
1386 | {chm_nosuch, 0 }, /* 0xcc */ | |
1387 | {chm_nosuch, 0 }, /* 0xcd */ | |
1388 | {chm_nosuch, 0 }, /* 0xce */ | |
1389 | {chm_nosuch, 0 }, /* 0xcf */ | |
1390 | ||
1391 | {chm_nosuch, 0 }, /* 0xd0 */ | |
1392 | {chm_nosuch, 0 }, /* 0xd1 */ | |
1393 | {chm_nosuch, 0 }, /* 0xd2 */ | |
1394 | {chm_nosuch, 0 }, /* 0xd3 */ | |
1395 | {chm_nosuch, 0 }, /* 0xd4 */ | |
1396 | {chm_nosuch, 0 }, /* 0xd5 */ | |
1397 | {chm_nosuch, 0 }, /* 0xd6 */ | |
1398 | {chm_nosuch, 0 }, /* 0xd7 */ | |
1399 | {chm_nosuch, 0 }, /* 0xd8 */ | |
1400 | {chm_nosuch, 0 }, /* 0xd9 */ | |
1401 | {chm_nosuch, 0 }, /* 0xda */ | |
1402 | {chm_nosuch, 0 }, /* 0xdb */ | |
1403 | {chm_nosuch, 0 }, /* 0xdc */ | |
1404 | {chm_nosuch, 0 }, /* 0xdd */ | |
1405 | {chm_nosuch, 0 }, /* 0xde */ | |
1406 | {chm_nosuch, 0 }, /* 0xdf */ | |
1407 | ||
1408 | {chm_nosuch, 0 }, /* 0xe0 */ | |
1409 | {chm_nosuch, 0 }, /* 0xe1 */ | |
1410 | {chm_nosuch, 0 }, /* 0xe2 */ | |
1411 | {chm_nosuch, 0 }, /* 0xe3 */ | |
1412 | {chm_nosuch, 0 }, /* 0xe4 */ | |
1413 | {chm_nosuch, 0 }, /* 0xe5 */ | |
1414 | {chm_nosuch, 0 }, /* 0xe6 */ | |
1415 | {chm_nosuch, 0 }, /* 0xe7 */ | |
1416 | {chm_nosuch, 0 }, /* 0xe8 */ | |
1417 | {chm_nosuch, 0 }, /* 0xe9 */ | |
1418 | {chm_nosuch, 0 }, /* 0xea */ | |
1419 | {chm_nosuch, 0 }, /* 0xeb */ | |
1420 | {chm_nosuch, 0 }, /* 0xec */ | |
1421 | {chm_nosuch, 0 }, /* 0xed */ | |
1422 | {chm_nosuch, 0 }, /* 0xee */ | |
1423 | {chm_nosuch, 0 }, /* 0xef */ | |
1424 | ||
1425 | {chm_nosuch, 0 }, /* 0xf0 */ | |
1426 | {chm_nosuch, 0 }, /* 0xf1 */ | |
1427 | {chm_nosuch, 0 }, /* 0xf2 */ | |
1428 | {chm_nosuch, 0 }, /* 0xf3 */ | |
1429 | {chm_nosuch, 0 }, /* 0xf4 */ | |
1430 | {chm_nosuch, 0 }, /* 0xf5 */ | |
1431 | {chm_nosuch, 0 }, /* 0xf6 */ | |
1432 | {chm_nosuch, 0 }, /* 0xf7 */ | |
1433 | {chm_nosuch, 0 }, /* 0xf8 */ | |
1434 | {chm_nosuch, 0 }, /* 0xf9 */ | |
1435 | {chm_nosuch, 0 }, /* 0xfa */ | |
1436 | {chm_nosuch, 0 }, /* 0xfb */ | |
1437 | {chm_nosuch, 0 }, /* 0xfc */ | |
1438 | {chm_nosuch, 0 }, /* 0xfd */ | |
1439 | {chm_nosuch, 0 }, /* 0xfe */ | |
1440 | {chm_nosuch, 0 }, /* 0xff */ | |
1441 | }; | |
1442 | ||
1443 | /* *INDENT-ON* */ | |
1444 | ||
1445 | /* set_channel_mode() | |
1446 | * | |
1447 | * inputs - client, source, channel, membership pointer, params | |
1448 | * output - | |
1449 | * side effects - channel modes/memberships are changed, MODE is issued | |
1450 | * | |
1451 | * Extensively modified to be hotpluggable, 03/09/06 -- nenolod | |
1452 | */ | |
1453 | void | |
1454 | set_channel_mode(struct Client *client_p, struct Client *source_p, | |
1455 | struct Channel *chptr, struct membership *msptr, int parc, const char *parv[]) | |
1456 | { | |
1457 | static char modebuf[BUFSIZE]; | |
1458 | static char parabuf[BUFSIZE]; | |
1459 | char *mbuf; | |
1460 | char *pbuf; | |
1461 | int cur_len, mlen, paralen, paracount, arglen, len; | |
1462 | int i, j, flags; | |
1463 | int dir = MODE_ADD; | |
1464 | int parn = 1; | |
1465 | int errors = 0; | |
1466 | int alevel; | |
1467 | const char *ml = parv[0]; | |
1468 | char c; | |
1469 | struct Client *fakesource_p; | |
1470 | ||
1471 | mask_pos = 0; | |
1472 | mode_count = 0; | |
1473 | mode_limit = 0; | |
1474 | ||
1475 | alevel = get_channel_access(source_p, msptr); | |
1476 | ||
1477 | /* Hide connecting server on netburst -- jilles */ | |
1478 | if (ConfigServerHide.flatten_links && IsServer(source_p) && !has_id(source_p) && !HasSentEob(source_p)) | |
1479 | fakesource_p = &me; | |
1480 | else | |
1481 | fakesource_p = source_p; | |
1482 | ||
1483 | for(; (c = *ml) != 0; ml++) | |
1484 | { | |
1485 | switch (c) | |
1486 | { | |
1487 | case '+': | |
1488 | dir = MODE_ADD; | |
1489 | break; | |
1490 | case '-': | |
1491 | dir = MODE_DEL; | |
1492 | break; | |
1493 | case '=': | |
1494 | dir = MODE_QUERY; | |
1495 | break; | |
1496 | default: | |
1497 | chmode_table[(unsigned char) c].set_func(fakesource_p, chptr, alevel, | |
1498 | parc, &parn, parv, | |
1499 | &errors, dir, c, | |
1500 | chmode_table[(unsigned char) c].mode_type); | |
1501 | break; | |
1502 | } | |
1503 | } | |
1504 | ||
1505 | /* bail out if we have nothing to do... */ | |
1506 | if(!mode_count) | |
1507 | return; | |
1508 | ||
1509 | if(IsServer(source_p)) | |
1510 | mlen = ircsprintf(modebuf, ":%s MODE %s ", fakesource_p->name, chptr->chname); | |
1511 | else | |
1512 | mlen = ircsprintf(modebuf, ":%s!%s@%s MODE %s ", | |
1513 | source_p->name, source_p->username, | |
1514 | source_p->host, chptr->chname); | |
1515 | ||
1516 | for(j = 0, flags = ALL_MEMBERS; j < 2; j++, flags = ONLY_CHANOPS) | |
1517 | { | |
1518 | cur_len = mlen; | |
1519 | mbuf = modebuf + mlen; | |
1520 | pbuf = parabuf; | |
1521 | parabuf[0] = '\0'; | |
1522 | paracount = paralen = 0; | |
1523 | dir = MODE_QUERY; | |
1524 | ||
1525 | for(i = 0; i < mode_count; i++) | |
1526 | { | |
1527 | if(mode_changes[i].letter == 0 || mode_changes[i].mems != flags) | |
1528 | continue; | |
1529 | ||
1530 | if(mode_changes[i].arg != NULL) | |
1531 | { | |
1532 | arglen = strlen(mode_changes[i].arg); | |
1533 | ||
1534 | if(arglen > MODEBUFLEN - 5) | |
1535 | continue; | |
1536 | } | |
1537 | else | |
1538 | arglen = 0; | |
1539 | ||
1540 | /* if we're creeping over MAXMODEPARAMSSERV, or over | |
1541 | * bufsize (4 == +/-,modechar,two spaces) send now. | |
1542 | */ | |
1543 | if(mode_changes[i].arg != NULL && | |
1544 | ((paracount == MAXMODEPARAMSSERV) || | |
1545 | ((cur_len + paralen + arglen + 4) > (BUFSIZE - 3)))) | |
1546 | { | |
1547 | *mbuf = '\0'; | |
1548 | ||
1549 | if(cur_len > mlen) | |
1550 | sendto_channel_local(flags, chptr, "%s %s", modebuf, | |
1551 | parabuf); | |
1552 | else | |
1553 | continue; | |
1554 | ||
1555 | paracount = paralen = 0; | |
1556 | cur_len = mlen; | |
1557 | mbuf = modebuf + mlen; | |
1558 | pbuf = parabuf; | |
1559 | parabuf[0] = '\0'; | |
1560 | dir = MODE_QUERY; | |
1561 | } | |
1562 | ||
1563 | if(dir != mode_changes[i].dir) | |
1564 | { | |
1565 | *mbuf++ = (mode_changes[i].dir == MODE_ADD) ? '+' : '-'; | |
1566 | cur_len++; | |
1567 | dir = mode_changes[i].dir; | |
1568 | } | |
1569 | ||
1570 | *mbuf++ = mode_changes[i].letter; | |
1571 | cur_len++; | |
1572 | ||
1573 | if(mode_changes[i].arg != NULL) | |
1574 | { | |
1575 | paracount++; | |
1576 | len = ircsprintf(pbuf, "%s ", mode_changes[i].arg); | |
1577 | pbuf += len; | |
1578 | paralen += len; | |
1579 | } | |
1580 | } | |
1581 | ||
1582 | if(paralen && parabuf[paralen - 1] == ' ') | |
1583 | parabuf[paralen - 1] = '\0'; | |
1584 | ||
1585 | *mbuf = '\0'; | |
1586 | if(cur_len > mlen) | |
1587 | sendto_channel_local(flags, chptr, "%s %s", modebuf, parabuf); | |
1588 | } | |
1589 | ||
1590 | /* only propagate modes originating locally, or if we're hubbing */ | |
1591 | if(MyClient(source_p) || dlink_list_length(&serv_list) > 1) | |
1592 | send_cap_mode_changes(client_p, source_p, chptr, mode_changes, mode_count); | |
1593 | } |