2 * charybdis: A slightly useful ircd.
3 * chmode.c: channel mode management
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
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.
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.
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
25 * $Id: chmode.c 3580 2007-11-07 23:45:14Z jilles $
37 #include "s_serv.h" /* captab */
41 #include "s_conf.h" /* ConfigFileEntry, ConfigChannel */
42 #include "s_newconf.h"
45 #include "irc_dictionary.h"
47 /* bitmasks for error returns, so we send once per call */
48 #define SM_ERR_NOTS 0x00000001 /* No TS on channel */
49 #define SM_ERR_NOOPS 0x00000002 /* No chan ops */
50 #define SM_ERR_UNKNOWN 0x00000004
51 #define SM_ERR_RPL_C 0x00000008
52 #define SM_ERR_RPL_B 0x00000010
53 #define SM_ERR_RPL_E 0x00000020
54 #define SM_ERR_NOTONCHANNEL 0x00000040 /* Not on channel */
55 #define SM_ERR_RPL_I 0x00000100
56 #define SM_ERR_RPL_D 0x00000200
57 #define SM_ERR_NOPRIVS 0x00000400
58 #define SM_ERR_RPL_Q 0x00000800
59 #define SM_ERR_RPL_F 0x00001000
61 #define MAXMODES_SIMPLE 46 /* a-zA-Z except bqeIov */
63 static struct ChModeChange mode_changes
[BUFSIZE
];
64 static int mode_count
;
65 static int mode_limit
;
66 static int mode_limit_simple
;
68 static int no_override_deop
;
71 char cflagsmyinfo
[256];
73 int chmode_flags
[256];
75 /* OPTIMIZE ME! -- dwr */
77 construct_noparam_modes(void)
80 char *ptr
= cflagsbuf
;
81 char *ptr2
= cflagsmyinfo
;
82 static int prev_chmode_flags
[256];
87 for(i
= 0; i
< 256; i
++)
89 if( !(chmode_table
[i
].set_func
== chm_ban
) &&
90 !(chmode_table
[i
].set_func
== chm_forward
) &&
91 !(chmode_table
[i
].set_func
== chm_throttle
) &&
92 !(chmode_table
[i
].set_func
== chm_key
) &&
93 !(chmode_table
[i
].set_func
== chm_limit
) &&
94 !(chmode_table
[i
].set_func
== chm_owner
) &&
95 !(chmode_table
[i
].set_func
== chm_op
) &&
96 !(chmode_table
[i
].set_func
== chm_halfop
) &&
97 !(chmode_table
[i
].set_func
== chm_voice
))
99 chmode_flags
[i
] = chmode_table
[i
].mode_type
;
106 if (prev_chmode_flags
[i
] != 0 && prev_chmode_flags
[i
] != chmode_flags
[i
])
108 if (chmode_flags
[i
] == 0)
110 chmode_table
[i
].set_func
= chm_orphaned
;
111 sendto_realops_snomask(SNO_DEBUG
, L_ALL
, "Cmode +%c is now orphaned", i
);
115 sendto_realops_snomask(SNO_DEBUG
, L_ALL
, "Orphaned cmode +%c is picked up by module", i
);
117 chmode_flags
[i
] = prev_chmode_flags
[i
];
120 prev_chmode_flags
[i
] = chmode_flags
[i
];
122 switch (chmode_flags
[i
])
125 case MODE_DISFORWARD
:
126 if(ConfigChannel
.use_forward
)
133 if(rb_dlink_list_length(&service_list
))
140 if(chmode_flags
[i
] != 0)
146 /* Should we leave orphaned check here? -- dwr */
147 if(!(chmode_table
[i
].set_func
== chm_nosuch
) && !(chmode_table
[i
].set_func
== chm_orphaned
))
161 * outputs - an available cflag bitmask or
162 * 0 if no cflags are available
163 * side effects - NONE
166 find_cflag_slot(void)
168 unsigned int all_cflags
= 0, my_cflag
= 0, i
;
170 for (i
= 0; i
< 256; i
++)
171 all_cflags
|= chmode_flags
[i
];
173 for (my_cflag
= 1; my_cflag
&& (all_cflags
& my_cflag
);
180 get_channel_access(struct Client
*source_p
, struct membership
*msptr
)
182 if(!MyClient(source_p
) || is_owner(msptr
))
184 else if(is_chanop(msptr
))
186 else if(is_halfop(msptr
))
194 * inputs - client, channel, id to add, type
195 * outputs - 0 on failure, 1 on success
196 * side effects - given id is added to the appropriate list
199 add_id(struct Client
*source_p
, struct Channel
*chptr
, const char *banid
,
200 rb_dlink_list
* list
, long mode_type
)
202 struct Ban
*actualBan
;
203 static char who
[USERHOST_REPLYLEN
];
204 char *realban
= LOCAL_COPY(banid
);
207 /* dont let local clients overflow the banlist, or set redundant
210 if(MyClient(source_p
))
212 if((rb_dlink_list_length(&chptr
->banlist
) + rb_dlink_list_length(&chptr
->exceptlist
) + rb_dlink_list_length(&chptr
->invexlist
) + rb_dlink_list_length(&chptr
->quietlist
)) >= (chptr
->mode
.mode
& MODE_EXLIMIT
? ConfigChannel
.max_bans_large
: ConfigChannel
.max_bans
))
214 sendto_one(source_p
, form_str(ERR_BANLISTFULL
),
215 me
.name
, source_p
->name
, chptr
->chname
, realban
);
219 RB_DLINK_FOREACH(ptr
, list
->head
)
221 actualBan
= ptr
->data
;
222 if(mask_match(actualBan
->banstr
, realban
))
226 /* dont let remotes set duplicates */
229 RB_DLINK_FOREACH(ptr
, list
->head
)
231 actualBan
= ptr
->data
;
232 if(!irccmp(actualBan
->banstr
, realban
))
238 if(IsPerson(source_p
))
239 rb_sprintf(who
, "%s!%s@%s", source_p
->name
, source_p
->username
, source_p
->host
);
241 rb_strlcpy(who
, source_p
->name
, sizeof(who
));
243 actualBan
= allocate_ban(realban
, who
);
244 actualBan
->when
= rb_current_time();
246 rb_dlinkAdd(actualBan
, &actualBan
->node
, list
);
248 /* invalidate the can_send() cache */
249 if(mode_type
== CHFL_BAN
|| mode_type
== CHFL_QUIET
|| mode_type
== CHFL_EXCEPTION
)
257 * inputs - channel, id to remove, type
258 * outputs - 0 on failure, 1 on success
259 * side effects - given id is removed from the appropriate list
262 del_id(struct Channel
*chptr
, const char *banid
, rb_dlink_list
* list
, long mode_type
)
267 if(EmptyString(banid
))
270 RB_DLINK_FOREACH(ptr
, list
->head
)
274 if(irccmp(banid
, banptr
->banstr
) == 0)
276 rb_dlinkDelete(&banptr
->node
, list
);
279 /* invalidate the can_send() cache */
280 if(mode_type
== CHFL_BAN
|| mode_type
== CHFL_QUIET
|| mode_type
== CHFL_EXCEPTION
)
292 * input - string to check
293 * output - pointer to 'fixed' string, or "*" if empty
294 * side effects - any white space found becomes \0
297 check_string(char *s
)
300 static char splat
[] = "*";
317 * inputs - mask to pretty
318 * outputs - better version of the mask
319 * side effects - mask is chopped to limits, and transformed:
327 pretty_mask(const char *idmask
)
329 static char mask_buf
[BUFSIZE
];
331 char *nick
, *user
, *host
;
334 char ne
= 0, ue
= 0, he
= 0; /* save values at nick[NICKLEN], et all */
337 mask
= LOCAL_COPY(idmask
);
338 mask
= check_string(mask
);
341 nick
= user
= host
= splat
;
343 if((size_t) BUFSIZE
- mask_pos
< strlen(mask
) + 5)
346 old_mask_pos
= mask_pos
;
350 mask_pos
+= rb_sprintf(mask_buf
+ mask_pos
, "%s", mask
) + 1;
351 t
= mask_buf
+ old_mask_pos
+ 1;
357 return mask_buf
+ old_mask_pos
;
361 if((t
= strchr(mask
, '@')) != NULL
)
368 if((t
= strchr(mask
, '!')) != NULL
)
383 else if((t
= strchr(mask
, '!')) != NULL
)
392 else if(strchr(mask
, '.') != NULL
|| strchr(mask
, ':') != NULL
|| strchr(mask
, '/') != NULL
)
403 /* truncate values to max lengths */
404 if(strlen(nick
) > NICKLEN
- 1)
406 ne
= nick
[NICKLEN
- 1];
407 nick
[NICKLEN
- 1] = '\0';
409 if(strlen(user
) > USERLEN
)
412 user
[USERLEN
] = '\0';
414 if(strlen(host
) > HOSTLEN
)
417 host
[HOSTLEN
] = '\0';
420 mask_pos
+= rb_sprintf(mask_buf
+ mask_pos
, "%s!%s@%s", nick
, user
, host
) + 1;
422 /* restore mask, since we may need to use it again later */
428 nick
[NICKLEN
- 1] = ne
;
434 return mask_buf
+ old_mask_pos
;
440 * output - the same key, fixed
441 * side effects - anything below ascii 13 is discarded, ':' discarded,
442 * high ascii is dropped to lower half of ascii table
449 for(s
= t
= (u_char
*) arg
; (c
= *s
); s
++)
452 if(c
!= ':' && c
!= ',' && c
> ' ')
463 * ouput - the same key, fixed
464 * side effects - high ascii dropped to lower half of table,
465 * CR/LF/':' are dropped
468 fix_key_remote(char *arg
)
472 for(s
= t
= (u_char
*) arg
; (c
= *s
); s
++)
475 if((c
!= 0x0a) && (c
!= ':') && (c
!= ',') && (c
!= 0x0d) && (c
!= ' '))
485 * The handlers for each specific mode.
488 chm_nosuch(struct Client
*source_p
, struct Channel
*chptr
,
489 int alevel
, int parc
, int *parn
,
490 const char **parv
, int *errors
, int dir
, char c
, long mode_type
)
492 if(*errors
& SM_ERR_UNKNOWN
)
494 *errors
|= SM_ERR_UNKNOWN
;
495 sendto_one(source_p
, form_str(ERR_UNKNOWNMODE
), me
.name
, source_p
->name
, c
);
499 chm_simple(struct Client
*source_p
, struct Channel
*chptr
,
500 int alevel
, int parc
, int *parn
,
501 const char **parv
, int *errors
, int dir
, char c
, long mode_type
)
506 struct DictionaryIter iter
;
508 if(alevel
!= CHFL_CHANOP
&& alevel
!= CHFL_OWNER
&& alevel
!= CHFL_HALFOP
)
510 if (IsOverride(source_p
))
514 if(!(*errors
& SM_ERR_NOOPS
))
515 sendto_one(source_p
, form_str(ERR_CHANOPRIVSNEEDED
),
516 me
.name
, source_p
->name
, chptr
->chname
);
517 *errors
|= SM_ERR_NOOPS
;
522 if(MyClient(source_p
) && (++mode_limit_simple
> MAXMODES_SIMPLE
))
526 if((dir
== MODE_ADD
) && !(chptr
->mode
.mode
& mode_type
))
528 /* if +f is disabled, ignore an attempt to set +QF locally */
529 if(!ConfigChannel
.use_forward
&& MyClient(source_p
) &&
530 (c
== 'Q' || c
== 'F'))
533 chptr
->mode
.mode
|= mode_type
;
535 mode_changes
[mode_count
].letter
= c
;
536 mode_changes
[mode_count
].dir
= MODE_ADD
;
537 mode_changes
[mode_count
].caps
= 0;
538 mode_changes
[mode_count
].nocaps
= 0;
539 mode_changes
[mode_count
].id
= NULL
;
540 mode_changes
[mode_count
].mems
= ALL_MEMBERS
;
541 mode_changes
[mode_count
].override
= override
;
542 mode_changes
[mode_count
++].arg
= NULL
;
544 else if((dir
== MODE_DEL
) && (chptr
->mode
.mode
& mode_type
))
546 /* cleanup metadata when the related mode is removed */
549 DICTIONARY_FOREACH(md
, &iter
, chptr
->metadata
)
551 if(!strcmp(md
->value
, "KICKNOREJOIN"))
552 channel_metadata_delete(chptr
, md
->name
, 0);
556 channel_metadata_delete(chptr
, "NOREPEAT", 0);
558 chptr
->mode
.mode
&= ~mode_type
;
560 mode_changes
[mode_count
].letter
= c
;
561 mode_changes
[mode_count
].dir
= MODE_DEL
;
562 mode_changes
[mode_count
].caps
= 0;
563 mode_changes
[mode_count
].nocaps
= 0;
564 mode_changes
[mode_count
].mems
= ALL_MEMBERS
;
565 mode_changes
[mode_count
].id
= NULL
;
566 mode_changes
[mode_count
].override
= override
;
567 mode_changes
[mode_count
++].arg
= NULL
;
572 chm_orphaned(struct Client
*source_p
, struct Channel
*chptr
,
573 int alevel
, int parc
, int *parn
,
574 const char **parv
, int *errors
, int dir
, char c
, long mode_type
)
576 if(MyClient(source_p
))
579 if((dir
== MODE_ADD
) && !(chptr
->mode
.mode
& mode_type
))
581 chptr
->mode
.mode
|= mode_type
;
583 mode_changes
[mode_count
].letter
= c
;
584 mode_changes
[mode_count
].dir
= MODE_ADD
;
585 mode_changes
[mode_count
].caps
= 0;
586 mode_changes
[mode_count
].nocaps
= 0;
587 mode_changes
[mode_count
].id
= NULL
;
588 mode_changes
[mode_count
].mems
= ALL_MEMBERS
;
589 mode_changes
[mode_count
++].arg
= NULL
;
591 else if((dir
== MODE_DEL
) && (chptr
->mode
.mode
& mode_type
))
593 chptr
->mode
.mode
&= ~mode_type
;
595 mode_changes
[mode_count
].letter
= c
;
596 mode_changes
[mode_count
].dir
= MODE_DEL
;
597 mode_changes
[mode_count
].caps
= 0;
598 mode_changes
[mode_count
].nocaps
= 0;
599 mode_changes
[mode_count
].mems
= ALL_MEMBERS
;
600 mode_changes
[mode_count
].id
= NULL
;
601 mode_changes
[mode_count
++].arg
= NULL
;
606 chm_hidden(struct Client
*source_p
, struct Channel
*chptr
,
607 int alevel
, int parc
, int *parn
,
608 const char **parv
, int *errors
, int dir
, char c
, long mode_type
)
610 if(!IsOper(source_p
) && !IsServer(source_p
))
612 if(!(*errors
& SM_ERR_NOPRIVS
))
613 sendto_one_numeric(source_p
, ERR_NOPRIVILEGES
, form_str(ERR_NOPRIVILEGES
));
614 *errors
|= SM_ERR_NOPRIVS
;
617 if(MyClient(source_p
) && !IsOperAdmin(source_p
))
619 if(!(*errors
& SM_ERR_NOPRIVS
))
620 sendto_one(source_p
, form_str(ERR_NOPRIVS
), me
.name
,
621 source_p
->name
, "cmodes");
622 *errors
|= SM_ERR_NOPRIVS
;
626 if(MyClient(source_p
) && (++mode_limit_simple
> MAXMODES_SIMPLE
))
630 if((dir
== MODE_ADD
) && !(chptr
->mode
.mode
& mode_type
))
632 chptr
->mode
.mode
|= mode_type
;
634 mode_changes
[mode_count
].letter
= c
;
635 mode_changes
[mode_count
].dir
= MODE_ADD
;
636 mode_changes
[mode_count
].caps
= 0;
637 mode_changes
[mode_count
].nocaps
= 0;
638 mode_changes
[mode_count
].id
= NULL
;
639 mode_changes
[mode_count
].mems
= ONLY_OPERS
;
640 mode_changes
[mode_count
].override
= 0;
641 mode_changes
[mode_count
++].arg
= NULL
;
643 else if((dir
== MODE_DEL
) && (chptr
->mode
.mode
& mode_type
))
645 chptr
->mode
.mode
&= ~mode_type
;
647 mode_changes
[mode_count
].letter
= c
;
648 mode_changes
[mode_count
].dir
= MODE_DEL
;
649 mode_changes
[mode_count
].caps
= 0;
650 mode_changes
[mode_count
].nocaps
= 0;
651 mode_changes
[mode_count
].mems
= ONLY_OPERS
;
652 mode_changes
[mode_count
].id
= NULL
;
653 mode_changes
[mode_count
].override
= 0;
654 mode_changes
[mode_count
++].arg
= NULL
;
659 chm_staff(struct Client
*source_p
, struct Channel
*chptr
,
660 int alevel
, int parc
, int *parn
,
661 const char **parv
, int *errors
, int dir
, char c
, long mode_type
)
663 if(!IsOper(source_p
) && !IsServer(source_p
))
665 if(!(*errors
& SM_ERR_NOPRIVS
))
666 sendto_one_numeric(source_p
, ERR_NOPRIVILEGES
, form_str(ERR_NOPRIVILEGES
));
667 *errors
|= SM_ERR_NOPRIVS
;
670 if(MyClient(source_p
) && !IsOperResv(source_p
))
672 if(!(*errors
& SM_ERR_NOPRIVS
))
673 sendto_one(source_p
, form_str(ERR_NOPRIVS
), me
.name
,
674 source_p
->name
, "resv");
675 *errors
|= SM_ERR_NOPRIVS
;
679 if(MyClient(source_p
) && (++mode_limit_simple
> MAXMODES_SIMPLE
))
683 if((dir
== MODE_ADD
) && !(chptr
->mode
.mode
& mode_type
))
685 chptr
->mode
.mode
|= mode_type
;
687 mode_changes
[mode_count
].letter
= c
;
688 mode_changes
[mode_count
].dir
= MODE_ADD
;
689 mode_changes
[mode_count
].caps
= 0;
690 mode_changes
[mode_count
].nocaps
= 0;
691 mode_changes
[mode_count
].id
= NULL
;
692 mode_changes
[mode_count
].mems
= ALL_MEMBERS
;
693 mode_changes
[mode_count
].override
= 0;
694 mode_changes
[mode_count
++].arg
= NULL
;
696 else if((dir
== MODE_DEL
) && (chptr
->mode
.mode
& mode_type
))
698 chptr
->mode
.mode
&= ~mode_type
;
700 mode_changes
[mode_count
].letter
= c
;
701 mode_changes
[mode_count
].dir
= MODE_DEL
;
702 mode_changes
[mode_count
].caps
= 0;
703 mode_changes
[mode_count
].nocaps
= 0;
704 mode_changes
[mode_count
].mems
= ALL_MEMBERS
;
705 mode_changes
[mode_count
].override
= 0;
706 mode_changes
[mode_count
].id
= NULL
;
707 mode_changes
[mode_count
++].arg
= NULL
;
712 chm_ban(struct Client
*source_p
, struct Channel
*chptr
,
713 int alevel
, int parc
, int *parn
,
714 const char **parv
, int *errors
, int dir
, char c
, long mode_type
)
717 const char *raw_mask
;
731 list
= &chptr
->banlist
;
732 errorval
= SM_ERR_RPL_B
;
733 rpl_list
= RPL_BANLIST
;
734 rpl_endlist
= RPL_ENDOFBANLIST
;
740 /* if +e is disabled, allow all but +e locally */
741 if(!ConfigChannel
.use_except
&& MyClient(source_p
) &&
742 ((dir
== MODE_ADD
) && (parc
> *parn
)))
745 list
= &chptr
->exceptlist
;
746 errorval
= SM_ERR_RPL_E
;
747 rpl_list
= RPL_EXCEPTLIST
;
748 rpl_endlist
= RPL_ENDOFEXCEPTLIST
;
751 if(ConfigChannel
.use_except
|| (dir
== MODE_DEL
))
758 /* if +I is disabled, allow all but +I locally */
759 if(!ConfigChannel
.use_invex
&& MyClient(source_p
) &&
760 (dir
== MODE_ADD
) && (parc
> *parn
))
763 list
= &chptr
->invexlist
;
764 errorval
= SM_ERR_RPL_I
;
765 rpl_list
= RPL_INVITELIST
;
766 rpl_endlist
= RPL_ENDOFINVITELIST
;
769 if(ConfigChannel
.use_invex
|| (dir
== MODE_DEL
))
776 list
= &chptr
->quietlist
;
777 errorval
= SM_ERR_RPL_Q
;
778 rpl_list
= RPL_BANLIST
;
779 rpl_endlist
= RPL_ENDOFBANLIST
;
785 sendto_realops_snomask(SNO_GENERAL
, L_ALL
, "chm_ban() called with unknown type!");
790 if(dir
== 0 || parc
<= *parn
)
792 if((*errors
& errorval
) != 0)
796 /* non-ops cant see +eI lists.. */
797 if(alevel
!= CHFL_CHANOP
&& alevel
!= CHFL_OWNER
&& alevel
!= CHFL_HALFOP
&& mode_type
!= CHFL_BAN
&&
798 mode_type
!= CHFL_QUIET
)
800 if(IsOverride(source_p
))
802 sendto_realops_snomask(SNO_GENERAL
, L_NETWIDE
,
803 "%s is overriding modes on %s: (%s list)",
804 get_oper_name(source_p
), chptr
->chname
,
805 mode_type
== CHFL_INVEX
? "invex" : "exempt");
810 if(!(*errors
& SM_ERR_NOOPS
))
811 sendto_one(source_p
, form_str(ERR_CHANOPRIVSNEEDED
),
812 me
.name
, source_p
->name
, chptr
->chname
);
813 *errors
|= SM_ERR_NOOPS
;
818 RB_DLINK_FOREACH(ptr
, list
->head
)
821 sendto_one(source_p
, form_str(rpl_list
),
822 me
.name
, source_p
->name
, chptr
->chname
,
823 banptr
->banstr
, banptr
->who
, banptr
->when
);
825 if (mode_type
== CHFL_QUIET
)
826 sendto_one(source_p
, ":%s %d %s %s :End of Channel Quiet List", me
.name
, rpl_endlist
, source_p
->name
, chptr
->chname
);
828 sendto_one(source_p
, form_str(rpl_endlist
), me
.name
, source_p
->name
, chptr
->chname
);
832 if(alevel
!= CHFL_CHANOP
&& alevel
!= CHFL_OWNER
&& alevel
!= CHFL_HALFOP
)
834 if(IsOverride(source_p
))
839 if(!(*errors
& SM_ERR_NOOPS
))
840 sendto_one(source_p
, form_str(ERR_CHANOPRIVSNEEDED
),
841 me
.name
, source_p
->name
, chptr
->chname
);
842 *errors
|= SM_ERR_NOOPS
;
847 if(MyClient(source_p
) && (++mode_limit
> MAXMODEPARAMS
))
850 raw_mask
= parv
[(*parn
)];
853 /* empty ban, or starts with ':' which messes up s2s, ignore it */
854 if(EmptyString(raw_mask
) || *raw_mask
== ':')
857 if(!MyClient(source_p
))
859 if(strchr(raw_mask
, ' '))
865 mask
= pretty_mask(raw_mask
);
867 /* we'd have problems parsing this, hyb6 does it too
868 * also make sure it will always fit on a line with channel
871 if(strlen(mask
) > IRCD_MIN(BANLEN
, MODEBUFLEN
- 5))
874 /* if we're adding a NEW id */
877 if (*mask
== '$' && MyClient(source_p
))
879 if (!valid_extban(mask
, source_p
, chptr
, mode_type
))
880 /* XXX perhaps return an error message here */
884 /* dont allow local clients to overflow the banlist, dont
885 * let remote servers set duplicate bans
887 if(!add_id(source_p
, chptr
, mask
, list
, mode_type
))
890 mode_changes
[mode_count
].letter
= c
;
891 mode_changes
[mode_count
].dir
= MODE_ADD
;
892 mode_changes
[mode_count
].caps
= caps
;
893 mode_changes
[mode_count
].nocaps
= 0;
894 mode_changes
[mode_count
].mems
= mems
;
895 mode_changes
[mode_count
].id
= NULL
;
896 mode_changes
[mode_count
].override
= override
;
897 mode_changes
[mode_count
++].arg
= mask
;
899 else if(dir
== MODE_DEL
)
901 if(del_id(chptr
, mask
, list
, mode_type
) == 0)
903 /* mask isn't a valid ban, check raw_mask */
904 if(del_id(chptr
, raw_mask
, list
, mode_type
))
908 mode_changes
[mode_count
].letter
= c
;
909 mode_changes
[mode_count
].dir
= MODE_DEL
;
910 mode_changes
[mode_count
].caps
= caps
;
911 mode_changes
[mode_count
].nocaps
= 0;
912 mode_changes
[mode_count
].mems
= mems
;
913 mode_changes
[mode_count
].id
= NULL
;
914 mode_changes
[mode_count
].override
= override
;
915 mode_changes
[mode_count
++].arg
= mask
;
920 chm_owner(struct Client
*source_p
, struct Channel
*chptr
,
921 int alevel
, int parc
, int *parn
,
922 const char **parv
, int *errors
, int dir
, char c
, long mode_type
)
924 struct membership
*mstptr
;
925 const char *ownernick
;
926 struct Client
*targ_p
;
929 if(!ConfigChannel
.use_owner
)
931 if(*errors
& SM_ERR_UNKNOWN
)
933 *errors
|= SM_ERR_UNKNOWN
;
934 sendto_one(source_p
, form_str(ERR_UNKNOWNMODE
), me
.name
, source_p
->name
, c
);
938 if(alevel
!= CHFL_OWNER
)
940 if(IsOverride(source_p
))
945 if(!(*errors
& SM_ERR_NOOPS
))
946 sendto_one(source_p
, form_str(ERR_CHANOPRIVSNEEDED
),
947 me
.name
, source_p
->name
, chptr
->chname
);
948 *errors
|= SM_ERR_NOOPS
;
953 if((dir
== MODE_QUERY
) || (parc
<= *parn
))
956 ownernick
= parv
[(*parn
)];
960 if(EmptyString(ownernick
))
962 sendto_one_numeric(source_p
, ERR_NOSUCHNICK
, form_str(ERR_NOSUCHNICK
), "*");
966 if((targ_p
= find_chasing(source_p
, ownernick
, NULL
)) == NULL
)
971 mstptr
= find_channel_membership(chptr
, targ_p
);
975 if(!(*errors
& SM_ERR_NOTONCHANNEL
) && MyClient(source_p
))
976 sendto_one_numeric(source_p
, ERR_USERNOTINCHANNEL
,
977 form_str(ERR_USERNOTINCHANNEL
), ownernick
, chptr
->chname
);
978 *errors
|= SM_ERR_NOTONCHANNEL
;
982 if(MyClient(source_p
) && (++mode_limit
> MAXMODEPARAMS
))
987 if(targ_p
== source_p
)
989 no_override_deop
= 1;
990 /* Don't reject modes from remote. It desyncs, and this is perfectly
991 * legitimate from a remote override oper.
997 mode_changes
[mode_count
].letter
= c
;
998 mode_changes
[mode_count
].dir
= MODE_ADD
;
999 mode_changes
[mode_count
].caps
= 0;
1000 mode_changes
[mode_count
].nocaps
= 0;
1001 mode_changes
[mode_count
].mems
= ALL_MEMBERS
;
1002 mode_changes
[mode_count
].id
= targ_p
->id
;
1003 mode_changes
[mode_count
].arg
= targ_p
->name
;
1004 mode_changes
[mode_count
].override
= override
;
1005 mode_changes
[mode_count
++].client
= targ_p
;
1007 mstptr
->flags
|= CHFL_OWNER
;
1011 if(MyClient(source_p
) && IsService(targ_p
))
1013 sendto_one(source_p
, form_str(ERR_ISCHANSERVICE
),
1014 me
.name
, source_p
->name
, targ_p
->name
, chptr
->chname
);
1018 mode_changes
[mode_count
].letter
= c
;
1019 mode_changes
[mode_count
].dir
= MODE_DEL
;
1020 mode_changes
[mode_count
].caps
= 0;
1021 mode_changes
[mode_count
].nocaps
= 0;
1022 mode_changes
[mode_count
].mems
= ALL_MEMBERS
;
1023 mode_changes
[mode_count
].id
= targ_p
->id
;
1024 mode_changes
[mode_count
].arg
= targ_p
->name
;
1025 mode_changes
[mode_count
].override
= override
;
1026 mode_changes
[mode_count
++].client
= targ_p
;
1028 mstptr
->flags
&= ~CHFL_OWNER
;
1033 chm_op(struct Client
*source_p
, struct Channel
*chptr
,
1034 int alevel
, int parc
, int *parn
,
1035 const char **parv
, int *errors
, int dir
, char c
, long mode_type
)
1037 struct membership
*mstptr
;
1039 struct Client
*targ_p
;
1042 if(alevel
!= CHFL_CHANOP
&& alevel
!= CHFL_OWNER
)
1044 if(IsOverride(source_p
))
1049 if(!(*errors
& SM_ERR_NOOPS
))
1050 sendto_one(source_p
, form_str(ERR_CHANOPRIVSNEEDED
),
1051 me
.name
, source_p
->name
, chptr
->chname
);
1052 *errors
|= SM_ERR_NOOPS
;
1057 if((dir
== MODE_QUERY
) || (parc
<= *parn
))
1060 opnick
= parv
[(*parn
)];
1064 if(EmptyString(opnick
))
1066 sendto_one_numeric(source_p
, ERR_NOSUCHNICK
, form_str(ERR_NOSUCHNICK
), "*");
1070 if((targ_p
= find_chasing(source_p
, opnick
, NULL
)) == NULL
)
1075 mstptr
= find_channel_membership(chptr
, targ_p
);
1079 if(!(*errors
& SM_ERR_NOTONCHANNEL
) && MyClient(source_p
))
1080 sendto_one_numeric(source_p
, ERR_USERNOTINCHANNEL
,
1081 form_str(ERR_USERNOTINCHANNEL
), opnick
, chptr
->chname
);
1082 *errors
|= SM_ERR_NOTONCHANNEL
;
1086 if(MyClient(source_p
) && (++mode_limit
> MAXMODEPARAMS
))
1091 if(targ_p
== source_p
)
1093 no_override_deop
= 1;
1094 /* Don't reject modes from remote. It desyncs, and this is perfectly
1095 * legitimate from a remote override oper.
1101 mode_changes
[mode_count
].letter
= c
;
1102 mode_changes
[mode_count
].dir
= MODE_ADD
;
1103 mode_changes
[mode_count
].caps
= 0;
1104 mode_changes
[mode_count
].nocaps
= 0;
1105 mode_changes
[mode_count
].mems
= ALL_MEMBERS
;
1106 mode_changes
[mode_count
].id
= targ_p
->id
;
1107 mode_changes
[mode_count
].arg
= targ_p
->name
;
1108 mode_changes
[mode_count
].override
= override
;
1109 mode_changes
[mode_count
++].client
= targ_p
;
1111 mstptr
->flags
|= CHFL_CHANOP
;
1115 if(MyClient(source_p
) && IsService(targ_p
))
1117 sendto_one(source_p
, form_str(ERR_ISCHANSERVICE
),
1118 me
.name
, source_p
->name
, targ_p
->name
, chptr
->chname
);
1122 mode_changes
[mode_count
].letter
= c
;
1123 mode_changes
[mode_count
].dir
= MODE_DEL
;
1124 mode_changes
[mode_count
].caps
= 0;
1125 mode_changes
[mode_count
].nocaps
= 0;
1126 mode_changes
[mode_count
].mems
= ALL_MEMBERS
;
1127 mode_changes
[mode_count
].id
= targ_p
->id
;
1128 mode_changes
[mode_count
].arg
= targ_p
->name
;
1129 mode_changes
[mode_count
].override
= override
;
1130 mode_changes
[mode_count
++].client
= targ_p
;
1132 mstptr
->flags
&= ~CHFL_CHANOP
;
1137 chm_halfop(struct Client
*source_p
, struct Channel
*chptr
,
1138 int alevel
, int parc
, int *parn
,
1139 const char **parv
, int *errors
, int dir
, char c
, long mode_type
)
1141 struct membership
*mstptr
;
1142 const char *halfopnick
;
1143 struct Client
*targ_p
;
1146 if(!ConfigChannel
.use_halfop
)
1148 if(*errors
& SM_ERR_UNKNOWN
)
1150 *errors
|= SM_ERR_UNKNOWN
;
1151 sendto_one(source_p
, form_str(ERR_UNKNOWNMODE
), me
.name
, source_p
->name
, c
);
1155 if(alevel
!= CHFL_CHANOP
&& alevel
!= CHFL_OWNER
)
1157 if(IsOverride(source_p
))
1162 if(!(*errors
& SM_ERR_NOOPS
))
1163 sendto_one(source_p
, form_str(ERR_CHANOPRIVSNEEDED
),
1164 me
.name
, source_p
->name
, chptr
->chname
);
1165 *errors
|= SM_ERR_NOOPS
;
1170 if((dir
== MODE_QUERY
) || (parc
<= *parn
))
1173 halfopnick
= parv
[(*parn
)];
1177 if(EmptyString(halfopnick
))
1179 sendto_one_numeric(source_p
, ERR_NOSUCHNICK
, form_str(ERR_NOSUCHNICK
), "*");
1183 if((targ_p
= find_chasing(source_p
, halfopnick
, NULL
)) == NULL
)
1188 mstptr
= find_channel_membership(chptr
, targ_p
);
1192 if(!(*errors
& SM_ERR_NOTONCHANNEL
) && MyClient(source_p
))
1193 sendto_one_numeric(source_p
, ERR_USERNOTINCHANNEL
,
1194 form_str(ERR_USERNOTINCHANNEL
), halfopnick
, chptr
->chname
);
1195 *errors
|= SM_ERR_NOTONCHANNEL
;
1199 if(MyClient(source_p
) && (++mode_limit
> MAXMODEPARAMS
))
1204 if(targ_p
== source_p
)
1206 no_override_deop
= 1;
1207 /* Don't reject modes from remote. It desyncs, and this is perfectly
1208 * legitimate from a remote override oper.
1214 mode_changes
[mode_count
].letter
= c
;
1215 mode_changes
[mode_count
].dir
= MODE_ADD
;
1216 mode_changes
[mode_count
].caps
= 0;
1217 mode_changes
[mode_count
].nocaps
= 0;
1218 mode_changes
[mode_count
].mems
= ALL_MEMBERS
;
1219 mode_changes
[mode_count
].id
= targ_p
->id
;
1220 mode_changes
[mode_count
].arg
= targ_p
->name
;
1221 mode_changes
[mode_count
].override
= override
;
1222 mode_changes
[mode_count
++].client
= targ_p
;
1224 mstptr
->flags
|= CHFL_HALFOP
;
1228 if(MyClient(source_p
) && IsService(targ_p
))
1230 sendto_one(source_p
, form_str(ERR_ISCHANSERVICE
),
1231 me
.name
, source_p
->name
, targ_p
->name
, chptr
->chname
);
1235 mode_changes
[mode_count
].letter
= c
;
1236 mode_changes
[mode_count
].dir
= MODE_DEL
;
1237 mode_changes
[mode_count
].caps
= 0;
1238 mode_changes
[mode_count
].nocaps
= 0;
1239 mode_changes
[mode_count
].mems
= ALL_MEMBERS
;
1240 mode_changes
[mode_count
].id
= targ_p
->id
;
1241 mode_changes
[mode_count
].arg
= targ_p
->name
;
1242 mode_changes
[mode_count
].override
= override
;
1243 mode_changes
[mode_count
++].client
= targ_p
;
1245 mstptr
->flags
&= ~CHFL_HALFOP
;
1250 chm_voice(struct Client
*source_p
, struct Channel
*chptr
,
1251 int alevel
, int parc
, int *parn
,
1252 const char **parv
, int *errors
, int dir
, char c
, long mode_type
)
1254 struct membership
*mstptr
;
1256 struct Client
*targ_p
;
1259 if(alevel
!= CHFL_CHANOP
&& alevel
!= CHFL_OWNER
&& alevel
!= CHFL_HALFOP
)
1261 if(IsOverride(source_p
))
1266 if(!(*errors
& SM_ERR_NOOPS
))
1267 sendto_one(source_p
, form_str(ERR_CHANOPRIVSNEEDED
),
1268 me
.name
, source_p
->name
, chptr
->chname
);
1269 *errors
|= SM_ERR_NOOPS
;
1274 if((dir
== MODE_QUERY
) || parc
<= *parn
)
1277 opnick
= parv
[(*parn
)];
1281 if(EmptyString(opnick
))
1283 sendto_one_numeric(source_p
, ERR_NOSUCHNICK
, form_str(ERR_NOSUCHNICK
), "*");
1287 if((targ_p
= find_chasing(source_p
, opnick
, NULL
)) == NULL
)
1292 mstptr
= find_channel_membership(chptr
, targ_p
);
1296 if(!(*errors
& SM_ERR_NOTONCHANNEL
) && MyClient(source_p
))
1297 sendto_one_numeric(source_p
, ERR_USERNOTINCHANNEL
,
1298 form_str(ERR_USERNOTINCHANNEL
), opnick
, chptr
->chname
);
1299 *errors
|= SM_ERR_NOTONCHANNEL
;
1303 if(MyClient(source_p
) && (++mode_limit
> MAXMODEPARAMS
))
1308 mode_changes
[mode_count
].letter
= c
;
1309 mode_changes
[mode_count
].dir
= MODE_ADD
;
1310 mode_changes
[mode_count
].caps
= 0;
1311 mode_changes
[mode_count
].nocaps
= 0;
1312 mode_changes
[mode_count
].mems
= ALL_MEMBERS
;
1313 mode_changes
[mode_count
].id
= targ_p
->id
;
1314 mode_changes
[mode_count
].arg
= targ_p
->name
;
1315 mode_changes
[mode_count
].override
= override
;
1316 mode_changes
[mode_count
++].client
= targ_p
;
1318 mstptr
->flags
|= CHFL_VOICE
;
1322 mode_changes
[mode_count
].letter
= 'v';
1323 mode_changes
[mode_count
].dir
= MODE_DEL
;
1324 mode_changes
[mode_count
].caps
= 0;
1325 mode_changes
[mode_count
].nocaps
= 0;
1326 mode_changes
[mode_count
].mems
= ALL_MEMBERS
;
1327 mode_changes
[mode_count
].id
= targ_p
->id
;
1328 mode_changes
[mode_count
].arg
= targ_p
->name
;
1329 mode_changes
[mode_count
].override
= override
;
1330 mode_changes
[mode_count
++].client
= targ_p
;
1332 mstptr
->flags
&= ~CHFL_VOICE
;
1337 chm_limit(struct Client
*source_p
, struct Channel
*chptr
,
1338 int alevel
, int parc
, int *parn
,
1339 const char **parv
, int *errors
, int dir
, char c
, long mode_type
)
1342 static char limitstr
[30];
1346 if(alevel
!= CHFL_CHANOP
&& alevel
!= CHFL_OWNER
&& alevel
!= CHFL_HALFOP
)
1348 if(IsOverride(source_p
))
1352 if(!(*errors
& SM_ERR_NOOPS
))
1353 sendto_one(source_p
, form_str(ERR_CHANOPRIVSNEEDED
),
1354 me
.name
, source_p
->name
, chptr
->chname
);
1355 *errors
|= SM_ERR_NOOPS
;
1360 if(dir
== MODE_QUERY
)
1363 if(MyClient(source_p
) && (++mode_limit_simple
> MAXMODES_SIMPLE
))
1366 if((dir
== MODE_ADD
) && parc
> *parn
)
1368 lstr
= parv
[(*parn
)];
1371 if(EmptyString(lstr
) || (limit
= atoi(lstr
)) <= 0)
1374 rb_sprintf(limitstr
, "%d", limit
);
1376 mode_changes
[mode_count
].letter
= c
;
1377 mode_changes
[mode_count
].dir
= MODE_ADD
;
1378 mode_changes
[mode_count
].caps
= 0;
1379 mode_changes
[mode_count
].nocaps
= 0;
1380 mode_changes
[mode_count
].mems
= ALL_MEMBERS
;
1381 mode_changes
[mode_count
].id
= NULL
;
1382 mode_changes
[mode_count
].override
= override
;
1383 mode_changes
[mode_count
++].arg
= limitstr
;
1385 chptr
->mode
.limit
= limit
;
1387 else if(dir
== MODE_DEL
)
1389 if(!chptr
->mode
.limit
)
1392 chptr
->mode
.limit
= 0;
1394 mode_changes
[mode_count
].letter
= c
;
1395 mode_changes
[mode_count
].dir
= MODE_DEL
;
1396 mode_changes
[mode_count
].caps
= 0;
1397 mode_changes
[mode_count
].nocaps
= 0;
1398 mode_changes
[mode_count
].mems
= ALL_MEMBERS
;
1399 mode_changes
[mode_count
].id
= NULL
;
1400 mode_changes
[mode_count
].override
= override
;
1401 mode_changes
[mode_count
++].arg
= NULL
;
1406 chm_throttle(struct Client
*source_p
, struct Channel
*chptr
,
1407 int alevel
, int parc
, int *parn
,
1408 const char **parv
, int *errors
, int dir
, char c
, long mode_type
)
1410 int joins
= 0, timeslice
= 0;
1413 if(alevel
!= CHFL_CHANOP
&& alevel
!= CHFL_OWNER
&& alevel
!= CHFL_HALFOP
)
1415 if(IsOverride(source_p
))
1420 if(!(*errors
& SM_ERR_NOOPS
))
1421 sendto_one(source_p
, form_str(ERR_CHANOPRIVSNEEDED
),
1422 me
.name
, source_p
->name
, chptr
->chname
);
1423 *errors
|= SM_ERR_NOOPS
;
1428 if(dir
== MODE_QUERY
)
1431 if(MyClient(source_p
) && (++mode_limit_simple
> MAXMODES_SIMPLE
))
1434 if((dir
== MODE_ADD
) && parc
> *parn
)
1436 sscanf(parv
[(*parn
)], "%d:%d", &joins
, ×lice
);
1438 if(!joins
|| !timeslice
)
1441 mode_changes
[mode_count
].letter
= c
;
1442 mode_changes
[mode_count
].dir
= MODE_ADD
;
1443 mode_changes
[mode_count
].caps
= 0;
1444 mode_changes
[mode_count
].nocaps
= 0;
1445 mode_changes
[mode_count
].mems
= ALL_MEMBERS
;
1446 mode_changes
[mode_count
].id
= NULL
;
1447 mode_changes
[mode_count
].override
= override
;
1448 mode_changes
[mode_count
++].arg
= parv
[(*parn
)];
1452 chptr
->mode
.join_num
= joins
;
1453 chptr
->mode
.join_time
= timeslice
;
1455 else if(dir
== MODE_DEL
)
1457 if(!chptr
->mode
.join_num
)
1460 chptr
->mode
.join_num
= 0;
1461 chptr
->mode
.join_time
= 0;
1462 chptr
->join_count
= 0;
1463 chptr
->join_delta
= 0;
1465 mode_changes
[mode_count
].letter
= c
;
1466 mode_changes
[mode_count
].dir
= MODE_DEL
;
1467 mode_changes
[mode_count
].caps
= 0;
1468 mode_changes
[mode_count
].nocaps
= 0;
1469 mode_changes
[mode_count
].mems
= ALL_MEMBERS
;
1470 mode_changes
[mode_count
].id
= NULL
;
1471 mode_changes
[mode_count
].override
= override
;
1472 mode_changes
[mode_count
++].arg
= NULL
;
1477 chm_forward(struct Client
*source_p
, struct Channel
*chptr
,
1478 int alevel
, int parc
, int *parn
,
1479 const char **parv
, int *errors
, int dir
, char c
, long mode_type
)
1481 struct Channel
*targptr
= NULL
;
1482 struct membership
*msptr
;
1483 const char *forward
;
1486 /* if +f is disabled, ignore local attempts to set it */
1487 if(!ConfigChannel
.use_forward
&& MyClient(source_p
) &&
1488 (dir
== MODE_ADD
) && (parc
> *parn
))
1491 if(dir
== MODE_QUERY
|| (dir
== MODE_ADD
&& parc
<= *parn
))
1493 if (!(*errors
& SM_ERR_RPL_F
))
1495 if (*chptr
->mode
.forward
== '\0')
1496 sendto_one_notice(source_p
, ":%s has no forward channel", chptr
->chname
);
1498 sendto_one_notice(source_p
, ":%s forward channel is %s", chptr
->chname
, chptr
->mode
.forward
);
1499 *errors
|= SM_ERR_RPL_F
;
1504 #ifndef FORWARD_OPERONLY
1505 if(alevel
!= CHFL_CHANOP
&& alevel
!= CHFL_OWNER
&& alevel
!= CHFL_HALFOP
)
1507 if(IsOverride(source_p
))
1511 if(!(*errors
& SM_ERR_NOOPS
))
1512 sendto_one(source_p
, form_str(ERR_CHANOPRIVSNEEDED
),
1513 me
.name
, source_p
->name
, chptr
->chname
);
1514 *errors
|= SM_ERR_NOOPS
;
1519 if(!IsOper(source_p
) && !IsServer(source_p
))
1521 if(!(*errors
& SM_ERR_NOPRIVS
))
1522 sendto_one_numeric(source_p
, ERR_NOPRIVILEGES
, form_str(ERR_NOPRIVILEGES
));
1523 *errors
|= SM_ERR_NOPRIVS
;
1528 if(MyClient(source_p
) && (++mode_limit_simple
> MAXMODES_SIMPLE
))
1531 if(dir
== MODE_ADD
&& parc
> *parn
)
1533 forward
= parv
[(*parn
)];
1536 if(EmptyString(forward
))
1538 if(!check_channel_name(forward
) ||
1539 (MyClient(source_p
) && (strlen(forward
) > LOC_CHANNELLEN
|| hash_find_resv(forward
))))
1541 sendto_one_numeric(source_p
, ERR_BADCHANNAME
, form_str(ERR_BADCHANNAME
), forward
);
1544 /* don't forward to inconsistent target -- jilles */
1545 if(chptr
->chname
[0] == '#' && forward
[0] == '&')
1547 sendto_one_numeric(source_p
, ERR_BADCHANNAME
,
1548 form_str(ERR_BADCHANNAME
), forward
);
1551 if(MyClient(source_p
) && (targptr
= find_channel(forward
)) == NULL
)
1553 sendto_one_numeric(source_p
, ERR_NOSUCHCHANNEL
,
1554 form_str(ERR_NOSUCHCHANNEL
), forward
);
1557 if(MyClient(source_p
) && !(targptr
->mode
.mode
& MODE_FREETARGET
))
1559 if((msptr
= find_channel_membership(targptr
, source_p
)) == NULL
||
1562 if(IsOverride(source_p
))
1566 sendto_one(source_p
, form_str(ERR_CHANOPRIVSNEEDED
),
1567 me
.name
, source_p
->name
, targptr
->chname
);
1573 rb_strlcpy(chptr
->mode
.forward
, forward
, sizeof(chptr
->mode
.forward
));
1575 mode_changes
[mode_count
].letter
= c
;
1576 mode_changes
[mode_count
].dir
= MODE_ADD
;
1577 mode_changes
[mode_count
].caps
= 0;
1578 mode_changes
[mode_count
].nocaps
= 0;
1579 mode_changes
[mode_count
].mems
= ConfigChannel
.use_forward
? ALL_MEMBERS
: ONLY_SERVERS
;
1580 mode_changes
[mode_count
].id
= NULL
;
1581 mode_changes
[mode_count
].override
= override
;
1582 mode_changes
[mode_count
++].arg
= forward
;
1584 else if(dir
== MODE_DEL
)
1586 if(!(*chptr
->mode
.forward
))
1589 *chptr
->mode
.forward
= '\0';
1591 mode_changes
[mode_count
].letter
= c
;
1592 mode_changes
[mode_count
].dir
= MODE_DEL
;
1593 mode_changes
[mode_count
].caps
= 0;
1594 mode_changes
[mode_count
].nocaps
= 0;
1595 mode_changes
[mode_count
].mems
= ALL_MEMBERS
;
1596 mode_changes
[mode_count
].id
= NULL
;
1597 mode_changes
[mode_count
].override
= override
;
1598 mode_changes
[mode_count
++].arg
= NULL
;
1603 chm_key(struct Client
*source_p
, struct Channel
*chptr
,
1604 int alevel
, int parc
, int *parn
,
1605 const char **parv
, int *errors
, int dir
, char c
, long mode_type
)
1610 if(alevel
!= CHFL_CHANOP
&& alevel
!= CHFL_OWNER
&& alevel
!= CHFL_HALFOP
)
1612 if(IsOverride(source_p
))
1616 if(!(*errors
& SM_ERR_NOOPS
))
1617 sendto_one(source_p
, form_str(ERR_CHANOPRIVSNEEDED
),
1618 me
.name
, source_p
->name
, chptr
->chname
);
1619 *errors
|= SM_ERR_NOOPS
;
1624 if(dir
== MODE_QUERY
)
1627 if(MyClient(source_p
) && (++mode_limit_simple
> MAXMODES_SIMPLE
))
1630 if((dir
== MODE_ADD
) && parc
> *parn
)
1632 key
= LOCAL_COPY(parv
[(*parn
)]);
1635 if(MyClient(source_p
))
1638 fix_key_remote(key
);
1640 if(EmptyString(key
))
1643 s_assert(key
[0] != ' ');
1644 rb_strlcpy(chptr
->mode
.key
, key
, sizeof(chptr
->mode
.key
));
1646 mode_changes
[mode_count
].letter
= c
;
1647 mode_changes
[mode_count
].dir
= MODE_ADD
;
1648 mode_changes
[mode_count
].caps
= 0;
1649 mode_changes
[mode_count
].nocaps
= 0;
1650 mode_changes
[mode_count
].mems
= ALL_MEMBERS
;
1651 mode_changes
[mode_count
].id
= NULL
;
1652 mode_changes
[mode_count
].override
= override
;
1653 mode_changes
[mode_count
++].arg
= chptr
->mode
.key
;
1655 else if(dir
== MODE_DEL
)
1657 static char splat
[] = "*";
1663 if(!(*chptr
->mode
.key
))
1666 /* hack time. when we get a +k-k mode, the +k arg is
1667 * chptr->mode.key, which the -k sets to \0, so hunt for a
1668 * +k when we get a -k, and set the arg to splat. --anfl
1670 for(i
= 0; i
< mode_count
; i
++)
1672 if(mode_changes
[i
].letter
== 'k' && mode_changes
[i
].dir
== MODE_ADD
)
1673 mode_changes
[i
].arg
= splat
;
1676 *chptr
->mode
.key
= 0;
1678 mode_changes
[mode_count
].letter
= c
;
1679 mode_changes
[mode_count
].dir
= MODE_DEL
;
1680 mode_changes
[mode_count
].caps
= 0;
1681 mode_changes
[mode_count
].nocaps
= 0;
1682 mode_changes
[mode_count
].mems
= ALL_MEMBERS
;
1683 mode_changes
[mode_count
].id
= NULL
;
1684 mode_changes
[mode_count
].override
= override
;
1685 mode_changes
[mode_count
++].arg
= "*";
1690 chm_regonly(struct Client
*source_p
, struct Channel
*chptr
,
1691 int alevel
, int parc
, int *parn
,
1692 const char **parv
, int *errors
, int dir
, char c
, long mode_type
)
1696 if(alevel
!= CHFL_CHANOP
&& alevel
!= CHFL_OWNER
&& alevel
!= CHFL_HALFOP
)
1698 if(IsOverride(source_p
))
1702 if(!(*errors
& SM_ERR_NOOPS
))
1703 sendto_one(source_p
, form_str(ERR_CHANOPRIVSNEEDED
),
1704 me
.name
, source_p
->name
, chptr
->chname
);
1705 *errors
|= SM_ERR_NOOPS
;
1710 if(dir
== MODE_QUERY
)
1713 if(((dir
== MODE_ADD
) && (chptr
->mode
.mode
& mode_type
)) ||
1714 ((dir
== MODE_DEL
) && !(chptr
->mode
.mode
& mode_type
)))
1717 if(MyClient(source_p
) && (++mode_limit_simple
> MAXMODES_SIMPLE
))
1721 chptr
->mode
.mode
|= mode_type
;
1723 chptr
->mode
.mode
&= ~mode_type
;
1725 mode_changes
[mode_count
].letter
= c
;
1726 mode_changes
[mode_count
].dir
= dir
;
1727 mode_changes
[mode_count
].caps
= CAP_SERVICE
;
1728 mode_changes
[mode_count
].nocaps
= 0;
1729 mode_changes
[mode_count
].mems
= ALL_MEMBERS
;
1730 mode_changes
[mode_count
].id
= NULL
;
1731 mode_changes
[mode_count
].override
= override
;
1732 mode_changes
[mode_count
++].arg
= NULL
;
1736 struct ChannelMode chmode_table
[256] =
1738 {chm_nosuch
, 0 }, /* 0x00 */
1739 {chm_nosuch
, 0 }, /* 0x01 */
1740 {chm_nosuch
, 0 }, /* 0x02 */
1741 {chm_nosuch
, 0 }, /* 0x03 */
1742 {chm_nosuch
, 0 }, /* 0x04 */
1743 {chm_nosuch
, 0 }, /* 0x05 */
1744 {chm_nosuch
, 0 }, /* 0x06 */
1745 {chm_nosuch
, 0 }, /* 0x07 */
1746 {chm_nosuch
, 0 }, /* 0x08 */
1747 {chm_nosuch
, 0 }, /* 0x09 */
1748 {chm_nosuch
, 0 }, /* 0x0a */
1749 {chm_nosuch
, 0 }, /* 0x0b */
1750 {chm_nosuch
, 0 }, /* 0x0c */
1751 {chm_nosuch
, 0 }, /* 0x0d */
1752 {chm_nosuch
, 0 }, /* 0x0e */
1753 {chm_nosuch
, 0 }, /* 0x0f */
1754 {chm_nosuch
, 0 }, /* 0x10 */
1755 {chm_nosuch
, 0 }, /* 0x11 */
1756 {chm_nosuch
, 0 }, /* 0x12 */
1757 {chm_nosuch
, 0 }, /* 0x13 */
1758 {chm_nosuch
, 0 }, /* 0x14 */
1759 {chm_nosuch
, 0 }, /* 0x15 */
1760 {chm_nosuch
, 0 }, /* 0x16 */
1761 {chm_nosuch
, 0 }, /* 0x17 */
1762 {chm_nosuch
, 0 }, /* 0x18 */
1763 {chm_nosuch
, 0 }, /* 0x19 */
1764 {chm_nosuch
, 0 }, /* 0x1a */
1765 {chm_nosuch
, 0 }, /* 0x1b */
1766 {chm_nosuch
, 0 }, /* 0x1c */
1767 {chm_nosuch
, 0 }, /* 0x1d */
1768 {chm_nosuch
, 0 }, /* 0x1e */
1769 {chm_nosuch
, 0 }, /* 0x1f */
1770 {chm_nosuch
, 0 }, /* 0x20 */
1771 {chm_nosuch
, 0 }, /* 0x21 */
1772 {chm_nosuch
, 0 }, /* 0x22 */
1773 {chm_nosuch
, 0 }, /* 0x23 */
1774 {chm_nosuch
, 0 }, /* 0x24 */
1775 {chm_nosuch
, 0 }, /* 0x25 */
1776 {chm_nosuch
, 0 }, /* 0x26 */
1777 {chm_nosuch
, 0 }, /* 0x27 */
1778 {chm_nosuch
, 0 }, /* 0x28 */
1779 {chm_nosuch
, 0 }, /* 0x29 */
1780 {chm_nosuch
, 0 }, /* 0x2a */
1781 {chm_nosuch
, 0 }, /* 0x2b */
1782 {chm_nosuch
, 0 }, /* 0x2c */
1783 {chm_nosuch
, 0 }, /* 0x2d */
1784 {chm_nosuch
, 0 }, /* 0x2e */
1785 {chm_nosuch
, 0 }, /* 0x2f */
1786 {chm_nosuch
, 0 }, /* 0x30 */
1787 {chm_nosuch
, 0 }, /* 0x31 */
1788 {chm_nosuch
, 0 }, /* 0x32 */
1789 {chm_nosuch
, 0 }, /* 0x33 */
1790 {chm_nosuch
, 0 }, /* 0x34 */
1791 {chm_nosuch
, 0 }, /* 0x35 */
1792 {chm_nosuch
, 0 }, /* 0x36 */
1793 {chm_nosuch
, 0 }, /* 0x37 */
1794 {chm_nosuch
, 0 }, /* 0x38 */
1795 {chm_nosuch
, 0 }, /* 0x39 */
1796 {chm_nosuch
, 0 }, /* 0x3a */
1797 {chm_nosuch
, 0 }, /* 0x3b */
1798 {chm_nosuch
, 0 }, /* 0x3c */
1799 {chm_nosuch
, 0 }, /* 0x3d */
1800 {chm_nosuch
, 0 }, /* 0x3e */
1801 {chm_nosuch
, 0 }, /* 0x3f */
1803 {chm_nosuch
, 0 }, /* @ */
1804 {chm_nosuch
, 0 }, /* A */
1805 {chm_nosuch
, 0 }, /* B */
1806 {chm_simple
, MODE_NOCTCP
}, /* C */
1807 {chm_simple
, MODE_NOACTION
}, /* D */
1808 {chm_simple
, MODE_NOKICK
}, /* E */
1809 {chm_simple
, MODE_FREETARGET
}, /* F */
1810 {chm_simple
, MODE_NOCAPS
}, /* G */
1811 {chm_nosuch
, 0 }, /* H */
1812 {chm_ban
, CHFL_INVEX
}, /* I */
1813 {chm_simple
, MODE_NOREJOIN
}, /* J */
1814 {chm_simple
, MODE_NOREPEAT
}, /* K */
1815 {chm_staff
, MODE_EXLIMIT
}, /* L */
1816 {chm_hidden
, MODE_NOOPERKICK
}, /* M */
1817 {chm_simple
, MODE_NONICK
}, /* N */
1818 {chm_nosuch
, 0 }, /* O */
1819 {chm_staff
, MODE_PERMANENT
}, /* P */
1820 {chm_simple
, MODE_DISFORWARD
}, /* Q */
1821 {chm_nosuch
, 0 }, /* R */
1822 {chm_nosuch
, 0 }, /* S */
1823 {chm_simple
, MODE_NONOTICE
}, /* T */
1824 {chm_nosuch
, 0 }, /* U */
1825 {chm_nosuch
, 0 }, /* V */
1826 {chm_nosuch
, 0 }, /* W */
1827 {chm_nosuch
, 0 }, /* X */
1828 {chm_nosuch
, 0 }, /* Y */
1829 {chm_nosuch
, 0 }, /* Z */
1836 {chm_owner
, 0 }, /* a */
1837 {chm_ban
, CHFL_BAN
}, /* b */
1838 {chm_simple
, MODE_NOCOLOR
}, /* c */
1839 {chm_nosuch
, 0 }, /* d */
1840 {chm_ban
, CHFL_EXCEPTION
}, /* e */
1841 {chm_forward
, 0 }, /* f */
1842 {chm_simple
, MODE_FREEINVITE
}, /* g */
1843 {chm_halfop
, 0 }, /* h */
1844 {chm_simple
, MODE_INVITEONLY
}, /* i */
1845 {chm_throttle
, 0 }, /* j */
1846 {chm_key
, 0 }, /* k */
1847 {chm_limit
, 0 }, /* l */
1848 {chm_simple
, MODE_MODERATED
}, /* m */
1849 {chm_simple
, MODE_NOPRIVMSGS
}, /* n */
1850 {chm_op
, 0 }, /* o */
1851 {chm_simple
, MODE_PRIVATE
}, /* p */
1852 {chm_ban
, CHFL_QUIET
}, /* q */
1853 {chm_regonly
, MODE_REGONLY
}, /* r */
1854 {chm_simple
, MODE_SECRET
}, /* s */
1855 {chm_simple
, MODE_TOPICLIMIT
}, /* t */
1856 {chm_nosuch
, 0 }, /* u */
1857 {chm_voice
, 0 }, /* v */
1858 {chm_nosuch
, 0 }, /* w */
1859 {chm_nosuch
, 0 }, /* x */
1860 {chm_nosuch
, 0 }, /* y */
1861 {chm_simple
, MODE_OPMODERATE
}, /* z */
1863 {chm_nosuch
, 0 }, /* 0x7b */
1864 {chm_nosuch
, 0 }, /* 0x7c */
1865 {chm_nosuch
, 0 }, /* 0x7d */
1866 {chm_nosuch
, 0 }, /* 0x7e */
1867 {chm_nosuch
, 0 }, /* 0x7f */
1869 {chm_nosuch
, 0 }, /* 0x80 */
1870 {chm_nosuch
, 0 }, /* 0x81 */
1871 {chm_nosuch
, 0 }, /* 0x82 */
1872 {chm_nosuch
, 0 }, /* 0x83 */
1873 {chm_nosuch
, 0 }, /* 0x84 */
1874 {chm_nosuch
, 0 }, /* 0x85 */
1875 {chm_nosuch
, 0 }, /* 0x86 */
1876 {chm_nosuch
, 0 }, /* 0x87 */
1877 {chm_nosuch
, 0 }, /* 0x88 */
1878 {chm_nosuch
, 0 }, /* 0x89 */
1879 {chm_nosuch
, 0 }, /* 0x8a */
1880 {chm_nosuch
, 0 }, /* 0x8b */
1881 {chm_nosuch
, 0 }, /* 0x8c */
1882 {chm_nosuch
, 0 }, /* 0x8d */
1883 {chm_nosuch
, 0 }, /* 0x8e */
1884 {chm_nosuch
, 0 }, /* 0x8f */
1886 {chm_nosuch
, 0 }, /* 0x90 */
1887 {chm_nosuch
, 0 }, /* 0x91 */
1888 {chm_nosuch
, 0 }, /* 0x92 */
1889 {chm_nosuch
, 0 }, /* 0x93 */
1890 {chm_nosuch
, 0 }, /* 0x94 */
1891 {chm_nosuch
, 0 }, /* 0x95 */
1892 {chm_nosuch
, 0 }, /* 0x96 */
1893 {chm_nosuch
, 0 }, /* 0x97 */
1894 {chm_nosuch
, 0 }, /* 0x98 */
1895 {chm_nosuch
, 0 }, /* 0x99 */
1896 {chm_nosuch
, 0 }, /* 0x9a */
1897 {chm_nosuch
, 0 }, /* 0x9b */
1898 {chm_nosuch
, 0 }, /* 0x9c */
1899 {chm_nosuch
, 0 }, /* 0x9d */
1900 {chm_nosuch
, 0 }, /* 0x9e */
1901 {chm_nosuch
, 0 }, /* 0x9f */
1903 {chm_nosuch
, 0 }, /* 0xa0 */
1904 {chm_nosuch
, 0 }, /* 0xa1 */
1905 {chm_nosuch
, 0 }, /* 0xa2 */
1906 {chm_nosuch
, 0 }, /* 0xa3 */
1907 {chm_nosuch
, 0 }, /* 0xa4 */
1908 {chm_nosuch
, 0 }, /* 0xa5 */
1909 {chm_nosuch
, 0 }, /* 0xa6 */
1910 {chm_nosuch
, 0 }, /* 0xa7 */
1911 {chm_nosuch
, 0 }, /* 0xa8 */
1912 {chm_nosuch
, 0 }, /* 0xa9 */
1913 {chm_nosuch
, 0 }, /* 0xaa */
1914 {chm_nosuch
, 0 }, /* 0xab */
1915 {chm_nosuch
, 0 }, /* 0xac */
1916 {chm_nosuch
, 0 }, /* 0xad */
1917 {chm_nosuch
, 0 }, /* 0xae */
1918 {chm_nosuch
, 0 }, /* 0xaf */
1920 {chm_nosuch
, 0 }, /* 0xb0 */
1921 {chm_nosuch
, 0 }, /* 0xb1 */
1922 {chm_nosuch
, 0 }, /* 0xb2 */
1923 {chm_nosuch
, 0 }, /* 0xb3 */
1924 {chm_nosuch
, 0 }, /* 0xb4 */
1925 {chm_nosuch
, 0 }, /* 0xb5 */
1926 {chm_nosuch
, 0 }, /* 0xb6 */
1927 {chm_nosuch
, 0 }, /* 0xb7 */
1928 {chm_nosuch
, 0 }, /* 0xb8 */
1929 {chm_nosuch
, 0 }, /* 0xb9 */
1930 {chm_nosuch
, 0 }, /* 0xba */
1931 {chm_nosuch
, 0 }, /* 0xbb */
1932 {chm_nosuch
, 0 }, /* 0xbc */
1933 {chm_nosuch
, 0 }, /* 0xbd */
1934 {chm_nosuch
, 0 }, /* 0xbe */
1935 {chm_nosuch
, 0 }, /* 0xbf */
1937 {chm_nosuch
, 0 }, /* 0xc0 */
1938 {chm_nosuch
, 0 }, /* 0xc1 */
1939 {chm_nosuch
, 0 }, /* 0xc2 */
1940 {chm_nosuch
, 0 }, /* 0xc3 */
1941 {chm_nosuch
, 0 }, /* 0xc4 */
1942 {chm_nosuch
, 0 }, /* 0xc5 */
1943 {chm_nosuch
, 0 }, /* 0xc6 */
1944 {chm_nosuch
, 0 }, /* 0xc7 */
1945 {chm_nosuch
, 0 }, /* 0xc8 */
1946 {chm_nosuch
, 0 }, /* 0xc9 */
1947 {chm_nosuch
, 0 }, /* 0xca */
1948 {chm_nosuch
, 0 }, /* 0xcb */
1949 {chm_nosuch
, 0 }, /* 0xcc */
1950 {chm_nosuch
, 0 }, /* 0xcd */
1951 {chm_nosuch
, 0 }, /* 0xce */
1952 {chm_nosuch
, 0 }, /* 0xcf */
1954 {chm_nosuch
, 0 }, /* 0xd0 */
1955 {chm_nosuch
, 0 }, /* 0xd1 */
1956 {chm_nosuch
, 0 }, /* 0xd2 */
1957 {chm_nosuch
, 0 }, /* 0xd3 */
1958 {chm_nosuch
, 0 }, /* 0xd4 */
1959 {chm_nosuch
, 0 }, /* 0xd5 */
1960 {chm_nosuch
, 0 }, /* 0xd6 */
1961 {chm_nosuch
, 0 }, /* 0xd7 */
1962 {chm_nosuch
, 0 }, /* 0xd8 */
1963 {chm_nosuch
, 0 }, /* 0xd9 */
1964 {chm_nosuch
, 0 }, /* 0xda */
1965 {chm_nosuch
, 0 }, /* 0xdb */
1966 {chm_nosuch
, 0 }, /* 0xdc */
1967 {chm_nosuch
, 0 }, /* 0xdd */
1968 {chm_nosuch
, 0 }, /* 0xde */
1969 {chm_nosuch
, 0 }, /* 0xdf */
1971 {chm_nosuch
, 0 }, /* 0xe0 */
1972 {chm_nosuch
, 0 }, /* 0xe1 */
1973 {chm_nosuch
, 0 }, /* 0xe2 */
1974 {chm_nosuch
, 0 }, /* 0xe3 */
1975 {chm_nosuch
, 0 }, /* 0xe4 */
1976 {chm_nosuch
, 0 }, /* 0xe5 */
1977 {chm_nosuch
, 0 }, /* 0xe6 */
1978 {chm_nosuch
, 0 }, /* 0xe7 */
1979 {chm_nosuch
, 0 }, /* 0xe8 */
1980 {chm_nosuch
, 0 }, /* 0xe9 */
1981 {chm_nosuch
, 0 }, /* 0xea */
1982 {chm_nosuch
, 0 }, /* 0xeb */
1983 {chm_nosuch
, 0 }, /* 0xec */
1984 {chm_nosuch
, 0 }, /* 0xed */
1985 {chm_nosuch
, 0 }, /* 0xee */
1986 {chm_nosuch
, 0 }, /* 0xef */
1988 {chm_nosuch
, 0 }, /* 0xf0 */
1989 {chm_nosuch
, 0 }, /* 0xf1 */
1990 {chm_nosuch
, 0 }, /* 0xf2 */
1991 {chm_nosuch
, 0 }, /* 0xf3 */
1992 {chm_nosuch
, 0 }, /* 0xf4 */
1993 {chm_nosuch
, 0 }, /* 0xf5 */
1994 {chm_nosuch
, 0 }, /* 0xf6 */
1995 {chm_nosuch
, 0 }, /* 0xf7 */
1996 {chm_nosuch
, 0 }, /* 0xf8 */
1997 {chm_nosuch
, 0 }, /* 0xf9 */
1998 {chm_nosuch
, 0 }, /* 0xfa */
1999 {chm_nosuch
, 0 }, /* 0xfb */
2000 {chm_nosuch
, 0 }, /* 0xfc */
2001 {chm_nosuch
, 0 }, /* 0xfd */
2002 {chm_nosuch
, 0 }, /* 0xfe */
2003 {chm_nosuch
, 0 }, /* 0xff */
2008 /* set_channel_mode()
2010 * inputs - client, source, channel, membership pointer, params
2012 * side effects - channel modes/memberships are changed, MODE is issued
2014 * Extensively modified to be hotpluggable, 03/09/06 -- nenolod
2017 set_channel_mode(struct Client
*client_p
, struct Client
*source_p
,
2018 struct Channel
*chptr
, struct membership
*msptr
, int parc
, const char *parv
[])
2020 static char cmdbuf
[BUFSIZE
];
2021 static char modebuf
[BUFSIZE
];
2022 static char parabuf
[BUFSIZE
];
2025 int cur_len
, mlen
, paralen
, paracount
, arglen
, len
;
2026 int i
, j
, flags
, override
;
2031 const char *ml
= parv
[0];
2033 struct Client
*fakesource_p
;
2034 int flags_list
[3] = { ALL_MEMBERS
, ONLY_CHANOPS
, ONLY_OPERS
};
2039 mode_limit_simple
= 0;
2041 alevel
= get_channel_access(source_p
, msptr
);
2043 no_override_deop
= 0;
2045 /* Hide connecting server on netburst -- jilles */
2046 if (ConfigServerHide
.flatten_links
&& IsServer(source_p
) && !has_id(source_p
) && !HasSentEob(source_p
))
2049 fakesource_p
= source_p
;
2051 for(; (c
= *ml
) != 0; ml
++)
2065 chmode_table
[(unsigned char) c
].set_func(fakesource_p
, chptr
, alevel
,
2068 chmode_table
[(unsigned char) c
].mode_type
);
2073 /* bail out if we have nothing to do... */
2077 if(IsServer(source_p
))
2078 rb_sprintf(cmdbuf
, ":%s MODE %s ", fakesource_p
->name
, chptr
->chname
);
2080 rb_sprintf(cmdbuf
, ":%s!%s@%s MODE %s ",
2081 source_p
->name
, source_p
->username
,
2082 source_p
->host
, chptr
->chname
);
2086 for (override
= 0; override
< (IsOverride(source_p
) && alevel
!= CHFL_CHANOP
? 2 : 1); ++override
)
2088 int was_on_chan
= 0;
2095 msptr
->flags
|= CHFL_CHANOP
;
2098 add_user_to_channel(chptr
, source_p
, CHFL_CHANOP
);
2101 for(j
= 0, flags
= flags_list
[0]; j
< 3; j
++, flags
= flags_list
[j
])
2104 mbuf
= modebuf
+ mlen
;
2107 paracount
= paralen
= 0;
2110 for(i
= 0; i
< mode_count
; i
++)
2112 if(mode_changes
[i
].letter
== 0 || mode_changes
[i
].mems
!= flags
)
2115 if(mode_changes
[i
].override
!= override
)
2118 if(mode_changes
[i
].arg
!= NULL
)
2120 arglen
= strlen(mode_changes
[i
].arg
);
2122 if(arglen
> MODEBUFLEN
- 5)
2128 /* if we're creeping over MAXMODEPARAMSSERV, or over
2129 * bufsize (4 == +/-,modechar,two spaces) send now.
2131 if(mode_changes
[i
].arg
!= NULL
&&
2132 ((paracount
== MAXMODEPARAMSSERV
) ||
2133 ((cur_len
+ paralen
+ arglen
+ 4) > (BUFSIZE
- 3))))
2139 sendto_channel_local(flags
, chptr
, "%s%s %s",
2140 cmdbuf
, modebuf
, parabuf
);
2142 sendto_realops_snomask(SNO_GENERAL
, L_NETWIDE
,
2143 "%s is overriding modes on %s: %s %s",
2144 get_oper_name(source_p
), chptr
->chname
,
2150 paracount
= paralen
= 0;
2152 mbuf
= modebuf
+ mlen
;
2158 if(dir
!= mode_changes
[i
].dir
)
2160 *mbuf
++ = (mode_changes
[i
].dir
== MODE_ADD
) ? '+' : '-';
2162 dir
= mode_changes
[i
].dir
;
2165 *mbuf
++ = mode_changes
[i
].letter
;
2168 if(mode_changes
[i
].arg
!= NULL
)
2171 len
= rb_sprintf(pbuf
, "%s ", mode_changes
[i
].arg
);
2177 if(paralen
&& parabuf
[paralen
- 1] == ' ')
2178 parabuf
[paralen
- 1] = '\0';
2183 sendto_channel_local(flags
, chptr
, "%s%s %s", cmdbuf
, modebuf
, parabuf
);
2185 sendto_realops_snomask(SNO_GENERAL
, L_NETWIDE
,
2186 "%s is overriding modes on %s: %s %s",
2187 get_oper_name(source_p
), chptr
->chname
,
2194 remove_user_from_channel(find_channel_membership(chptr
, source_p
));
2195 else if (!no_override_deop
)
2196 msptr
->flags
&= ~CHFL_CHANOP
;
2200 /* only propagate modes originating locally, or if we're hubbing */
2201 if(MyClient(source_p
) || rb_dlink_list_length(&serv_list
) > 1)
2202 send_cap_mode_changes(client_p
, source_p
, chptr
, mode_changes
, mode_count
);