ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/svn/ircd-hybrid/trunk/src/channel_mode.c
Revision: 2941
Committed: Sun Jan 26 12:54:13 2014 UTC (12 years, 8 months ago) by michael
Content type: text/x-csrc
File size: 54716 byte(s)
Error occurred while calculating annotation data.
Log Message:
- channel_mode.c:get_channel_access(): constification

File Contents

# Content
1 /*
2 * ircd-hybrid: an advanced, lightweight Internet Relay Chat Daemon (ircd)
3 *
4 * Copyright (c) 1997-2014 ircd-hybrid development team
5 *
6 * This program is free software; you can redistribute it and/or modify
7 * it under the terms of the GNU General Public License as published by
8 * the Free Software Foundation; either version 2 of the License, or
9 * (at your option) any later version.
10 *
11 * This program is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 * GNU General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with this program; if not, write to the Free Software
18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
19 * USA
20 */
21
22 /*! \file channel_mode.c
23 * \brief Controls modes on channels.
24 * \version $Id$
25 */
26
27 #include "stdinc.h"
28 #include "list.h"
29 #include "channel.h"
30 #include "channel_mode.h"
31 #include "client.h"
32 #include "conf.h"
33 #include "hostmask.h"
34 #include "irc_string.h"
35 #include "ircd.h"
36 #include "numeric.h"
37 #include "s_serv.h"
38 #include "s_user.h"
39 #include "send.h"
40 #include "memory.h"
41 #include "mempool.h"
42 #include "parse.h"
43
44 /* 10 is a magic number in hybrid 6 NFI where it comes from -db */
45 #define BAN_FUDGE 10
46 #define NCHCAPS (sizeof(channel_capabs)/sizeof(int))
47 #define NCHCAP_COMBOS (1 << NCHCAPS)
48
49
50 static char nuh_mask[MAXPARA][IRCD_BUFSIZE];
51 /* some buffers for rebuilding channel/nick lists with ,'s */
52 static char modebuf[IRCD_BUFSIZE];
53 static char parabuf[MODEBUFLEN];
54 static struct ChModeChange mode_changes[IRCD_BUFSIZE];
55 static int mode_count;
56 static int mode_limit; /* number of modes set other than simple */
57 static int simple_modes_mask; /* bit mask of simple modes already set */
58 #ifdef HALFOPS
59 static int channel_capabs[] = { CAP_EX, CAP_IE, CAP_TS6, CAP_HOPS };
60 #else
61 static int channel_capabs[] = { CAP_EX, CAP_IE, CAP_TS6 };
62 #endif
63 static struct ChCapCombo chcap_combos[NCHCAP_COMBOS];
64 extern mp_pool_t *ban_pool;
65
66
67 /* check_string()
68 *
69 * inputs - string to check
70 * output - pointer to modified string
71 * side effects - Fixes a string so that the first white space found
72 * becomes an end of string marker (`\0`).
73 * returns the 'fixed' string or "*" if the string
74 * was NULL length or a NULL pointer.
75 */
76 static char *
77 check_string(char *s)
78 {
79 char *str = s;
80 static char star[] = "*";
81
82 if (EmptyString(str))
83 return star;
84
85 for (; *s; ++s)
86 {
87 if (IsSpace(*s))
88 {
89 *s = '\0';
90 break;
91 }
92 }
93
94 return EmptyString(str) ? star : str;
95 }
96
97 /*
98 * Ban functions to work with mode +b/e/d/I
99 */
100 /* add the specified ID to the channel.
101 * -is 8/9/00
102 */
103
104 int
105 add_id(struct Client *client_p, struct Channel *chptr, char *banid, int type)
106 {
107 dlink_list *list = NULL;
108 dlink_node *ban = NULL;
109 size_t len = 0;
110 struct Ban *ban_p = NULL;
111 unsigned int num_mask;
112 char name[NICKLEN + 1];
113 char user[USERLEN + 1];
114 char host[HOSTLEN + 1];
115 struct split_nuh_item nuh;
116
117 /* dont let local clients overflow the b/e/I lists */
118 if (MyClient(client_p))
119 {
120 num_mask = dlink_list_length(&chptr->banlist) +
121 dlink_list_length(&chptr->exceptlist) +
122 dlink_list_length(&chptr->invexlist);
123
124 if (num_mask >= ConfigChannel.max_bans)
125 {
126 sendto_one(client_p, form_str(ERR_BANLISTFULL),
127 me.name, client_p->name, chptr->chname, banid);
128 return 0;
129 }
130
131 collapse(banid);
132 }
133
134 nuh.nuhmask = check_string(banid);
135 nuh.nickptr = name;
136 nuh.userptr = user;
137 nuh.hostptr = host;
138
139 nuh.nicksize = sizeof(name);
140 nuh.usersize = sizeof(user);
141 nuh.hostsize = sizeof(host);
142
143 split_nuh(&nuh);
144
145 /*
146 * Re-assemble a new n!u@h and print it back to banid for sending
147 * the mode to the channel.
148 */
149 len = sprintf(banid, "%s!%s@%s", name, user, host);
150
151 switch (type)
152 {
153 case CHFL_BAN:
154 list = &chptr->banlist;
155 clear_ban_cache(chptr);
156 break;
157 case CHFL_EXCEPTION:
158 list = &chptr->exceptlist;
159 clear_ban_cache(chptr);
160 break;
161 case CHFL_INVEX:
162 list = &chptr->invexlist;
163 break;
164 default:
165 assert(0);
166 return 0;
167 }
168
169 DLINK_FOREACH(ban, list->head)
170 {
171 ban_p = ban->data;
172
173 if (!irccmp(ban_p->name, name) &&
174 !irccmp(ban_p->user, user) &&
175 !irccmp(ban_p->host, host))
176 return 0;
177 }
178
179 ban_p = mp_pool_get(ban_pool);
180 memset(ban_p, 0, sizeof(*ban_p));
181 ban_p->name = xstrdup(name);
182 ban_p->user = xstrdup(user);
183 ban_p->host = xstrdup(host);
184 ban_p->when = CurrentTime;
185 ban_p->len = len - 2; /* -2 for @ and ! */
186 ban_p->type = parse_netmask(host, &ban_p->addr, &ban_p->bits);
187
188 if (IsClient(client_p))
189 {
190 ban_p->who = MyMalloc(strlen(client_p->name) +
191 strlen(client_p->username) +
192 strlen(client_p->host) + 3);
193 sprintf(ban_p->who, "%s!%s@%s", client_p->name,
194 client_p->username, client_p->host);
195 }
196 else if (IsHidden(client_p) || (IsServer(client_p) && ConfigServerHide.hide_servers))
197 ban_p->who = xstrdup(me.name);
198 else
199 ban_p->who = xstrdup(client_p->name);
200
201 dlinkAdd(ban_p, &ban_p->node, list);
202
203 return 1;
204 }
205
206 /*
207 * inputs - pointer to channel
208 * - pointer to ban id
209 * - type of ban, i.e. ban, exception, invex
210 * output - 0 for failure, 1 for success
211 * side effects -
212 */
213 static int
214 del_id(struct Channel *chptr, char *banid, int type)
215 {
216 dlink_list *list;
217 dlink_node *ban;
218 struct Ban *banptr;
219 char name[NICKLEN + 1];
220 char user[USERLEN + 1];
221 char host[HOSTLEN + 1];
222 struct split_nuh_item nuh;
223
224 assert(banid);
225
226 nuh.nuhmask = check_string(banid);
227 nuh.nickptr = name;
228 nuh.userptr = user;
229 nuh.hostptr = host;
230
231 nuh.nicksize = sizeof(name);
232 nuh.usersize = sizeof(user);
233 nuh.hostsize = sizeof(host);
234
235 split_nuh(&nuh);
236
237 /*
238 * Re-assemble a new n!u@h and print it back to banid for sending
239 * the mode to the channel.
240 */
241 sprintf(banid, "%s!%s@%s", name, user, host);
242
243 switch (type)
244 {
245 case CHFL_BAN:
246 list = &chptr->banlist;
247 clear_ban_cache(chptr);
248 break;
249 case CHFL_EXCEPTION:
250 list = &chptr->exceptlist;
251 clear_ban_cache(chptr);
252 break;
253 case CHFL_INVEX:
254 list = &chptr->invexlist;
255 break;
256 default:
257 assert(0);
258 return 0;
259 }
260
261 DLINK_FOREACH(ban, list->head)
262 {
263 banptr = ban->data;
264
265 if (!irccmp(name, banptr->name) &&
266 !irccmp(user, banptr->user) &&
267 !irccmp(host, banptr->host))
268 {
269 remove_ban(banptr, list);
270 return 1;
271 }
272 }
273
274 return 0;
275 }
276
277 const struct mode_letter chan_modes[] =
278 {
279 { MODE_NOCTRL, 'c' },
280 { MODE_INVITEONLY, 'i' },
281 { MODE_MODERATED, 'm' },
282 { MODE_NOPRIVMSGS, 'n' },
283 { MODE_PRIVATE, 'p' },
284 { MODE_REGISTERED, 'r' },
285 { MODE_SECRET, 's' },
286 { MODE_TOPICLIMIT, 't' },
287 { MODE_MODREG, 'M' },
288 { MODE_OPERONLY, 'O' },
289 { MODE_REGONLY, 'R' },
290 { MODE_SSLONLY, 'S' },
291 { 0, '\0' }
292 };
293
294 /* channel_modes()
295 *
296 * inputs - pointer to channel
297 * - pointer to client
298 * - pointer to mode buf
299 * - pointer to parameter buf
300 * output - NONE
301 * side effects - write the "simple" list of channel modes for channel
302 * chptr onto buffer mbuf with the parameters in pbuf.
303 */
304 void
305 channel_modes(struct Channel *chptr, struct Client *client_p,
306 char *mbuf, char *pbuf)
307 {
308 const struct mode_letter *tab = chan_modes;
309
310 *mbuf++ = '+';
311 *pbuf = '\0';
312
313 for (; tab->mode; ++tab)
314 if (chptr->mode.mode & tab->mode)
315 *mbuf++ = tab->letter;
316
317 if (chptr->mode.limit)
318 {
319 *mbuf++ = 'l';
320
321 if (IsServer(client_p) || HasFlag(client_p, FLAGS_SERVICE) || IsMember(client_p, chptr))
322 pbuf += sprintf(pbuf, "%d ", chptr->mode.limit);
323 }
324
325 if (chptr->mode.key[0])
326 {
327 *mbuf++ = 'k';
328
329 if (IsServer(client_p) || HasFlag(client_p, FLAGS_SERVICE) || IsMember(client_p, chptr))
330 sprintf(pbuf, "%s ", chptr->mode.key);
331 }
332
333 *mbuf = '\0';
334 }
335
336 /* fix_key()
337 *
338 * inputs - pointer to key to clean up
339 * output - pointer to cleaned up key
340 * side effects - input string is modified
341 *
342 * stolen from Undernet's ircd -orabidoo
343 */
344 static char *
345 fix_key(char *arg)
346 {
347 unsigned char *s, *t, c;
348
349 for (s = t = (unsigned char *)arg; (c = *s); s++)
350 {
351 c &= 0x7f;
352
353 if (c != ':' && c > ' ' && c != ',')
354 *t++ = c;
355 }
356
357 *t = '\0';
358 return arg;
359 }
360
361 /* fix_key_old()
362 *
363 * inputs - pointer to key to clean up
364 * output - pointer to cleaned up key
365 * side effects - input string is modifed
366 *
367 * Here we attempt to be compatible with older non-hybrid servers.
368 * We can't back down from the ':' issue however. --Rodder
369 */
370 static char *
371 fix_key_old(char *arg)
372 {
373 unsigned char *s, *t, c;
374
375 for (s = t = (unsigned char *)arg; (c = *s); s++)
376 {
377 c &= 0x7f;
378
379 if ((c != 0x0a) && (c != ':') &&
380 (c != 0x0d) && (c != ','))
381 *t++ = c;
382 }
383
384 *t = '\0';
385 return arg;
386 }
387
388 /* bitmasks for various error returns that set_channel_mode should only return
389 * once per call -orabidoo
390 */
391
392 #define SM_ERR_NOTS 0x00000001 /* No TS on channel */
393 #define SM_ERR_NOOPS 0x00000002 /* No chan ops */
394 #define SM_ERR_UNKNOWN 0x00000004
395 #define SM_ERR_RPL_B 0x00000008
396 #define SM_ERR_RPL_E 0x00000010
397 #define SM_ERR_NOTONCHANNEL 0x00000020 /* Not on channel */
398 #define SM_ERR_RPL_I 0x00000040
399 #define SM_ERR_NOTOPER 0x00000080
400 #define SM_ERR_ONLYSERVER 0x00000100
401
402 /* Now lets do some stuff to keep track of what combinations of
403 * servers exist...
404 * Note that the number of combinations doubles each time you add
405 * something to this list. Each one is only quick if no servers use that
406 * combination, but if the numbers get too high here MODE will get too
407 * slow. I suggest if you get more than 7 here, you consider getting rid
408 * of some and merging or something. If it wasn't for irc+cs we would
409 * probably not even need to bother about most of these, but unfortunately
410 * we do. -A1kmm
411 */
412
413 /* void init_chcap_usage_counts(void)
414 *
415 * Inputs - none
416 * Output - none
417 * Side-effects - Initialises the usage counts to zero. Fills in the
418 * chcap_yes and chcap_no combination tables.
419 */
420 void
421 init_chcap_usage_counts(void)
422 {
423 unsigned long m, c, y, n;
424
425 memset(chcap_combos, 0, sizeof(chcap_combos));
426
427 /* For every possible combination */
428 for (m = 0; m < NCHCAP_COMBOS; m++)
429 {
430 /* Check each capab */
431 for (c = y = n = 0; c < NCHCAPS; c++)
432 {
433 if ((m & (1 << c)) == 0)
434 n |= channel_capabs[c];
435 else
436 y |= channel_capabs[c];
437 }
438
439 chcap_combos[m].cap_yes = y;
440 chcap_combos[m].cap_no = n;
441 }
442 }
443
444 /* void set_chcap_usage_counts(struct Client *serv_p)
445 * Input: serv_p; The client whose capabs to register.
446 * Output: none
447 * Side-effects: Increments the usage counts for the correct capab
448 * combination.
449 */
450 void
451 set_chcap_usage_counts(struct Client *serv_p)
452 {
453 int n;
454
455 for (n = 0; n < NCHCAP_COMBOS; n++)
456 {
457 if (((serv_p->localClient->caps & chcap_combos[n].cap_yes) ==
458 chcap_combos[n].cap_yes) &&
459 ((serv_p->localClient->caps & chcap_combos[n].cap_no) == 0))
460 {
461 chcap_combos[n].count++;
462 return;
463 }
464 }
465
466 /* This should be impossible -A1kmm. */
467 assert(0);
468 }
469
470 /* void set_chcap_usage_counts(struct Client *serv_p)
471 *
472 * Inputs - serv_p; The client whose capabs to register.
473 * Output - none
474 * Side-effects - Decrements the usage counts for the correct capab
475 * combination.
476 */
477 void
478 unset_chcap_usage_counts(struct Client *serv_p)
479 {
480 int n;
481
482 for (n = 0; n < NCHCAP_COMBOS; n++)
483 {
484 if ((serv_p->localClient->caps & chcap_combos[n].cap_yes) ==
485 chcap_combos[n].cap_yes &&
486 (serv_p->localClient->caps & chcap_combos[n].cap_no) == 0)
487 {
488 /* Hopefully capabs can't change dynamically or anything... */
489 assert(chcap_combos[n].count > 0);
490 chcap_combos[n].count--;
491 return;
492 }
493 }
494
495 /* This should be impossible -A1kmm. */
496 assert(0);
497 }
498
499 /* Mode functions handle mode changes for a particular mode... */
500 static void
501 chm_nosuch(struct Client *client_p, struct Client *source_p,
502 struct Channel *chptr, int parc, int *parn,
503 char **parv, int *errors, int alev, int dir, char c, unsigned int d)
504 {
505 if (*errors & SM_ERR_UNKNOWN)
506 return;
507
508 *errors |= SM_ERR_UNKNOWN;
509 sendto_one(source_p, form_str(ERR_UNKNOWNMODE), me.name,
510 source_p->name, c);
511 }
512
513 static void
514 chm_simple(struct Client *client_p, struct Client *source_p, struct Channel *chptr,
515 int parc, int *parn, char **parv, int *errors, int alev, int dir,
516 char c, unsigned int d)
517 {
518 if ((alev < CHACCESS_HALFOP) ||
519 ((d == MODE_PRIVATE) && (alev < CHACCESS_CHANOP)))
520 {
521 if (!(*errors & SM_ERR_NOOPS))
522 sendto_one(source_p, form_str(alev == CHACCESS_NOTONCHAN ?
523 ERR_NOTONCHANNEL : ERR_CHANOPRIVSNEEDED),
524 me.name, source_p->name, chptr->chname);
525 *errors |= SM_ERR_NOOPS;
526 return;
527 }
528
529 /* If have already dealt with this simple mode, ignore it */
530 if (simple_modes_mask & d)
531 return;
532
533 simple_modes_mask |= d;
534
535 /* setting + */
536 /* Apparently, (though no one has ever told the hybrid group directly)
537 * admins don't like redundant mode checking. ok. It would have been nice
538 * if you had have told us directly. I've left the original code snippets
539 * in place.
540 *
541 * -Dianora
542 */
543 if (dir == MODE_ADD) /* && !(chptr->mode.mode & d)) */
544 {
545 chptr->mode.mode |= d;
546
547 mode_changes[mode_count].letter = c;
548 mode_changes[mode_count].dir = MODE_ADD;
549 mode_changes[mode_count].caps = 0;
550 mode_changes[mode_count].nocaps = 0;
551 mode_changes[mode_count].id = NULL;
552 mode_changes[mode_count].mems = ALL_MEMBERS;
553 mode_changes[mode_count++].arg = NULL;
554 }
555 else if (dir == MODE_DEL) /* && (chptr->mode.mode & d)) */
556 {
557 /* setting - */
558
559 chptr->mode.mode &= ~d;
560
561 mode_changes[mode_count].letter = c;
562 mode_changes[mode_count].dir = MODE_DEL;
563 mode_changes[mode_count].caps = 0;
564 mode_changes[mode_count].nocaps = 0;
565 mode_changes[mode_count].mems = ALL_MEMBERS;
566 mode_changes[mode_count].id = NULL;
567 mode_changes[mode_count++].arg = NULL;
568 }
569 }
570
571 static void
572 chm_registered(struct Client *client_p, struct Client *source_p, struct Channel *chptr,
573 int parc, int *parn, char **parv, int *errors, int alev, int dir,
574 char c, unsigned int d)
575 {
576 if (!IsServer(source_p) && !HasFlag(source_p, FLAGS_SERVICE))
577 {
578 if (!(*errors & SM_ERR_ONLYSERVER))
579 sendto_one(source_p, form_str(alev == CHACCESS_NOTONCHAN ?
580 ERR_NOTONCHANNEL : ERR_ONLYSERVERSCANCHANGE),
581 me.name, source_p->name, chptr->chname);
582 *errors |= SM_ERR_ONLYSERVER;
583 return;
584 }
585
586 /* If have already dealt with this simple mode, ignore it */
587 if (simple_modes_mask & d)
588 return;
589
590 simple_modes_mask |= d;
591
592 /* setting + */
593 /* Apparently, (though no one has ever told the hybrid group directly)
594 * admins don't like redundant mode checking. ok. It would have been nice
595 * if you had have told us directly. I've left the original code snippets
596 * in place.
597 *
598 * -Dianora
599 */
600 if (dir == MODE_ADD) /* && !(chptr->mode.mode & d)) */
601 {
602 chptr->mode.mode |= d;
603
604 mode_changes[mode_count].letter = c;
605 mode_changes[mode_count].dir = MODE_ADD;
606 mode_changes[mode_count].caps = 0;
607 mode_changes[mode_count].nocaps = 0;
608 mode_changes[mode_count].id = NULL;
609 mode_changes[mode_count].mems = ALL_MEMBERS;
610 mode_changes[mode_count++].arg = NULL;
611 }
612 else if (dir == MODE_DEL) /* && (chptr->mode.mode & d)) */
613 {
614 /* setting - */
615
616 chptr->mode.mode &= ~d;
617
618 mode_changes[mode_count].letter = c;
619 mode_changes[mode_count].dir = MODE_DEL;
620 mode_changes[mode_count].caps = 0;
621 mode_changes[mode_count].nocaps = 0;
622 mode_changes[mode_count].mems = ALL_MEMBERS;
623 mode_changes[mode_count].id = NULL;
624 mode_changes[mode_count++].arg = NULL;
625 }
626 }
627
628 static void
629 chm_operonly(struct Client *client_p, struct Client *source_p, struct Channel *chptr,
630 int parc, int *parn, char **parv, int *errors, int alev, int dir,
631 char c, unsigned int d)
632 {
633 if ((alev < CHACCESS_HALFOP) ||
634 ((d == MODE_PRIVATE) && (alev < CHACCESS_CHANOP)))
635 {
636 if (!(*errors & SM_ERR_NOOPS))
637 sendto_one(source_p, form_str(alev == CHACCESS_NOTONCHAN ?
638 ERR_NOTONCHANNEL : ERR_CHANOPRIVSNEEDED),
639 me.name, source_p->name, chptr->chname);
640 *errors |= SM_ERR_NOOPS;
641 return;
642 }
643 else if (MyClient(source_p) && !HasUMode(source_p, UMODE_OPER))
644 {
645 if (!(*errors & SM_ERR_NOTOPER))
646 {
647 if (alev == CHACCESS_NOTONCHAN)
648 sendto_one(source_p, form_str(ERR_NOTONCHANNEL),
649 me.name, source_p->name, chptr->chname);
650 else
651 sendto_one(source_p, form_str(ERR_NOPRIVILEGES),
652 me.name, source_p->name);
653 }
654
655 *errors |= SM_ERR_NOTOPER;
656 return;
657 }
658
659 /* If have already dealt with this simple mode, ignore it */
660 if (simple_modes_mask & d)
661 return;
662
663 simple_modes_mask |= d;
664
665 if (dir == MODE_ADD) /* && !(chptr->mode.mode & d)) */
666 {
667 chptr->mode.mode |= d;
668
669 mode_changes[mode_count].letter = c;
670 mode_changes[mode_count].dir = MODE_ADD;
671 mode_changes[mode_count].caps = 0;
672 mode_changes[mode_count].nocaps = 0;
673 mode_changes[mode_count].id = NULL;
674 mode_changes[mode_count].mems = ALL_MEMBERS;
675 mode_changes[mode_count].mems = ALL_MEMBERS;
676 mode_changes[mode_count++].arg = NULL;
677 }
678 else if (dir == MODE_DEL) /* && (chptr->mode.mode & d)) */
679 {
680 /* setting - */
681
682 chptr->mode.mode &= ~d;
683
684 mode_changes[mode_count].letter = c;
685 mode_changes[mode_count].dir = MODE_DEL;
686 mode_changes[mode_count].caps = 0;
687 mode_changes[mode_count].nocaps = 0;
688 mode_changes[mode_count].mems = ALL_MEMBERS;
689 mode_changes[mode_count].id = NULL;
690 mode_changes[mode_count++].arg = NULL;
691 }
692 }
693
694 static void
695 chm_ban(struct Client *client_p, struct Client *source_p,
696 struct Channel *chptr, int parc, int *parn,
697 char **parv, int *errors, int alev, int dir, char c, unsigned int d)
698 {
699 char *mask = NULL;
700
701 if (dir == MODE_QUERY || parc <= *parn)
702 {
703 dlink_node *ptr = NULL;
704
705 if (*errors & SM_ERR_RPL_B)
706 return;
707
708 *errors |= SM_ERR_RPL_B;
709
710 DLINK_FOREACH(ptr, chptr->banlist.head)
711 {
712 const struct Ban *banptr = ptr->data;
713 sendto_one(client_p, form_str(RPL_BANLIST),
714 me.name, client_p->name, chptr->chname,
715 banptr->name, banptr->user, banptr->host,
716 banptr->who, banptr->when);
717 }
718
719 sendto_one(source_p, form_str(RPL_ENDOFBANLIST), me.name,
720 source_p->name, chptr->chname);
721 return;
722 }
723
724 if (alev < CHACCESS_HALFOP)
725 {
726 if (!(*errors & SM_ERR_NOOPS))
727 sendto_one(source_p, form_str(alev == CHACCESS_NOTONCHAN ?
728 ERR_NOTONCHANNEL : ERR_CHANOPRIVSNEEDED),
729 me.name, source_p->name, chptr->chname);
730 *errors |= SM_ERR_NOOPS;
731 return;
732 }
733
734 if (MyClient(source_p) && (++mode_limit > MAXMODEPARAMS))
735 return;
736
737 mask = nuh_mask[*parn];
738 memcpy(mask, parv[*parn], sizeof(nuh_mask[*parn]));
739 ++*parn;
740
741 if (IsServer(client_p))
742 if (strchr(mask, ' '))
743 return;
744
745 switch (dir)
746 {
747 case MODE_ADD:
748 if (!add_id(source_p, chptr, mask, CHFL_BAN))
749 return;
750 break;
751 case MODE_DEL:
752 if (!del_id(chptr, mask, CHFL_BAN))
753 return;
754 break;
755 default:
756 assert(0);
757 }
758
759 mode_changes[mode_count].letter = c;
760 mode_changes[mode_count].dir = dir;
761 mode_changes[mode_count].caps = 0;
762 mode_changes[mode_count].nocaps = 0;
763 mode_changes[mode_count].mems = ALL_MEMBERS;
764 mode_changes[mode_count].id = NULL;
765 mode_changes[mode_count++].arg = mask;
766 }
767
768 static void
769 chm_except(struct Client *client_p, struct Client *source_p,
770 struct Channel *chptr, int parc, int *parn,
771 char **parv, int *errors, int alev, int dir, char c, unsigned int d)
772 {
773 char *mask = NULL;
774
775 if (alev < CHACCESS_HALFOP)
776 {
777 if (!(*errors & SM_ERR_NOOPS))
778 sendto_one(source_p, form_str(alev == CHACCESS_NOTONCHAN ?
779 ERR_NOTONCHANNEL : ERR_CHANOPRIVSNEEDED),
780 me.name, source_p->name, chptr->chname);
781 *errors |= SM_ERR_NOOPS;
782 return;
783 }
784
785 if (dir == MODE_QUERY || parc <= *parn)
786 {
787 dlink_node *ptr = NULL;
788
789 if (*errors & SM_ERR_RPL_E)
790 return;
791
792 *errors |= SM_ERR_RPL_E;
793
794 DLINK_FOREACH(ptr, chptr->exceptlist.head)
795 {
796 const struct Ban *banptr = ptr->data;
797 sendto_one(client_p, form_str(RPL_EXCEPTLIST),
798 me.name, client_p->name, chptr->chname,
799 banptr->name, banptr->user, banptr->host,
800 banptr->who, banptr->when);
801 }
802
803 sendto_one(source_p, form_str(RPL_ENDOFEXCEPTLIST), me.name,
804 source_p->name, chptr->chname);
805 return;
806 }
807
808 if (MyClient(source_p) && (++mode_limit > MAXMODEPARAMS))
809 return;
810
811 mask = nuh_mask[*parn];
812 memcpy(mask, parv[*parn], sizeof(nuh_mask[*parn]));
813 ++*parn;
814
815 if (IsServer(client_p))
816 if (strchr(mask, ' '))
817 return;
818
819 switch (dir)
820 {
821 case MODE_ADD:
822 if (!add_id(source_p, chptr, mask, CHFL_EXCEPTION))
823 return;
824 break;
825 case MODE_DEL:
826 if (!del_id(chptr, mask, CHFL_EXCEPTION))
827 return;
828 break;
829 default:
830 assert(0);
831 }
832
833 mode_changes[mode_count].letter = c;
834 mode_changes[mode_count].dir = dir;
835 mode_changes[mode_count].caps = 0;
836 mode_changes[mode_count].nocaps = 0;
837 mode_changes[mode_count].mems = ONLY_CHANOPS;
838 mode_changes[mode_count].id = NULL;
839 mode_changes[mode_count++].arg = mask;
840 }
841
842 static void
843 chm_invex(struct Client *client_p, struct Client *source_p,
844 struct Channel *chptr, int parc, int *parn,
845 char **parv, int *errors, int alev, int dir, char c, unsigned int d)
846 {
847 char *mask = NULL;
848
849 if (alev < CHACCESS_HALFOP)
850 {
851 if (!(*errors & SM_ERR_NOOPS))
852 sendto_one(source_p, form_str(alev == CHACCESS_NOTONCHAN ?
853 ERR_NOTONCHANNEL : ERR_CHANOPRIVSNEEDED),
854 me.name, source_p->name, chptr->chname);
855 *errors |= SM_ERR_NOOPS;
856 return;
857 }
858
859 if (dir == MODE_QUERY || parc <= *parn)
860 {
861 dlink_node *ptr = NULL;
862
863 if (*errors & SM_ERR_RPL_I)
864 return;
865
866 *errors |= SM_ERR_RPL_I;
867
868 DLINK_FOREACH(ptr, chptr->invexlist.head)
869 {
870 const struct Ban *banptr = ptr->data;
871 sendto_one(client_p, form_str(RPL_INVITELIST), me.name,
872 client_p->name, chptr->chname,
873 banptr->name, banptr->user, banptr->host,
874 banptr->who, banptr->when);
875 }
876
877 sendto_one(source_p, form_str(RPL_ENDOFINVITELIST), me.name,
878 source_p->name, chptr->chname);
879 return;
880 }
881
882 if (MyClient(source_p) && (++mode_limit > MAXMODEPARAMS))
883 return;
884
885 mask = nuh_mask[*parn];
886 memcpy(mask, parv[*parn], sizeof(nuh_mask[*parn]));
887 ++*parn;
888
889 if (IsServer(client_p))
890 if (strchr(mask, ' '))
891 return;
892
893 switch (dir)
894 {
895 case MODE_ADD:
896 if (!add_id(source_p, chptr, mask, CHFL_INVEX))
897 return;
898 break;
899 case MODE_DEL:
900 if (!del_id(chptr, mask, CHFL_INVEX))
901 return;
902 break;
903 default:
904 assert(0);
905 }
906
907 mode_changes[mode_count].letter = c;
908 mode_changes[mode_count].dir = dir;
909 mode_changes[mode_count].caps = 0;
910 mode_changes[mode_count].nocaps = 0;
911 mode_changes[mode_count].mems = ONLY_CHANOPS;
912 mode_changes[mode_count].id = NULL;
913 mode_changes[mode_count++].arg = mask;
914 }
915
916 /*
917 * inputs - pointer to channel
918 * output - none
919 * side effects - clear ban cache
920 */
921 void
922 clear_ban_cache(struct Channel *chptr)
923 {
924 dlink_node *ptr = NULL;
925
926 DLINK_FOREACH(ptr, chptr->members.head)
927 {
928 struct Membership *ms = ptr->data;
929
930 if (MyConnect(ms->client_p))
931 ms->flags &= ~(CHFL_BAN_SILENCED|CHFL_BAN_CHECKED);
932 }
933 }
934
935 void
936 clear_ban_cache_client(struct Client *client_p)
937 {
938 dlink_node *ptr = NULL;
939
940 DLINK_FOREACH(ptr, client_p->channel.head)
941 {
942 struct Membership *ms = ptr->data;
943 ms->flags &= ~(CHFL_BAN_SILENCED|CHFL_BAN_CHECKED);
944 }
945 }
946
947 static void
948 chm_op(struct Client *client_p, struct Client *source_p,
949 struct Channel *chptr, int parc, int *parn,
950 char **parv, int *errors, int alev, int dir, char c, unsigned int d)
951 {
952 const char *opnick = NULL;
953 struct Client *targ_p;
954 struct Membership *member;
955 int caps = 0;
956
957 if (alev < CHACCESS_CHANOP)
958 {
959 if (!(*errors & SM_ERR_NOOPS))
960 sendto_one(source_p, form_str(alev == CHACCESS_NOTONCHAN ?
961 ERR_NOTONCHANNEL : ERR_CHANOPRIVSNEEDED),
962 me.name, source_p->name, chptr->chname);
963 *errors |= SM_ERR_NOOPS;
964 return;
965 }
966
967 if ((dir == MODE_QUERY) || (parc <= *parn))
968 return;
969
970 opnick = parv[(*parn)++];
971
972 if ((targ_p = find_chasing(source_p, opnick, NULL)) == NULL)
973 return;
974 if (!IsClient(targ_p))
975 return;
976
977 if ((member = find_channel_link(targ_p, chptr)) == NULL)
978 {
979 if (!(*errors & SM_ERR_NOTONCHANNEL))
980 sendto_one(source_p, form_str(ERR_USERNOTINCHANNEL), me.name,
981 source_p->name, opnick, chptr->chname);
982 *errors |= SM_ERR_NOTONCHANNEL;
983 return;
984 }
985
986 if (MyClient(source_p) && (++mode_limit > MAXMODEPARAMS))
987 return;
988
989 /* no redundant mode changes */
990 if (dir == MODE_ADD && has_member_flags(member, CHFL_CHANOP))
991 return;
992 if (dir == MODE_DEL && !has_member_flags(member, CHFL_CHANOP))
993 {
994 #ifdef HALFOPS
995 if (has_member_flags(member, CHFL_HALFOP))
996 {
997 --*parn;
998 chm_hop(client_p, source_p, chptr, parc, parn, parv, errors, alev,
999 dir, c, d);
1000 }
1001 #endif
1002 return;
1003 }
1004
1005 #ifdef HALFOPS
1006 if (dir == MODE_ADD && has_member_flags(member, CHFL_HALFOP))
1007 {
1008 /* promoting from % to @ is visible only to CAP_HOPS servers */
1009 mode_changes[mode_count].letter = 'h';
1010 mode_changes[mode_count].dir = MODE_DEL;
1011 mode_changes[mode_count].caps = caps = CAP_HOPS;
1012 mode_changes[mode_count].nocaps = 0;
1013 mode_changes[mode_count].mems = ALL_MEMBERS;
1014 mode_changes[mode_count].id = NULL;
1015 mode_changes[mode_count].arg = targ_p->name;
1016 mode_changes[mode_count++].client = targ_p;
1017 }
1018 #endif
1019
1020 mode_changes[mode_count].letter = 'o';
1021 mode_changes[mode_count].dir = dir;
1022 mode_changes[mode_count].caps = caps;
1023 mode_changes[mode_count].nocaps = 0;
1024 mode_changes[mode_count].mems = ALL_MEMBERS;
1025 mode_changes[mode_count].id = targ_p->id;
1026 mode_changes[mode_count].arg = targ_p->name;
1027 mode_changes[mode_count++].client = targ_p;
1028
1029 if (dir == MODE_ADD)
1030 {
1031 AddMemberFlag(member, CHFL_CHANOP);
1032 DelMemberFlag(member, CHFL_DEOPPED | CHFL_HALFOP);
1033 }
1034 else
1035 DelMemberFlag(member, CHFL_CHANOP);
1036 }
1037
1038 #ifdef HALFOPS
1039 static void
1040 chm_hop(struct Client *client_p, struct Client *source_p,
1041 struct Channel *chptr, int parc, int *parn,
1042 char **parv, int *errors, int alev, int dir, char c, unsigned int d)
1043 {
1044 const char *opnick = NULL;
1045 struct Client *targ_p;
1046 struct Membership *member;
1047
1048 /* *sigh* - dont allow halfops to set +/-h, they could fully control a
1049 * channel if there were no ops - it doesnt solve anything.. MODE_PRIVATE
1050 * when used with MODE_SECRET is paranoid - cant use +p
1051 *
1052 * it needs to be optional per channel - but not via +p, that or remove
1053 * paranoid.. -- fl_
1054 *
1055 * +p means paranoid, it is useless for anything else on modern IRC, as
1056 * list isn't really usable. If you want to have a private channel these
1057 * days, you set it +s. Halfops can no longer remove simple modes when
1058 * +p is set (although they can set +p) so it is safe to use this to
1059 * control whether they can (de)halfop...
1060 */
1061 if (alev <
1062 ((chptr->mode.mode & MODE_PRIVATE) ? CHACCESS_CHANOP : CHACCESS_HALFOP))
1063 {
1064 if (!(*errors & SM_ERR_NOOPS))
1065 sendto_one(source_p, form_str(alev == CHACCESS_NOTONCHAN ?
1066 ERR_NOTONCHANNEL : ERR_CHANOPRIVSNEEDED),
1067 me.name, source_p->name, chptr->chname);
1068 *errors |= SM_ERR_NOOPS;
1069 return;
1070 }
1071
1072 if ((dir == MODE_QUERY) || (parc <= *parn))
1073 return;
1074
1075 opnick = parv[(*parn)++];
1076
1077 if ((targ_p = find_chasing(source_p, opnick, NULL)) == NULL)
1078 return;
1079 if (!IsClient(targ_p))
1080 return;
1081
1082 if ((member = find_channel_link(targ_p, chptr)) == NULL)
1083 {
1084 if (!(*errors & SM_ERR_NOTONCHANNEL))
1085 sendto_one(source_p, form_str(ERR_USERNOTINCHANNEL),
1086 me.name, source_p->name, opnick, chptr->chname);
1087 *errors |= SM_ERR_NOTONCHANNEL;
1088 return;
1089 }
1090
1091 if (MyClient(source_p) && (++mode_limit > MAXMODEPARAMS))
1092 return;
1093
1094 /* no redundant mode changes */
1095 if (dir == MODE_ADD && has_member_flags(member, CHFL_HALFOP | CHFL_CHANOP))
1096 return;
1097 if (dir == MODE_DEL && !has_member_flags(member, CHFL_HALFOP))
1098 return;
1099
1100 mode_changes[mode_count].letter = 'h';
1101 mode_changes[mode_count].dir = dir;
1102 mode_changes[mode_count].caps = CAP_HOPS;
1103 mode_changes[mode_count].nocaps = 0;
1104 mode_changes[mode_count].mems = ALL_MEMBERS;
1105 mode_changes[mode_count].id = targ_p->id;
1106 mode_changes[mode_count].arg = targ_p->name;
1107 mode_changes[mode_count++].client = targ_p;
1108
1109 mode_changes[mode_count].letter = 'o';
1110 mode_changes[mode_count].dir = dir;
1111 mode_changes[mode_count].caps = 0;
1112 mode_changes[mode_count].nocaps = CAP_HOPS;
1113 mode_changes[mode_count].mems = ONLY_SERVERS;
1114 mode_changes[mode_count].id = targ_p->id;
1115 mode_changes[mode_count].arg = targ_p->name;
1116 mode_changes[mode_count++].client = targ_p;
1117
1118 if (dir == MODE_ADD)
1119 {
1120 AddMemberFlag(member, CHFL_HALFOP);
1121 DelMemberFlag(member, CHFL_DEOPPED);
1122 }
1123 else
1124 DelMemberFlag(member, CHFL_HALFOP);
1125 }
1126 #endif
1127
1128 static void
1129 chm_voice(struct Client *client_p, struct Client *source_p,
1130 struct Channel *chptr, int parc, int *parn,
1131 char **parv, int *errors, int alev, int dir, char c, unsigned int d)
1132 {
1133 const char *opnick = NULL;
1134 struct Client *targ_p;
1135 struct Membership *member;
1136
1137 if (alev < CHACCESS_HALFOP)
1138 {
1139 if (!(*errors & SM_ERR_NOOPS))
1140 sendto_one(source_p, form_str(alev == CHACCESS_NOTONCHAN ?
1141 ERR_NOTONCHANNEL : ERR_CHANOPRIVSNEEDED),
1142 me.name, source_p->name, chptr->chname);
1143 *errors |= SM_ERR_NOOPS;
1144 return;
1145 }
1146
1147 if ((dir == MODE_QUERY) || parc <= *parn)
1148 return;
1149
1150 opnick = parv[(*parn)++];
1151
1152 if ((targ_p = find_chasing(source_p, opnick, NULL)) == NULL)
1153 return;
1154 if (!IsClient(targ_p))
1155 return;
1156
1157 if ((member = find_channel_link(targ_p, chptr)) == NULL)
1158 {
1159 if (!(*errors & SM_ERR_NOTONCHANNEL))
1160 sendto_one(source_p, form_str(ERR_USERNOTINCHANNEL),
1161 me.name, source_p->name, opnick, chptr->chname);
1162 *errors |= SM_ERR_NOTONCHANNEL;
1163 return;
1164 }
1165
1166 if (MyClient(source_p) && (++mode_limit > MAXMODEPARAMS))
1167 return;
1168
1169 /* no redundant mode changes */
1170 if (dir == MODE_ADD && has_member_flags(member, CHFL_VOICE))
1171 return;
1172 if (dir == MODE_DEL && !has_member_flags(member, CHFL_VOICE))
1173 return;
1174
1175 mode_changes[mode_count].letter = 'v';
1176 mode_changes[mode_count].dir = dir;
1177 mode_changes[mode_count].caps = 0;
1178 mode_changes[mode_count].nocaps = 0;
1179 mode_changes[mode_count].mems = ALL_MEMBERS;
1180 mode_changes[mode_count].id = targ_p->id;
1181 mode_changes[mode_count].arg = targ_p->name;
1182 mode_changes[mode_count++].client = targ_p;
1183
1184 if (dir == MODE_ADD)
1185 AddMemberFlag(member, CHFL_VOICE);
1186 else
1187 DelMemberFlag(member, CHFL_VOICE);
1188 }
1189
1190 static void
1191 chm_limit(struct Client *client_p, struct Client *source_p,
1192 struct Channel *chptr, int parc, int *parn,
1193 char **parv, int *errors, int alev, int dir, char c, unsigned int d)
1194 {
1195 int i, limit;
1196 char *lstr;
1197
1198 if (alev < CHACCESS_HALFOP)
1199 {
1200 if (!(*errors & SM_ERR_NOOPS))
1201 sendto_one(source_p, form_str(alev == CHACCESS_NOTONCHAN ?
1202 ERR_NOTONCHANNEL : ERR_CHANOPRIVSNEEDED),
1203 me.name, source_p->name, chptr->chname);
1204 *errors |= SM_ERR_NOOPS;
1205 return;
1206 }
1207
1208 if (dir == MODE_QUERY)
1209 return;
1210
1211 if ((dir == MODE_ADD) && parc > *parn)
1212 {
1213 lstr = parv[(*parn)++];
1214
1215 if ((limit = atoi(lstr)) <= 0)
1216 return;
1217
1218 sprintf(lstr, "%d", limit);
1219
1220 /* if somebody sets MODE #channel +ll 1 2, accept latter --fl */
1221 for (i = 0; i < mode_count; i++)
1222 if (mode_changes[i].letter == c && mode_changes[i].dir == MODE_ADD)
1223 mode_changes[i].letter = 0;
1224
1225 mode_changes[mode_count].letter = c;
1226 mode_changes[mode_count].dir = MODE_ADD;
1227 mode_changes[mode_count].caps = 0;
1228 mode_changes[mode_count].nocaps = 0;
1229 mode_changes[mode_count].mems = ALL_MEMBERS;
1230 mode_changes[mode_count].id = NULL;
1231 mode_changes[mode_count++].arg = lstr;
1232
1233 chptr->mode.limit = limit;
1234 }
1235 else if (dir == MODE_DEL)
1236 {
1237 if (!chptr->mode.limit)
1238 return;
1239
1240 chptr->mode.limit = 0;
1241
1242 mode_changes[mode_count].letter = c;
1243 mode_changes[mode_count].dir = MODE_DEL;
1244 mode_changes[mode_count].caps = 0;
1245 mode_changes[mode_count].nocaps = 0;
1246 mode_changes[mode_count].mems = ALL_MEMBERS;
1247 mode_changes[mode_count].id = NULL;
1248 mode_changes[mode_count++].arg = NULL;
1249 }
1250 }
1251
1252 static void
1253 chm_key(struct Client *client_p, struct Client *source_p,
1254 struct Channel *chptr, int parc, int *parn,
1255 char **parv, int *errors, int alev, int dir, char c, unsigned int d)
1256 {
1257 int i;
1258 char *key;
1259
1260 if (alev < CHACCESS_HALFOP)
1261 {
1262 if (!(*errors & SM_ERR_NOOPS))
1263 sendto_one(source_p, form_str(alev == CHACCESS_NOTONCHAN ?
1264 ERR_NOTONCHANNEL : ERR_CHANOPRIVSNEEDED),
1265 me.name, source_p->name, chptr->chname);
1266 *errors |= SM_ERR_NOOPS;
1267 return;
1268 }
1269
1270 if (dir == MODE_QUERY)
1271 return;
1272
1273 if ((dir == MODE_ADD) && parc > *parn)
1274 {
1275 key = parv[(*parn)++];
1276
1277 if (MyClient(source_p))
1278 fix_key(key);
1279 else
1280 fix_key_old(key);
1281
1282 if (*key == '\0')
1283 return;
1284
1285 assert(key[0] != ' ');
1286 strlcpy(chptr->mode.key, key, sizeof(chptr->mode.key));
1287
1288 /* if somebody does MODE #channel +kk a b, accept latter --fl */
1289 for (i = 0; i < mode_count; i++)
1290 if (mode_changes[i].letter == c && mode_changes[i].dir == MODE_ADD)
1291 mode_changes[i].letter = 0;
1292
1293 mode_changes[mode_count].letter = c;
1294 mode_changes[mode_count].dir = MODE_ADD;
1295 mode_changes[mode_count].caps = 0;
1296 mode_changes[mode_count].nocaps = 0;
1297 mode_changes[mode_count].mems = ALL_MEMBERS;
1298 mode_changes[mode_count].id = NULL;
1299 mode_changes[mode_count++].arg = chptr->mode.key;
1300 }
1301 else if (dir == MODE_DEL)
1302 {
1303 if (parc > *parn)
1304 (*parn)++;
1305
1306 if (chptr->mode.key[0] == '\0')
1307 return;
1308
1309 chptr->mode.key[0] = '\0';
1310
1311 mode_changes[mode_count].letter = c;
1312 mode_changes[mode_count].dir = MODE_DEL;
1313 mode_changes[mode_count].caps = 0;
1314 mode_changes[mode_count].nocaps = 0;
1315 mode_changes[mode_count].mems = ALL_MEMBERS;
1316 mode_changes[mode_count].id = NULL;
1317 mode_changes[mode_count++].arg = "*";
1318 }
1319 }
1320
1321 struct ChannelMode
1322 {
1323 void (*func)(struct Client *, struct Client *,
1324 struct Channel *, int, int *, char **,
1325 int *, int, int, char, unsigned int);
1326 unsigned int d;
1327 };
1328
1329 static struct ChannelMode ModeTable[256] =
1330 {
1331 { chm_nosuch, 0 }, /* 0x00 */
1332 { chm_nosuch, 0 }, /* 0x01 */
1333 { chm_nosuch, 0 }, /* 0x02 */
1334 { chm_nosuch, 0 }, /* 0x03 */
1335 { chm_nosuch, 0 }, /* 0x04 */
1336 { chm_nosuch, 0 }, /* 0x05 */
1337 { chm_nosuch, 0 }, /* 0x06 */
1338 { chm_nosuch, 0 }, /* 0x07 */
1339 { chm_nosuch, 0 }, /* 0x08 */
1340 { chm_nosuch, 0 }, /* 0x09 */
1341 { chm_nosuch, 0 }, /* 0x0a */
1342 { chm_nosuch, 0 }, /* 0x0b */
1343 { chm_nosuch, 0 }, /* 0x0c */
1344 { chm_nosuch, 0 }, /* 0x0d */
1345 { chm_nosuch, 0 }, /* 0x0e */
1346 { chm_nosuch, 0 }, /* 0x0f */
1347 { chm_nosuch, 0 }, /* 0x10 */
1348 { chm_nosuch, 0 }, /* 0x11 */
1349 { chm_nosuch, 0 }, /* 0x12 */
1350 { chm_nosuch, 0 }, /* 0x13 */
1351 { chm_nosuch, 0 }, /* 0x14 */
1352 { chm_nosuch, 0 }, /* 0x15 */
1353 { chm_nosuch, 0 }, /* 0x16 */
1354 { chm_nosuch, 0 }, /* 0x17 */
1355 { chm_nosuch, 0 }, /* 0x18 */
1356 { chm_nosuch, 0 }, /* 0x19 */
1357 { chm_nosuch, 0 }, /* 0x1a */
1358 { chm_nosuch, 0 }, /* 0x1b */
1359 { chm_nosuch, 0 }, /* 0x1c */
1360 { chm_nosuch, 0 }, /* 0x1d */
1361 { chm_nosuch, 0 }, /* 0x1e */
1362 { chm_nosuch, 0 }, /* 0x1f */
1363 { chm_nosuch, 0 }, /* 0x20 */
1364 { chm_nosuch, 0 }, /* 0x21 */
1365 { chm_nosuch, 0 }, /* 0x22 */
1366 { chm_nosuch, 0 }, /* 0x23 */
1367 { chm_nosuch, 0 }, /* 0x24 */
1368 { chm_nosuch, 0 }, /* 0x25 */
1369 { chm_nosuch, 0 }, /* 0x26 */
1370 { chm_nosuch, 0 }, /* 0x27 */
1371 { chm_nosuch, 0 }, /* 0x28 */
1372 { chm_nosuch, 0 }, /* 0x29 */
1373 { chm_nosuch, 0 }, /* 0x2a */
1374 { chm_nosuch, 0 }, /* 0x2b */
1375 { chm_nosuch, 0 }, /* 0x2c */
1376 { chm_nosuch, 0 }, /* 0x2d */
1377 { chm_nosuch, 0 }, /* 0x2e */
1378 { chm_nosuch, 0 }, /* 0x2f */
1379 { chm_nosuch, 0 }, /* 0x30 */
1380 { chm_nosuch, 0 }, /* 0x31 */
1381 { chm_nosuch, 0 }, /* 0x32 */
1382 { chm_nosuch, 0 }, /* 0x33 */
1383 { chm_nosuch, 0 }, /* 0x34 */
1384 { chm_nosuch, 0 }, /* 0x35 */
1385 { chm_nosuch, 0 }, /* 0x36 */
1386 { chm_nosuch, 0 }, /* 0x37 */
1387 { chm_nosuch, 0 }, /* 0x38 */
1388 { chm_nosuch, 0 }, /* 0x39 */
1389 { chm_nosuch, 0 }, /* 0x3a */
1390 { chm_nosuch, 0 }, /* 0x3b */
1391 { chm_nosuch, 0 }, /* 0x3c */
1392 { chm_nosuch, 0 }, /* 0x3d */
1393 { chm_nosuch, 0 }, /* 0x3e */
1394 { chm_nosuch, 0 }, /* 0x3f */
1395 { chm_nosuch, 0 }, /* @ */
1396 { chm_nosuch, 0 }, /* A */
1397 { chm_nosuch, 0 }, /* B */
1398 { chm_nosuch, 0 }, /* C */
1399 { chm_nosuch, 0 }, /* D */
1400 { chm_nosuch, 0 }, /* E */
1401 { chm_nosuch, 0 }, /* F */
1402 { chm_nosuch, 0 }, /* G */
1403 { chm_nosuch, 0 }, /* H */
1404 { chm_invex, 0 }, /* I */
1405 { chm_nosuch, 0 }, /* J */
1406 { chm_nosuch, 0 }, /* K */
1407 { chm_nosuch, 0 }, /* L */
1408 { chm_simple, MODE_MODREG}, /* M */
1409 { chm_nosuch, 0 }, /* N */
1410 { chm_operonly, MODE_OPERONLY}, /* O */
1411 { chm_nosuch, 0 }, /* P */
1412 { chm_nosuch, 0 }, /* Q */
1413 { chm_simple, MODE_REGONLY}, /* R */
1414 { chm_simple, MODE_SSLONLY}, /* S */
1415 { chm_nosuch, 0 }, /* T */
1416 { chm_nosuch, 0 }, /* U */
1417 { chm_nosuch, 0 }, /* V */
1418 { chm_nosuch, 0 }, /* W */
1419 { chm_nosuch, 0 }, /* X */
1420 { chm_nosuch, 0 }, /* Y */
1421 { chm_nosuch, 0 }, /* Z */
1422 { chm_nosuch, 0 },
1423 { chm_nosuch, 0 },
1424 { chm_nosuch, 0 },
1425 { chm_nosuch, 0 },
1426 { chm_nosuch, 0 },
1427 { chm_nosuch, 0 },
1428 { chm_nosuch, 0 }, /* a */
1429 { chm_ban, 0 }, /* b */
1430 { chm_simple, MODE_NOCTRL}, /* c */
1431 { chm_nosuch, 0 }, /* d */
1432 { chm_except, 0 }, /* e */
1433 { chm_nosuch, 0 }, /* f */
1434 { chm_nosuch, 0 }, /* g */
1435 #ifdef HALFOPS
1436 { chm_hop, 0 }, /* h */
1437 #else
1438 { chm_nosuch, 0 }, /* h */
1439 #endif
1440 { chm_simple, MODE_INVITEONLY }, /* i */
1441 { chm_nosuch, 0 }, /* j */
1442 { chm_key, 0 }, /* k */
1443 { chm_limit, 0 }, /* l */
1444 { chm_simple, MODE_MODERATED }, /* m */
1445 { chm_simple, MODE_NOPRIVMSGS }, /* n */
1446 { chm_op, 0 }, /* o */
1447 { chm_simple, MODE_PRIVATE }, /* p */
1448 { chm_nosuch, 0 }, /* q */
1449 { chm_registered, MODE_REGISTERED }, /* r */
1450 { chm_simple, MODE_SECRET }, /* s */
1451 { chm_simple, MODE_TOPICLIMIT }, /* t */
1452 { chm_nosuch, 0 }, /* u */
1453 { chm_voice, 0 }, /* v */
1454 { chm_nosuch, 0 }, /* w */
1455 { chm_nosuch, 0 }, /* x */
1456 { chm_nosuch, 0 }, /* y */
1457 { chm_nosuch, 0 }, /* z */
1458 { chm_nosuch, 0 }, /* 0x7b */
1459 { chm_nosuch, 0 }, /* 0x7c */
1460 { chm_nosuch, 0 }, /* 0x7d */
1461 { chm_nosuch, 0 }, /* 0x7e */
1462 { chm_nosuch, 0 }, /* 0x7f */
1463 { chm_nosuch, 0 }, /* 0x80 */
1464 { chm_nosuch, 0 }, /* 0x81 */
1465 { chm_nosuch, 0 }, /* 0x82 */
1466 { chm_nosuch, 0 }, /* 0x83 */
1467 { chm_nosuch, 0 }, /* 0x84 */
1468 { chm_nosuch, 0 }, /* 0x85 */
1469 { chm_nosuch, 0 }, /* 0x86 */
1470 { chm_nosuch, 0 }, /* 0x87 */
1471 { chm_nosuch, 0 }, /* 0x88 */
1472 { chm_nosuch, 0 }, /* 0x89 */
1473 { chm_nosuch, 0 }, /* 0x8a */
1474 { chm_nosuch, 0 }, /* 0x8b */
1475 { chm_nosuch, 0 }, /* 0x8c */
1476 { chm_nosuch, 0 }, /* 0x8d */
1477 { chm_nosuch, 0 }, /* 0x8e */
1478 { chm_nosuch, 0 }, /* 0x8f */
1479 { chm_nosuch, 0 }, /* 0x90 */
1480 { chm_nosuch, 0 }, /* 0x91 */
1481 { chm_nosuch, 0 }, /* 0x92 */
1482 { chm_nosuch, 0 }, /* 0x93 */
1483 { chm_nosuch, 0 }, /* 0x94 */
1484 { chm_nosuch, 0 }, /* 0x95 */
1485 { chm_nosuch, 0 }, /* 0x96 */
1486 { chm_nosuch, 0 }, /* 0x97 */
1487 { chm_nosuch, 0 }, /* 0x98 */
1488 { chm_nosuch, 0 }, /* 0x99 */
1489 { chm_nosuch, 0 }, /* 0x9a */
1490 { chm_nosuch, 0 }, /* 0x9b */
1491 { chm_nosuch, 0 }, /* 0x9c */
1492 { chm_nosuch, 0 }, /* 0x9d */
1493 { chm_nosuch, 0 }, /* 0x9e */
1494 { chm_nosuch, 0 }, /* 0x9f */
1495 { chm_nosuch, 0 }, /* 0xa0 */
1496 { chm_nosuch, 0 }, /* 0xa1 */
1497 { chm_nosuch, 0 }, /* 0xa2 */
1498 { chm_nosuch, 0 }, /* 0xa3 */
1499 { chm_nosuch, 0 }, /* 0xa4 */
1500 { chm_nosuch, 0 }, /* 0xa5 */
1501 { chm_nosuch, 0 }, /* 0xa6 */
1502 { chm_nosuch, 0 }, /* 0xa7 */
1503 { chm_nosuch, 0 }, /* 0xa8 */
1504 { chm_nosuch, 0 }, /* 0xa9 */
1505 { chm_nosuch, 0 }, /* 0xaa */
1506 { chm_nosuch, 0 }, /* 0xab */
1507 { chm_nosuch, 0 }, /* 0xac */
1508 { chm_nosuch, 0 }, /* 0xad */
1509 { chm_nosuch, 0 }, /* 0xae */
1510 { chm_nosuch, 0 }, /* 0xaf */
1511 { chm_nosuch, 0 }, /* 0xb0 */
1512 { chm_nosuch, 0 }, /* 0xb1 */
1513 { chm_nosuch, 0 }, /* 0xb2 */
1514 { chm_nosuch, 0 }, /* 0xb3 */
1515 { chm_nosuch, 0 }, /* 0xb4 */
1516 { chm_nosuch, 0 }, /* 0xb5 */
1517 { chm_nosuch, 0 }, /* 0xb6 */
1518 { chm_nosuch, 0 }, /* 0xb7 */
1519 { chm_nosuch, 0 }, /* 0xb8 */
1520 { chm_nosuch, 0 }, /* 0xb9 */
1521 { chm_nosuch, 0 }, /* 0xba */
1522 { chm_nosuch, 0 }, /* 0xbb */
1523 { chm_nosuch, 0 }, /* 0xbc */
1524 { chm_nosuch, 0 }, /* 0xbd */
1525 { chm_nosuch, 0 }, /* 0xbe */
1526 { chm_nosuch, 0 }, /* 0xbf */
1527 { chm_nosuch, 0 }, /* 0xc0 */
1528 { chm_nosuch, 0 }, /* 0xc1 */
1529 { chm_nosuch, 0 }, /* 0xc2 */
1530 { chm_nosuch, 0 }, /* 0xc3 */
1531 { chm_nosuch, 0 }, /* 0xc4 */
1532 { chm_nosuch, 0 }, /* 0xc5 */
1533 { chm_nosuch, 0 }, /* 0xc6 */
1534 { chm_nosuch, 0 }, /* 0xc7 */
1535 { chm_nosuch, 0 }, /* 0xc8 */
1536 { chm_nosuch, 0 }, /* 0xc9 */
1537 { chm_nosuch, 0 }, /* 0xca */
1538 { chm_nosuch, 0 }, /* 0xcb */
1539 { chm_nosuch, 0 }, /* 0xcc */
1540 { chm_nosuch, 0 }, /* 0xcd */
1541 { chm_nosuch, 0 }, /* 0xce */
1542 { chm_nosuch, 0 }, /* 0xcf */
1543 { chm_nosuch, 0 }, /* 0xd0 */
1544 { chm_nosuch, 0 }, /* 0xd1 */
1545 { chm_nosuch, 0 }, /* 0xd2 */
1546 { chm_nosuch, 0 }, /* 0xd3 */
1547 { chm_nosuch, 0 }, /* 0xd4 */
1548 { chm_nosuch, 0 }, /* 0xd5 */
1549 { chm_nosuch, 0 }, /* 0xd6 */
1550 { chm_nosuch, 0 }, /* 0xd7 */
1551 { chm_nosuch, 0 }, /* 0xd8 */
1552 { chm_nosuch, 0 }, /* 0xd9 */
1553 { chm_nosuch, 0 }, /* 0xda */
1554 { chm_nosuch, 0 }, /* 0xdb */
1555 { chm_nosuch, 0 }, /* 0xdc */
1556 { chm_nosuch, 0 }, /* 0xdd */
1557 { chm_nosuch, 0 }, /* 0xde */
1558 { chm_nosuch, 0 }, /* 0xdf */
1559 { chm_nosuch, 0 }, /* 0xe0 */
1560 { chm_nosuch, 0 }, /* 0xe1 */
1561 { chm_nosuch, 0 }, /* 0xe2 */
1562 { chm_nosuch, 0 }, /* 0xe3 */
1563 { chm_nosuch, 0 }, /* 0xe4 */
1564 { chm_nosuch, 0 }, /* 0xe5 */
1565 { chm_nosuch, 0 }, /* 0xe6 */
1566 { chm_nosuch, 0 }, /* 0xe7 */
1567 { chm_nosuch, 0 }, /* 0xe8 */
1568 { chm_nosuch, 0 }, /* 0xe9 */
1569 { chm_nosuch, 0 }, /* 0xea */
1570 { chm_nosuch, 0 }, /* 0xeb */
1571 { chm_nosuch, 0 }, /* 0xec */
1572 { chm_nosuch, 0 }, /* 0xed */
1573 { chm_nosuch, 0 }, /* 0xee */
1574 { chm_nosuch, 0 }, /* 0xef */
1575 { chm_nosuch, 0 }, /* 0xf0 */
1576 { chm_nosuch, 0 }, /* 0xf1 */
1577 { chm_nosuch, 0 }, /* 0xf2 */
1578 { chm_nosuch, 0 }, /* 0xf3 */
1579 { chm_nosuch, 0 }, /* 0xf4 */
1580 { chm_nosuch, 0 }, /* 0xf5 */
1581 { chm_nosuch, 0 }, /* 0xf6 */
1582 { chm_nosuch, 0 }, /* 0xf7 */
1583 { chm_nosuch, 0 }, /* 0xf8 */
1584 { chm_nosuch, 0 }, /* 0xf9 */
1585 { chm_nosuch, 0 }, /* 0xfa */
1586 { chm_nosuch, 0 }, /* 0xfb */
1587 { chm_nosuch, 0 }, /* 0xfc */
1588 { chm_nosuch, 0 }, /* 0xfd */
1589 { chm_nosuch, 0 }, /* 0xfe */
1590 { chm_nosuch, 0 }, /* 0xff */
1591 };
1592
1593 /* get_channel_access()
1594 *
1595 * inputs - pointer to Client struct
1596 * - pointer to Membership struct
1597 * output - CHACCESS_CHANOP if we should let them have
1598 * chanop level access, 0 for peon level access.
1599 * side effects - NONE
1600 */
1601 static int
1602 get_channel_access(const struct Client *source_p,
1603 const struct Membership *member)
1604 {
1605 /* Let hacked servers in for now... */
1606 if (!MyClient(source_p))
1607 return CHACCESS_CHANOP;
1608
1609 if (member == NULL)
1610 return CHACCESS_NOTONCHAN;
1611
1612 /* just to be sure.. */
1613 assert(source_p == member->client_p);
1614
1615 if (has_member_flags(member, CHFL_CHANOP))
1616 return CHACCESS_CHANOP;
1617
1618 #ifdef HALFOPS
1619 if (has_member_flags(member, CHFL_HALFOP))
1620 return CHACCESS_HALFOP;
1621 #endif
1622
1623 return CHACCESS_PEON;
1624 }
1625
1626 /* void send_cap_mode_changes(struct Client *client_p,
1627 * struct Client *source_p,
1628 * struct Channel *chptr, int cap, int nocap)
1629 * Input: The client sending(client_p), the source client(source_p),
1630 * the channel to send mode changes for(chptr)
1631 * Output: None.
1632 * Side-effects: Sends the appropriate mode changes to capable servers.
1633 *
1634 * send_cap_mode_changes() will loop the server list itself, because
1635 * at this point in time we have 4 capabs for channels, CAP_IE, CAP_EX,
1636 * and a server could support any number of these..
1637 * so we make the modebufs per server, tailoring them to each servers
1638 * specific demand. Its not very pretty, but its one of the few realistic
1639 * ways to handle having this many capabs for channel modes.. --fl_
1640 *
1641 * Reverted back to my original design, except that we now keep a count
1642 * of the number of servers which each combination as an optimisation, so
1643 * the capabs combinations which are not needed are not worked out. -A1kmm
1644 */
1645 /* rewritten to ensure parabuf < MODEBUFLEN -db */
1646
1647 static void
1648 send_cap_mode_changes(struct Client *client_p, struct Client *source_p,
1649 struct Channel *chptr, unsigned int cap, unsigned int nocap)
1650 {
1651 int i, mbl, pbl, arglen, nc, mc;
1652 int len;
1653 const char *arg = NULL;
1654 char *parptr;
1655 int dir = MODE_QUERY;
1656
1657 mc = 0;
1658 nc = 0;
1659 pbl = 0;
1660
1661 parabuf[0] = '\0';
1662 parptr = parabuf;
1663
1664 if ((cap & CAP_TS6) && source_p->id[0] != '\0')
1665 mbl = sprintf(modebuf, ":%s TMODE %lu %s ", source_p->id,
1666 (unsigned long)chptr->channelts, chptr->chname);
1667 else
1668 mbl = sprintf(modebuf, ":%s MODE %s ", source_p->name,
1669 chptr->chname);
1670
1671 /* loop the list of - modes we have */
1672 for (i = 0; i < mode_count; i++)
1673 {
1674 /* if they dont support the cap we need, or they do support a cap they
1675 * cant have, then dont add it to the modebuf.. that way they wont see
1676 * the mode
1677 */
1678 if ((mode_changes[i].letter == 0) ||
1679 ((cap & mode_changes[i].caps) != mode_changes[i].caps) ||
1680 ((nocap & mode_changes[i].nocaps) != mode_changes[i].nocaps))
1681 continue;
1682
1683 arg = "";
1684
1685 if ((cap & CAP_TS6) && mode_changes[i].id)
1686 arg = mode_changes[i].id;
1687 if (*arg == '\0')
1688 arg = mode_changes[i].arg;
1689
1690 /* if we're creeping past the buf size, we need to send it and make
1691 * another line for the other modes
1692 * XXX - this could give away server topology with uids being
1693 * different lengths, but not much we can do, except possibly break
1694 * them as if they were the longest of the nick or uid at all times,
1695 * which even then won't work as we don't always know the uid -A1kmm.
1696 */
1697 if (arg != NULL)
1698 arglen = strlen(arg);
1699 else
1700 arglen = 0;
1701
1702 if ((mc == MAXMODEPARAMS) ||
1703 ((arglen + mbl + pbl + 2) > IRCD_BUFSIZE) ||
1704 (pbl + arglen + BAN_FUDGE) >= MODEBUFLEN)
1705 {
1706 if (nc != 0)
1707 sendto_server(client_p, cap, nocap, "%s %s", modebuf, parabuf);
1708 nc = 0;
1709 mc = 0;
1710
1711 if ((cap & CAP_TS6) && source_p->id[0] != '\0')
1712 mbl = sprintf(modebuf, ":%s MODE %s ", source_p->id,
1713 chptr->chname);
1714 else
1715 mbl = sprintf(modebuf, ":%s MODE %s ", source_p->name,
1716 chptr->chname);
1717
1718 pbl = 0;
1719 parabuf[0] = '\0';
1720 parptr = parabuf;
1721 dir = MODE_QUERY;
1722 }
1723
1724 if (dir != mode_changes[i].dir)
1725 {
1726 modebuf[mbl++] = (mode_changes[i].dir == MODE_ADD) ? '+' : '-';
1727 dir = mode_changes[i].dir;
1728 }
1729
1730 modebuf[mbl++] = mode_changes[i].letter;
1731 modebuf[mbl] = '\0';
1732 nc++;
1733
1734 if (arg != NULL)
1735 {
1736 len = sprintf(parptr, "%s ", arg);
1737 pbl += len;
1738 parptr += len;
1739 mc++;
1740 }
1741 }
1742
1743 if (pbl && parabuf[pbl - 1] == ' ')
1744 parabuf[pbl - 1] = 0;
1745
1746 if (nc != 0)
1747 sendto_server(client_p, cap, nocap, "%s %s", modebuf, parabuf);
1748 }
1749
1750 /* void send_mode_changes(struct Client *client_p,
1751 * struct Client *source_p,
1752 * struct Channel *chptr)
1753 * Input: The client sending(client_p), the source client(source_p),
1754 * the channel to send mode changes for(chptr),
1755 * mode change globals.
1756 * Output: None.
1757 * Side-effects: Sends the appropriate mode changes to other clients
1758 * and propagates to servers.
1759 */
1760 /* ensure parabuf < MODEBUFLEN -db */
1761 static void
1762 send_mode_changes(struct Client *client_p, struct Client *source_p,
1763 struct Channel *chptr)
1764 {
1765 int i, mbl, pbl, arglen, nc, mc;
1766 int len;
1767 const char *arg = NULL;
1768 char *parptr;
1769 int dir = MODE_QUERY;
1770
1771 /* bail out if we have nothing to do... */
1772 if (!mode_count)
1773 return;
1774
1775 if (IsServer(source_p))
1776 mbl = sprintf(modebuf, ":%s MODE %s ", (IsHidden(source_p) ||
1777 ConfigServerHide.hide_servers) ?
1778 me.name : source_p->name, chptr->chname);
1779 else
1780 mbl = sprintf(modebuf, ":%s!%s@%s MODE %s ", source_p->name,
1781 source_p->username, source_p->host, chptr->chname);
1782
1783 mc = 0;
1784 nc = 0;
1785 pbl = 0;
1786
1787 parabuf[0] = '\0';
1788 parptr = parabuf;
1789
1790 for (i = 0; i < mode_count; i++)
1791 {
1792 if (mode_changes[i].letter == 0 ||
1793 mode_changes[i].mems == NON_CHANOPS ||
1794 mode_changes[i].mems == ONLY_SERVERS)
1795 continue;
1796
1797 arg = mode_changes[i].arg;
1798 if (arg != NULL)
1799 arglen = strlen(arg);
1800 else
1801 arglen = 0;
1802
1803 if ((mc == MAXMODEPARAMS) ||
1804 ((arglen + mbl + pbl + 2) > IRCD_BUFSIZE) ||
1805 ((arglen + pbl + BAN_FUDGE) >= MODEBUFLEN))
1806 {
1807 if (mbl && modebuf[mbl - 1] == '-')
1808 modebuf[mbl - 1] = '\0';
1809
1810 if (nc != 0)
1811 sendto_channel_local(ALL_MEMBERS, 0, chptr, "%s %s", modebuf, parabuf);
1812
1813 nc = 0;
1814 mc = 0;
1815
1816 if (IsServer(source_p))
1817 mbl = sprintf(modebuf, ":%s MODE %s ", (IsHidden(source_p) ||
1818 ConfigServerHide.hide_servers) ?
1819 me.name : source_p->name, chptr->chname);
1820 else
1821 mbl = sprintf(modebuf, ":%s!%s@%s MODE %s ", source_p->name,
1822 source_p->username, source_p->host, chptr->chname);
1823
1824 pbl = 0;
1825 parabuf[0] = '\0';
1826 parptr = parabuf;
1827 dir = MODE_QUERY;
1828 }
1829
1830 if (dir != mode_changes[i].dir)
1831 {
1832 modebuf[mbl++] = (mode_changes[i].dir == MODE_ADD) ? '+' : '-';
1833 dir = mode_changes[i].dir;
1834 }
1835
1836 modebuf[mbl++] = mode_changes[i].letter;
1837 modebuf[mbl] = '\0';
1838 nc++;
1839
1840 if (arg != NULL)
1841 {
1842 len = sprintf(parptr, "%s ", arg);
1843 pbl += len;
1844 parptr += len;
1845 mc++;
1846 }
1847 }
1848
1849 if (pbl && parabuf[pbl - 1] == ' ')
1850 parabuf[pbl - 1] = 0;
1851
1852 if (nc != 0)
1853 sendto_channel_local(ALL_MEMBERS, 0, chptr, "%s %s", modebuf, parabuf);
1854
1855 nc = 0;
1856 mc = 0;
1857
1858 /* Now send to servers... */
1859 for (i = 0; i < NCHCAP_COMBOS; i++)
1860 if (chcap_combos[i].count != 0)
1861 send_cap_mode_changes(client_p, source_p, chptr,
1862 chcap_combos[i].cap_yes,
1863 chcap_combos[i].cap_no);
1864 }
1865
1866 /* void set_channel_mode(struct Client *client_p, struct Client *source_p,
1867 * struct Channel *chptr, int parc, char **parv,
1868 * char *chname)
1869 * Input: The client we received this from, the client this originated
1870 * from, the channel, the parameter count starting at the modes,
1871 * the parameters, the channel name.
1872 * Output: None.
1873 * Side-effects: Changes the channel membership and modes appropriately,
1874 * sends the appropriate MODE messages to the appropriate
1875 * clients.
1876 */
1877 void
1878 set_channel_mode(struct Client *client_p, struct Client *source_p, struct Channel *chptr,
1879 struct Membership *member, int parc, char *parv[])
1880 {
1881 int dir = MODE_ADD;
1882 int parn = 1;
1883 int alevel, errors = 0;
1884 char *ml = parv[0], c;
1885
1886 mode_count = 0;
1887 mode_limit = 0;
1888 simple_modes_mask = 0;
1889
1890 alevel = get_channel_access(source_p, member);
1891
1892 for (; (c = *ml); ++ml)
1893 {
1894 switch (c)
1895 {
1896 case '+':
1897 dir = MODE_ADD;
1898 break;
1899 case '-':
1900 dir = MODE_DEL;
1901 break;
1902 case '=':
1903 dir = MODE_QUERY;
1904 break;
1905 default:
1906 {
1907 struct ChannelMode *tptr = &ModeTable[(unsigned char)c];
1908
1909 tptr->func(client_p, source_p, chptr, parc, &parn,
1910 parv, &errors, alevel, dir, c, tptr->d);
1911 break;
1912 }
1913 }
1914 }
1915
1916 send_mode_changes(client_p, source_p, chptr);
1917 }

Properties

Name Value
svn:eol-style native
svn:keywords Id Revision