2 * ngIRCd -- The Next Generation IRC Daemon
3 * Copyright (c)2001-2012 Alexander Barton (alex@barton.de) and Contributors.
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
9 * Please read the file COPYING, README and AUTHORS for more information.
16 * IRC commands for mode changes (like MODE, AWAY, etc.)
28 #include "irc-write.h"
39 static bool Client_Mode PARAMS((CLIENT *Client, REQUEST *Req, CLIENT *Origin,
41 static bool Channel_Mode PARAMS((CLIENT *Client, REQUEST *Req, CLIENT *Origin,
44 static bool Add_To_List PARAMS((char what, CLIENT *Prefix, CLIENT *Client,
45 CHANNEL *Channel, const char *Pattern));
46 static bool Del_From_List PARAMS((char what, CLIENT *Prefix, CLIENT *Client,
47 CHANNEL *Channel, const char *Pattern));
49 static bool Send_ListChange PARAMS((const bool IsAdd, const char ModeChar,
50 CLIENT *Prefix, CLIENT *Client,
51 CHANNEL *Channel, const char *Mask));
55 * Handler for the IRC "MODE" command.
57 * See RFC 2812 section 3.1.5 ("user mode message") and section 3.2.3
58 * ("channel mode message"), and RFC 2811 section 4 ("channel modes").
60 * @param Client The client from which this command has been received.
61 * @param Req Request structure with prefix and all parameters.
62 * @returns CONNECTED or DISCONNECTED.
65 IRC_MODE( CLIENT *Client, REQUEST *Req )
70 assert(Client != NULL);
75 return IRC_WriteStrClient(Client, ERR_NEEDMOREPARAMS_MSG,
76 Client_ID(Client), Req->command);
78 /* Origin for answers */
79 if (Client_Type(Client) == CLIENT_SERVER) {
80 origin = Client_Search(Req->prefix);
82 return IRC_WriteStrClient(Client, ERR_NOSUCHNICK_MSG,
88 /* Channel or user mode? */
89 cl = NULL; chan = NULL;
90 if (Client_IsValidNick(Req->argv[0]))
91 cl = Client_Search(Req->argv[0]);
92 if (Channel_IsValidName(Req->argv[0]))
93 chan = Channel_Search(Req->argv[0]);
96 return Client_Mode(Client, Req, origin, cl);
98 return Channel_Mode(Client, Req, origin, chan);
100 /* No target found! */
101 return IRC_WriteStrClient(Client, ERR_NOSUCHNICK_MSG,
102 Client_ID(Client), Req->argv[0]);
107 * Check if the "mode limit" for a client has been reached.
109 * This limit doesn't apply for servers or services!
111 * @param Client The client to check.
112 * @param Count The number of modes already handled.
113 * @return true if the limit has been reached.
116 Mode_Limit_Reached(CLIENT *Client, int Count)
118 if (Client_Type(Client) == CLIENT_SERVER
119 || Client_Type(Client) == CLIENT_SERVICE)
121 if (Count < MAX_HNDL_MODES_ARG)
128 * Handle client mode requests
130 * @param Client The client from which this command has been received.
131 * @param Req Request structure with prefix and all parameters.
132 * @param Origin The originator of the MODE command (prefix).
133 * @param Target The target (client) of this MODE command.
134 * @returns CONNECTED or DISCONNECTED.
137 Client_Mode( CLIENT *Client, REQUEST *Req, CLIENT *Origin, CLIENT *Target )
139 char the_modes[COMMAND_LEN], x[2], *mode_ptr;
141 bool send_RPL_HOSTHIDDEN_MSG = false;
145 /* Is the client allowed to request or change the modes? */
146 if (Client_Type(Client) == CLIENT_USER) {
147 /* Users are only allowed to manipulate their own modes! */
148 if (Target != Client)
149 return IRC_WriteStrClient(Client,
150 ERR_USERSDONTMATCH_MSG,
154 /* Mode request: let's answer it :-) */
156 return IRC_WriteStrClient(Origin, RPL_UMODEIS_MSG,
158 Client_Modes(Target));
161 mode_ptr = Req->argv[mode_arg];
163 /* Initial state: set or unset modes? */
164 if (*mode_ptr == '+') {
166 strcpy(the_modes, "+");
167 } else if (*mode_ptr == '-') {
169 strcpy(the_modes, "-");
171 return IRC_WriteStrClient(Origin, ERR_UMODEUNKNOWNFLAG_MSG,
179 /* Try next argument if there's any */
181 if (mode_arg < Req->argc)
182 mode_ptr = Req->argv[mode_arg];
190 if ((*mode_ptr == '+' && !set)
191 || (*mode_ptr == '-' && set)) {
192 /* Action modifier ("+"/"-") must be changed */
193 len = strlen(the_modes) - 1;
194 if (the_modes[len] == '+'
195 || the_modes[len] == '-') {
196 /* Last character in the "result
197 * string" was an "action", so just
198 * overwrite it with the new action */
199 the_modes[len] = *mode_ptr;
201 /* Append new modifier character to
202 * the resulting mode string */
204 strlcat(the_modes, x,
207 if (*mode_ptr == '+')
218 case 'C': /* Only messages from clients sharing a channel */
219 case 'i': /* Invisible */
220 case 's': /* Server messages */
221 case 'w': /* Wallops messages */
225 if (Client_Type(Client) == CLIENT_SERVER) {
227 Client_SetAway(Origin, DEFAULT_AWAY_MSG);
229 ok = IRC_WriteStrClient(Origin,
230 ERR_NOPRIVILEGES_MSG,
234 if (Client_HasMode(Client, 'r'))
235 ok = IRC_WriteStrClient(Origin,
241 case 'c': /* Receive connect notices
242 * (only settable by IRC operators!) */
243 if (!set || Client_Type(Client) == CLIENT_SERVER
244 || Client_OperByMe(Origin))
247 ok = IRC_WriteStrClient(Origin,
248 ERR_NOPRIVILEGES_MSG,
251 case 'o': /* IRC operator (only unsettable!) */
252 if (!set || Client_Type(Client) == CLIENT_SERVER) {
253 Client_SetOperByMe(Target, false);
256 ok = IRC_WriteStrClient(Origin,
257 ERR_NOPRIVILEGES_MSG,
260 case 'r': /* Restricted (only settable) */
261 if (set || Client_Type(Client) == CLIENT_SERVER)
264 ok = IRC_WriteStrClient(Origin,
268 case 'R': /* Registered (not [un]settable by clients) */
269 if (Client_Type(Client) == CLIENT_SERVER)
272 ok = IRC_WriteStrClient(Origin,
273 ERR_NICKREGISTER_MSG,
276 case 'x': /* Cloak hostname */
277 if (Client_HasMode(Client, 'r'))
278 ok = IRC_WriteStrClient(Origin,
283 send_RPL_HOSTHIDDEN_MSG = true;
286 if (Client_Type(Client) != CLIENT_SERVER) {
288 "Unknown mode \"%c%c\" from \"%s\"!?",
289 set ? '+' : '-', *mode_ptr,
291 ok = IRC_WriteStrClient(Origin,
292 ERR_UMODEUNKNOWNFLAG2_MSG,
299 "Handling unknown mode \"%c%c\" from \"%s\" for \"%s\" ...",
300 set ? '+' : '-', *mode_ptr,
301 Client_ID(Origin), Client_ID(Target));
309 /* Is there a valid mode change? */
314 if (Client_ModeAdd(Target, x[0]))
315 strlcat(the_modes, x, sizeof(the_modes));
317 if (Client_ModeDel(Target, x[0]))
318 strlcat(the_modes, x, sizeof(the_modes));
322 /* Are there changed modes? */
324 /* Remove needless action modifier characters */
325 len = strlen(the_modes) - 1;
326 if (the_modes[len] == '+' || the_modes[len] == '-')
327 the_modes[len] = '\0';
329 if (Client_Type(Client) == CLIENT_SERVER) {
330 /* Forward modes to other servers */
331 if (Client_Conn(Target) != NONE) {
332 /* Remote server (service?) changed modes
333 * for one of our clients. Inform it! */
334 IRC_WriteStrClientPrefix(Target, Origin,
339 IRC_WriteStrServersPrefix(Client, Origin,
344 /* Send reply to client and inform other servers */
345 ok = IRC_WriteStrClientPrefix(Client, Origin,
349 IRC_WriteStrServersPrefix(Client, Origin,
353 if (send_RPL_HOSTHIDDEN_MSG)
354 IRC_WriteStrClient(Client, RPL_HOSTHIDDEN_MSG,
356 Client_HostnameCloaked(Client));
358 LogDebug("%s \"%s\": Mode change, now \"%s\".",
359 Client_TypeText(Target), Client_Mask(Target),
360 Client_Modes(Target));
363 IRC_SetPenalty(Client, 1);
369 Channel_Mode_Answer_Request(CLIENT *Origin, CHANNEL *Channel)
371 char the_modes[COMMAND_LEN], the_args[COMMAND_LEN], argadd[CLIENT_PASS_LEN];
372 const char *mode_ptr;
374 /* Member or not? -- That's the question! */
375 if (!Channel_IsMemberOf(Channel, Origin))
376 return IRC_WriteStrClient(Origin, RPL_CHANNELMODEIS_MSG,
377 Client_ID(Origin), Channel_Name(Channel), Channel_Modes(Channel));
379 /* The sender is a member: generate extended reply */
380 strlcpy(the_modes, Channel_Modes(Channel), sizeof(the_modes));
381 mode_ptr = the_modes;
387 snprintf(argadd, sizeof(argadd), " %lu", Channel_MaxUsers(Channel));
388 strlcat(the_args, argadd, sizeof(the_args));
391 strlcat(the_args, " ", sizeof(the_args));
392 strlcat(the_args, Channel_Key(Channel), sizeof(the_args));
398 strlcat(the_modes, the_args, sizeof(the_modes));
400 if (!IRC_WriteStrClient(Origin, RPL_CHANNELMODEIS_MSG,
401 Client_ID(Origin), Channel_Name(Channel),
405 if (!IRC_WriteStrClient(Origin, RPL_CREATIONTIME_MSG,
406 Client_ID(Origin), Channel_Name(Channel),
407 Channel_CreationTime(Channel)))
415 * Handle channel mode and channel-user mode changes
418 Channel_Mode(CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel)
420 char the_modes[COMMAND_LEN], the_args[COMMAND_LEN], x[2],
421 argadd[CLIENT_PASS_LEN], *mode_ptr;
422 bool connected, set, skiponce, retval, onchannel, modeok, use_servermode;
423 int mode_arg, arg_arg, mode_arg_count = 0;
428 if (Channel_IsModeless(Channel))
429 return IRC_WriteStrClient(Client, ERR_NOCHANMODES_MSG,
430 Client_ID(Client), Channel_Name(Channel));
432 /* Mode request: let's answer it :-) */
434 return Channel_Mode_Answer_Request(Origin, Channel);
436 Channel_CheckAdminRights(Channel, Client, Origin,
437 &onchannel, &modeok, &use_servermode);
439 if (!onchannel && !modeok)
440 return IRC_WriteStrClient(Origin, ERR_NOTONCHANNEL_MSG,
442 Channel_Name(Channel));
445 mode_ptr = Req->argv[mode_arg];
446 if (Req->argc > mode_arg + 1)
447 arg_arg = mode_arg + 1;
451 /* Initial state: set or unset modes? */
465 /* Prepare reply string */
466 strcpy(the_modes, set ? "+" : "-");
470 connected = CONNECTED;
475 /* Try next argument if there's any */
478 if (arg_arg > mode_arg)
483 if (mode_arg >= Req->argc)
485 mode_ptr = Req->argv[mode_arg];
487 if (Req->argc > mode_arg + 1)
488 arg_arg = mode_arg + 1;
497 if (((*mode_ptr == '+') && !set)
498 || ((*mode_ptr == '-') && set)) {
499 /* Action modifier ("+"/"-") must be changed ... */
500 len = strlen(the_modes) - 1;
501 if (the_modes[len] == '+' || the_modes[len] == '-') {
502 /* Adjust last action modifier in result */
503 the_modes[len] = *mode_ptr;
505 /* Append modifier character to result string */
507 strlcat(the_modes, x, sizeof(the_modes));
509 set = *mode_ptr == '+';
514 /* Are there arguments left? */
515 if (arg_arg >= Req->argc)
523 /* --- Channel modes --- */
524 case 'i': /* Invite only */
525 case 'M': /* Only identified nicks can write */
526 case 'm': /* Moderated */
527 case 'n': /* Only members can write */
528 case 'R': /* Registered users only */
529 case 's': /* Secret channel */
530 case 't': /* Topic locked */
531 case 'z': /* Secure connections only */
535 connected = IRC_WriteStrClient(Origin,
536 ERR_CHANOPRIVSNEEDED_MSG,
537 Client_ID(Origin), Channel_Name(Channel));
539 case 'k': /* Channel key */
540 if (Mode_Limit_Reached(Client, mode_arg_count++))
546 connected = IRC_WriteStrClient(Origin,
547 ERR_CHANOPRIVSNEEDED_MSG,
549 Channel_Name(Channel));
552 if (arg_arg > mode_arg) {
554 Channel_ModeDel(Channel, 'k');
555 Channel_SetKey(Channel,
557 strlcpy(argadd, Channel_Key(Channel),
561 connected = IRC_WriteStrClient(Origin,
562 ERR_CHANOPRIVSNEEDED_MSG,
564 Channel_Name(Channel));
566 Req->argv[arg_arg][0] = '\0';
569 connected = IRC_WriteStrClient(Origin,
570 ERR_NEEDMOREPARAMS_MSG,
571 Client_ID(Origin), Req->command);
575 case 'l': /* Member limit */
576 if (Mode_Limit_Reached(Client, mode_arg_count++))
582 connected = IRC_WriteStrClient(Origin,
583 ERR_CHANOPRIVSNEEDED_MSG,
585 Channel_Name(Channel));
588 if (arg_arg > mode_arg) {
590 l = atol(Req->argv[arg_arg]);
591 if (l > 0 && l < 0xFFFF) {
592 Channel_ModeDel(Channel, 'l');
593 Channel_SetMaxUsers(Channel, l);
594 snprintf(argadd, sizeof(argadd),
599 connected = IRC_WriteStrClient(Origin,
600 ERR_CHANOPRIVSNEEDED_MSG,
602 Channel_Name(Channel));
604 Req->argv[arg_arg][0] = '\0';
607 connected = IRC_WriteStrClient(Origin,
608 ERR_NEEDMOREPARAMS_MSG,
609 Client_ID(Origin), Req->command);
613 case 'O': /* IRC operators only */
615 /* Only IRC operators are allowed to
616 * set the 'O' channel mode! */
617 if (set && !(Client_OperByMe(Client)
618 || Client_Type(Client) == CLIENT_SERVER))
619 connected = IRC_WriteStrClient(Origin,
620 ERR_NOPRIVILEGES_MSG,
625 connected = IRC_WriteStrClient(Origin,
626 ERR_CHANOPRIVSNEEDED_MSG,
628 Channel_Name(Channel));
630 case 'P': /* Persistent channel */
632 /* Only IRC operators are allowed to
633 * set the 'P' channel mode! */
634 if (set && !(Client_OperByMe(Client)
635 || Client_Type(Client) == CLIENT_SERVER))
636 connected = IRC_WriteStrClient(Origin,
637 ERR_NOPRIVILEGES_MSG,
642 connected = IRC_WriteStrClient(Origin,
643 ERR_CHANOPRIVSNEEDED_MSG,
645 Channel_Name(Channel));
647 /* --- Channel user modes --- */
651 if (Client_Type(Client) != CLIENT_SERVER) {
652 connected = IRC_WriteStrClient(Origin,
653 ERR_CHANOPRIVSNEEDED_MSG,
655 Channel_Name(Channel));
658 case 'o': /* Channel operator */
659 case 'v': /* Voice */
660 if (arg_arg > mode_arg) {
662 client = Client_Search(Req->argv[arg_arg]);
666 connected = IRC_WriteStrClient(Client,
671 connected = IRC_WriteStrClient(Origin,
672 ERR_CHANOPRIVSNEEDED_MSG,
674 Channel_Name(Channel));
676 Req->argv[arg_arg][0] = '\0';
679 connected = IRC_WriteStrClient(Origin,
680 ERR_NEEDMOREPARAMS_MSG,
681 Client_ID(Origin), Req->command);
685 /* --- Channel lists --- */
686 case 'I': /* Invite lists */
687 case 'b': /* Ban lists */
688 case 'e': /* Channel exception lists */
689 if (Mode_Limit_Reached(Client, mode_arg_count++))
691 if (arg_arg > mode_arg) {
695 ? Add_To_List(*mode_ptr, Origin,
698 : Del_From_List(*mode_ptr, Origin,
702 connected = IRC_WriteStrClient(Origin,
703 ERR_CHANOPRIVSNEEDED_MSG,
705 Channel_Name(Channel));
707 Req->argv[arg_arg][0] = '\0';
712 Channel_ShowInvites(Origin, Channel);
715 Channel_ShowBans(Origin, Channel);
718 Channel_ShowExcepts(Origin, Channel);
724 if (Client_Type(Client) != CLIENT_SERVER) {
726 "Unknown mode \"%c%c\" from \"%s\" on %s!?",
727 set ? '+' : '-', *mode_ptr,
728 Client_ID(Origin), Channel_Name(Channel));
729 connected = IRC_WriteStrClient(Origin,
731 Client_ID(Origin), *mode_ptr,
732 Channel_Name(Channel));
736 "Handling unknown mode \"%c%c\" from \"%s\" on %s ...",
737 set ? '+' : '-', *mode_ptr,
738 Client_ID(Origin), Channel_Name(Channel));
746 /* Is there a valid mode change? */
750 /* Validate target client */
751 if (client && (!Channel_IsMemberOf(Channel, client))) {
752 if (!IRC_WriteStrClient
753 (Origin, ERR_USERNOTINCHANNEL_MSG,
754 Client_ID(Origin), Client_ID(client),
755 Channel_Name(Channel)))
762 /* Channel-User-Mode */
764 ? Channel_UserModeAdd(Channel, client, x[0])
765 : Channel_UserModeDel(Channel, client, x[0]);
767 strlcat(the_args, " ", sizeof(the_args));
768 strlcat(the_args, Client_ID(client),
770 strlcat(the_modes, x, sizeof(the_modes));
772 ("User \"%s\": Mode change on %s, now \"%s\"",
773 Client_Mask(client), Channel_Name(Channel),
774 Channel_UserModes(Channel, client));
779 ? Channel_ModeAdd(Channel, x[0])
780 : Channel_ModeDel(Channel, x[0]);
782 strlcat(the_modes, x, sizeof(the_modes));
783 LogDebug("Channel %s: Mode change, now \"%s\".",
784 Channel_Name(Channel),
785 Channel_Modes(Channel));
789 /* Are there additional arguments to add? */
791 strlcat(the_args, " ", sizeof(the_args));
792 strlcat(the_args, argadd, sizeof(the_args));
797 /* Are there changed modes? */
799 /* Clean up mode string */
800 len = strlen(the_modes) - 1;
801 if ((the_modes[len] == '+') || (the_modes[len] == '-'))
802 the_modes[len] = '\0';
804 if (Client_Type(Client) == CLIENT_SERVER) {
805 /* MODE requests for local channels from other servers
806 * are definitely invalid! */
807 if (Channel_IsLocal(Channel)) {
808 Log(LOG_ALERT, "Got remote MODE command for local channel!? Ignored.");
812 /* Forward mode changes to channel users and all the
813 * other remote servers: */
814 IRC_WriteStrServersPrefix(Client, Origin,
815 "MODE %s %s%s", Channel_Name(Channel),
816 the_modes, the_args);
817 IRC_WriteStrChannelPrefix(Client, Channel, Origin,
818 false, "MODE %s %s%s", Channel_Name(Channel),
819 the_modes, the_args);
822 Origin = Client_ThisServer();
823 /* Send reply to client and inform other servers and channel users */
824 connected = IRC_WriteStrClientPrefix(Client, Origin,
825 "MODE %s %s%s", Channel_Name(Channel),
826 the_modes, the_args);
827 /* Only forward requests for non-local channels */
828 if (!Channel_IsLocal(Channel))
829 IRC_WriteStrServersPrefix(Client, Origin,
830 "MODE %s %s%s", Channel_Name(Channel),
831 the_modes, the_args);
832 IRC_WriteStrChannelPrefix(Client, Channel, Origin,
833 false, "MODE %s %s%s", Channel_Name(Channel),
834 the_modes, the_args);
838 IRC_SetPenalty(Client, 1);
844 IRC_AWAY( CLIENT *Client, REQUEST *Req )
846 assert( Client != NULL );
847 assert( Req != NULL );
849 if( Req->argc > 1 ) return IRC_WriteStrClient( Client, ERR_NEEDMOREPARAMS_MSG, Client_ID( Client ), Req->command );
851 if(( Req->argc == 1 ) && (Req->argv[0][0] ))
853 Client_SetAway( Client, Req->argv[0] );
854 Client_ModeAdd( Client, 'a' );
855 IRC_WriteStrServersPrefix( Client, Client, "MODE %s :+a", Client_ID( Client ));
856 return IRC_WriteStrClient( Client, RPL_NOWAWAY_MSG, Client_ID( Client ));
860 Client_ModeDel( Client, 'a' );
861 IRC_WriteStrServersPrefix( Client, Client, "MODE %s :-a", Client_ID( Client ));
862 return IRC_WriteStrClient( Client, RPL_UNAWAY_MSG, Client_ID( Client ));
868 * Add entries to channel invite, ban and exception lists.
870 * @param what Can be 'I' for invite, 'b' for ban, and 'e' for exception list.
871 * @param Prefix The originator of the command.
872 * @param Client The sender of the command.
873 * @param Channel The channel of which the list should be modified.
874 * @param Pattern The pattern to add to the list.
875 * @return CONNECTED or DISCONNECTED.
878 Add_To_List(char what, CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel,
882 struct list_head *list = NULL;
883 long int current_count;
885 assert(Client != NULL);
886 assert(Channel != NULL);
887 assert(Pattern != NULL);
888 assert(what == 'I' || what == 'b' || what == 'e');
890 mask = Lists_MakeMask(Pattern);
891 current_count = Lists_Count(Channel_GetListInvites(Channel))
892 + Lists_Count(Channel_GetListExcepts(Channel))
893 + Lists_Count(Channel_GetListBans(Channel));
897 list = Channel_GetListInvites(Channel);
900 list = Channel_GetListBans(Channel);
903 list = Channel_GetListExcepts(Channel);
907 if (Lists_CheckDupeMask(list, mask))
909 if (Client_Type(Client) == CLIENT_USER &&
910 current_count >= MAX_HNDL_CHANNEL_LISTS)
911 return IRC_WriteStrClient(Client, ERR_LISTFULL_MSG,
913 Channel_Name(Channel), mask,
914 MAX_HNDL_CHANNEL_LISTS);
918 if (!Channel_AddInvite(Channel, mask, false))
922 if (!Channel_AddBan(Channel, mask))
926 if (!Channel_AddExcept(Channel, mask))
930 return Send_ListChange(true, what, Prefix, Client, Channel, mask);
935 * Delete entries from channel invite, ban and exeption lists.
937 * @param what Can be 'I' for invite, 'b' for ban, and 'e' for exception list.
938 * @param Prefix The originator of the command.
939 * @param Client The sender of the command.
940 * @param Channel The channel of which the list should be modified.
941 * @param Pattern The pattern to add to the list.
942 * @return CONNECTED or DISCONNECTED.
945 Del_From_List(char what, CLIENT *Prefix, CLIENT *Client, CHANNEL *Channel,
949 struct list_head *list = NULL;
951 assert(Client != NULL);
952 assert(Channel != NULL);
953 assert(Pattern != NULL);
954 assert(what == 'I' || what == 'b' || what == 'e');
956 mask = Lists_MakeMask(Pattern);
960 list = Channel_GetListInvites(Channel);
963 list = Channel_GetListBans(Channel);
966 list = Channel_GetListExcepts(Channel);
970 if (!Lists_CheckDupeMask(list, mask))
972 Lists_Del(list, mask);
974 return Send_ListChange(false, what, Prefix, Client, Channel, mask);
979 * Send information about changed channel invite/ban/exception lists to clients.
981 * @param IsAdd true if the list item has been added, false otherwise.
982 * @param ModeChar The mode to use (e. g. 'b' or 'I')
983 * @param Prefix The originator of the mode list change.
984 * @param Client The sender of the command.
985 * @param Channel The channel of which the list has been modified.
986 * @param Mask The mask which has been added or removed.
987 * @return CONNECTED or DISCONNECTED.
990 Send_ListChange(const bool IsAdd, const char ModeChar, CLIENT *Prefix,
991 CLIENT *Client, CHANNEL *Channel, const char *Mask)
995 /* Send confirmation to the client */
996 if (Client_Type(Client) == CLIENT_USER)
997 ok = IRC_WriteStrClientPrefix(Client, Prefix, "MODE %s %c%c %s",
998 Channel_Name(Channel),
1002 /* to other servers */
1003 IRC_WriteStrServersPrefix(Client, Prefix, "MODE %s %c%c %s",
1004 Channel_Name(Channel), IsAdd ? '+' : '-',
1007 /* and local users in channel */
1008 IRC_WriteStrChannelPrefix(Client, Channel, Prefix, false,
1009 "MODE %s %c%c %s", Channel_Name(Channel),
1010 IsAdd ? '+' : '-', ModeChar, Mask );
1013 } /* Send_ListChange */