From 6606615f1c605c9000f5f0f217a9495a2c4270c3 Mon Sep 17 00:00:00 2001 From: "Kevin L. Mitchell" Date: Fri, 28 Dec 2007 15:52:43 +0000 Subject: [PATCH] Author: Kev Log message: This very simple change adds a +R channel mode that can only be set or reset by remote users (or servers) or with /opmode. This can be used by X to indicate that a channel is registered, a sentinal that C can use to decide when it is legal to reop a channel. git-svn-id: file:///home/klmitch/undernet-ircu/undernet-ircu-svn/ircu2/branches/u2_10_12_branch@1860 c9e4aea6-c8fd-4c43-8297-357d70d61c8c --- ChangeLog | 11 +++++++++++ include/channel.h | 4 +++- include/supported.h | 2 +- ircd/channel.c | 12 +++++++++++- 4 files changed, 26 insertions(+), 3 deletions(-) diff --git a/ChangeLog b/ChangeLog index fe31642..7375462 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2007-12-28 Kevin L. Mitchell + + * ircd/channel.c: add MODE_REGISTERED, mapped to +R; arrange to + only have it settable or clearable by remote users or /opmode + + * include/supported.h (FEATURESVALUES2): update to include 'R' + channel mode + + * include/channel.h: add MODE_REGISTERED, update infochanmodes to + include 'R' channel mode + 2007-12-13 Kevin L. Mitchell * ircd/m_gline.c (ms_gline): if we got an activate or deactivate diff --git a/include/channel.h b/include/channel.h index dc083ea..318cf4c 100644 --- a/include/channel.h +++ b/include/channel.h @@ -101,6 +101,8 @@ struct Client; #define MODE_LIMIT 0x0400 /**< +l Limit */ #define MODE_REGONLY 0x0800 /**< Only +r users may join */ #define MODE_DELJOINS 0x1000 /**< New join messages are delayed */ +#define MODE_REGISTERED 0x2000 /**< Channel marked as registered + * (for future semantic expansion) */ #define MODE_SAVE 0x20000 /**< save this mode-with-arg 'til * later */ #define MODE_FREE 0x40000 /**< string needs to be passed to @@ -115,7 +117,7 @@ struct Client; #define MODE_WPARAS (MODE_CHANOP|MODE_VOICE|MODE_BAN|MODE_KEY|MODE_LIMIT|MODE_APASS|MODE_UPASS) /** Available Channel modes */ -#define infochanmodes feature_bool(FEAT_OPLEVELS) ? "AbiklmnopstUvrD" : "biklmnopstvrD" +#define infochanmodes feature_bool(FEAT_OPLEVELS) ? "AbiklmnopstUvrDR" : "biklmnopstvrDR" /** Available Channel modes that take parameters */ #define infochanmodeswithparams feature_bool(FEAT_OPLEVELS) ? "AbkloUv" : "bklov" diff --git a/include/supported.h b/include/supported.h index b3a8ac0..9f3a089 100644 --- a/include/supported.h +++ b/include/supported.h @@ -65,7 +65,7 @@ #define FEATURESVALUES2 NICKLEN, TOPICLEN, AWAYLEN, TOPICLEN, \ feature_int(FEAT_CHANNELLEN), CHANNELLEN, \ (feature_bool(FEAT_LOCAL_CHANNELS) ? "#&" : "#"), "(ov)@+", "@+", \ - (feature_bool(FEAT_OPLEVELS) ? "b,AkU,l,imnpstrDd" : "b,k,l,imnpstrDd"), \ + (feature_bool(FEAT_OPLEVELS) ? "b,AkU,l,imnpstrDdR" : "b,k,l,imnpstrDdR"), \ "rfc1459", feature_str(FEAT_NETWORK) #endif /* INCLUDED_supported_h */ diff --git a/ircd/channel.c b/ircd/channel.c index d6e72c8..d481541 100644 --- a/ircd/channel.c +++ b/ircd/channel.c @@ -832,6 +832,8 @@ void channel_modes(struct Client *cptr, char *mbuf, char *pbuf, int buflen, *mbuf++ = 'D'; else if (MyUser(cptr) && (chptr->mode.mode & MODE_WASDELJOINS)) *mbuf++ = 'd'; + if (chptr->mode.mode & MODE_REGISTERED) + *mbuf++ = 'R'; if (chptr->mode.limit) { *mbuf++ = 'l'; ircd_snprintf(0, pbuf, buflen, "%u", chptr->mode.limit); @@ -1540,6 +1542,7 @@ modebuf_flush_int(struct ModeBuf *mbuf, int all) MODE_NOPRIVMSGS, 'n', MODE_REGONLY, 'r', MODE_DELJOINS, 'D', + MODE_REGISTERED, 'R', /* MODE_KEY, 'k', */ /* MODE_BAN, 'b', */ MODE_LIMIT, 'l', @@ -1953,7 +1956,7 @@ modebuf_mode(struct ModeBuf *mbuf, unsigned int mode) mode &= (MODE_ADD | MODE_DEL | MODE_PRIVATE | MODE_SECRET | MODE_MODERATED | MODE_TOPICLIMIT | MODE_INVITEONLY | MODE_NOPRIVMSGS | MODE_REGONLY | - MODE_DELJOINS | MODE_WASDELJOINS); + MODE_DELJOINS | MODE_WASDELJOINS | MODE_REGISTERED); if (!(mode & ~(MODE_ADD | MODE_DEL))) /* don't add empty modes... */ return; @@ -2113,6 +2116,7 @@ modebuf_extract(struct ModeBuf *mbuf, char *buf) MODE_KEY, 'k', MODE_APASS, 'A', MODE_UPASS, 'U', + MODE_REGISTERED, 'R', /* MODE_BAN, 'b', */ MODE_LIMIT, 'l', MODE_REGONLY, 'r', @@ -3178,6 +3182,11 @@ mode_parse_mode(struct ParseState *state, int *flag_p) if (!state->mbuf) return; + /* Local users are not permitted to change registration status */ + if (flag_p[0] == MODE_REGISTERED && !(state->flags & MODE_PARSE_FORCE) && + MyUser(state->sptr)) + return; + if (state->dir == MODE_ADD) { state->add |= flag_p[0]; state->del &= ~flag_p[0]; @@ -3221,6 +3230,7 @@ mode_parse(struct ModeBuf *mbuf, struct Client *cptr, struct Client *sptr, MODE_KEY, 'k', MODE_APASS, 'A', MODE_UPASS, 'U', + MODE_REGISTERED, 'R', MODE_BAN, 'b', MODE_LIMIT, 'l', MODE_REGONLY, 'r', -- 2.20.1