From: Alexander Barton Date: Sat, 6 Oct 2012 20:37:57 +0000 (+0200) Subject: Merge branch 'bug141-ModesQq' X-Git-Tag: rel-20-rc1~47 X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=ngircd-alex.git;a=commitdiff_plain;h=c9d166747d4ea161c55c765edc23e2cd3bd7dec4;hp=-c Merge branch 'bug141-ModesQq' This closes bug #141. * bug141-ModesQq: KICK-protect IRC services Implement channel mode "Q" and user mode "q" Conflicts: src/ngircd/defines.h src/ngircd/messages.h --- c9d166747d4ea161c55c765edc23e2cd3bd7dec4 diff --combined doc/Modes.txt index 48ec5d95,fb784511..8d7cdd70 --- a/doc/Modes.txt +++ b/doc/Modes.txt @@@ -27,6 -27,7 +27,7 @@@ channels he is using at the moment C 19 Only users that share a channel are allowed to send messages. i 0.0.1 User is "invisible". o 0.0.1 User is IRC operator. + q 20 User is protected, can not be kicked from a channel. r 0.0.1 User is restricted. R (1) 19 User is registered (e.g. by NickServ). s 0.4.0 User wants to receive server notices. @@@ -54,11 -55,11 +55,12 @@@ users to lists (e.g. "invite list", "ba n 0.3.0 Channel doesn't allow messages of users not being members. O 18 Only IRC operators are allowed to join this channel. P 0.5.0 Channel is "persistent". + Q 20 Nobody can be kicked from the channel. r (1) 19 Channel is "registered" (e.g. by ChanServ). R 19 Only registered users are allowed to join this channel. s 0.9.0 Channel is "secret". t 0.3.0 Only ChanOps are allowed to modify the channel topic. + V 20 Channel doesn't allow invites. z 16 Only users connected via SSL are allowed to join the channel. III. Channel User Modes diff --combined src/ngircd/defines.h index 1eb3337d,c0be813a..37ca6764 --- a/src/ngircd/defines.h +++ b/src/ngircd/defines.h @@@ -161,10 -161,10 +161,10 @@@ #endif /** Supported user modes. */ - #define USERMODES "aBcCiorRswx" + #define USERMODES "aBcCioqrRswx" /** Supported channel modes. */ - #define CHANMODES "abehiIklmMnoOPqrRstvVz" -#define CHANMODES "abehiIklmMnoOPqQrRstvz" ++#define CHANMODES "abehiIklmMnoOPqQrRstvVz" /** Away message for users connected to linked servers. */ #define DEFAULT_AWAY_MSG "Away" diff --combined src/ngircd/irc-mode.c index a08d4d92,7f04e9c5..c7d02c91 --- a/src/ngircd/irc-mode.c +++ b/src/ngircd/irc-mode.c @@@ -257,6 -257,15 +257,15 @@@ Client_Mode( CLIENT *Client, REQUEST *R ERR_NOPRIVILEGES_MSG, Client_ID(Origin)); break; + case 'q': /* KICK-protected user */ + if (!set || Client_Type(Client) == CLIENT_SERVER + || Client_OperByMe(Origin)) + x[0] = 'q'; + else + ok = IRC_WriteStrClient(Origin, + ERR_NOPRIVILEGES_MSG, + Client_ID(Origin)); + break; case 'r': /* Restricted (only settable) */ if (set || Client_Type(Client) == CLIENT_SERVER) x[0] = 'r'; @@@ -566,10 -575,10 +575,11 @@@ Channel_Mode(CLIENT *Client, REQUEST *R goto chan_exit; } case 'i': /* Invite only */ + case 'V': /* Invite disallow */ case 'M': /* Only identified nicks can write */ case 'm': /* Moderated */ case 'n': /* Only members can write */ + case 'Q': /* No kicks */ case 't': /* Topic locked */ if(is_oper || is_machine || is_owner || is_admin || is_op || is_halfop) @@@ -698,9 -707,9 +708,9 @@@ /* --- Channel user modes --- */ case 'q': /* Owner */ case 'a': /* Channel admin */ - if(!is_oper && !is_machine && !is_owner) { + if(!is_oper && !is_machine && !is_owner && !is_admin) { connected = IRC_WriteStrClient(Origin, - ERR_CHANOPRIVSNEEDED_MSG, + ERR_CHANOPPRIVTOOLOW_MSG, Client_ID(Origin), Channel_Name(Channel)); goto chan_exit; diff --combined src/ngircd/messages.h index ac75daf9,ea24b2eb..b94a999a --- a/src/ngircd/messages.h +++ b/src/ngircd/messages.h @@@ -21,7 -21,7 +21,7 @@@ #define RPL_YOURHOST_MSG "002 %s :Your host is %s, running version ngircd-%s (%s/%s/%s)" #define RPL_CREATED_MSG "003 %s :This server has been started %s" #define RPL_MYINFO_MSG "004 %s %s ngircd-%s %s %s" - #define RPL_ISUPPORT1_MSG "005 %s RFC2812 IRCD=ngIRCd CHARSET=UTF-8 CASEMAPPING=ascii PREFIX=(qaohv)~&@%%+ CHANTYPES=#&+ CHANMODES=beI,k,l,imMnOPRstVz CHANLIMIT=#&+:%d :are supported on this server" -#define RPL_ISUPPORT1_MSG "005 %s RFC2812 IRCD=ngIRCd CASEMAPPING=ascii PREFIX=(qaohv)~&@%%+ CHANTYPES=#&+ CHANMODES=beI,k,l,imMnOPQRstz CHANLIMIT=#&+:%d :are supported on this server" ++#define RPL_ISUPPORT1_MSG "005 %s RFC2812 IRCD=ngIRCd CHARSET=UTF-8 CASEMAPPING=ascii PREFIX=(qaohv)~&@%%+ CHANTYPES=#&+ CHANMODES=beI,k,l,imMnOPQRstVz CHANLIMIT=#&+:%d :are supported on this server" #define RPL_ISUPPORT2_MSG "005 %s CHANNELLEN=%d NICKLEN=%d TOPICLEN=%d AWAYLEN=%d KICKLEN=%d MODES=%d MAXLIST=beI:%d EXCEPTS=e INVEX=I PENALTY :are supported on this server" #define RPL_TRACELINK_MSG "200 %s Link %s-%s %s %s V%s %ld %d %d" @@@ -34,6 -34,7 +34,6 @@@ #define RPL_UMODEIS_MSG "221 %s +%s" #define RPL_SERVLIST_MSG "234 %s %s %s %s %d %d :%s" #define RPL_SERVLISTEND_MSG "235 %s %s %s :End of service listing" - #define RPL_STATSUPTIME "242 %s :Server Up %u days %u:%02u:%02u" #define RPL_LUSERCLIENT_MSG "251 %s :There are %ld users and %ld services on %ld servers" #define RPL_LUSEROP_MSG "252 %s %lu :operator(s) online" @@@ -92,7 -93,6 +92,7 @@@ #define RPL_MOTDSTART_MSG "375 %s :- %s message of the day" #define RPL_ENDOFMOTD_MSG "376 %s :End of MOTD command" #define RPL_WHOISHOST_MSG "378 %s %s :is connecting from *@%s %s" +#define RPL_WHOISMODES_MSG "379 %s %s :is using modes +%s" #define RPL_YOUREOPER_MSG "381 %s :You are now an IRC Operator" #define RPL_REHASHING_MSG "382 %s :Rehashing" #define RPL_YOURESERVICE_MSG "383 %s :You are service %s" @@@ -140,6 -140,7 +140,7 @@@ #define ERR_NOPRIVILEGES_MSG "481 %s :Permission denied" #define ERR_CHANOPRIVSNEEDED_MSG "482 %s %s :You are not channel operator" #define ERR_CHANOPPRIVTOOLOW_MSG "482 %s %s :Your privileges are too low" + #define ERR_KICKDENY_MSG "482 %s %s :Cannot kick, %s is protected" #define ERR_CANTKILLSERVER_MSG "483 %s :You can't kill a server!" #define ERR_RESTRICTED_MSG "484 %s :Your connection is restricted" #define ERR_NICKREGISTER_MSG "484 %s :Cannot modify user mode (+R) -- Use IRC services" @@@ -149,20 -150,11 +150,20 @@@ #define ERR_UMODEUNKNOWNFLAG_MSG "501 %s :Unknown mode" #define ERR_UMODEUNKNOWNFLAG2_MSG "501 %s :Unknown mode \"%c%c\"" #define ERR_USERSDONTMATCH_MSG "502 %s :Can't set/get mode for other users" +#define ERR_NOINVITE_MSG "518 %s :Cannot invite to %s (+V)" #ifdef ZLIB -#define RPL_STATSLINKINFOZIP_MSG "211 %s %s %d %ld %ld/%ld %ld %ld/%ld :%ld" +# define RPL_STATSLINKINFOZIP_MSG "211 %s %s %d %ld %ld/%ld %ld %ld/%ld :%ld" #endif +#ifdef IRCPLUS + +# define RPL_IP_CHARCONV_MSG "801 %s %s :Client encoding set" + +# define ERR_IP_CHARCONV_MSG "851 %s :Can't initialize client encoding" + +#endif /* IRCPLUS */ + #endif /* -eof- */