Author: Kev <klmitch@mit.edu>
authorKevin L. Mitchell <klmitch@mit.edu>
Fri, 28 Dec 2007 15:52:43 +0000 (15:52 +0000)
committerKevin L. Mitchell <klmitch@mit.edu>
Fri, 28 Dec 2007 15:52:43 +0000 (15:52 +0000)
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
include/channel.h
include/supported.h
ircd/channel.c

index fe31642c7756cec252e58cf12653aac4d582e6c3..7375462c3252e0a40806a8fc632f432384491f50 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2007-12-28  Kevin L. Mitchell  <klmitch@mit.edu>
+
+       * 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  <klmitch@mit.edu>
 
        * ircd/m_gline.c (ms_gline): if we got an activate or deactivate
index dc083eacae509843d9303577538620644627623d..318cf4c124e7e2ac0439437f2a10ef69bc9ae645 100644 (file)
@@ -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"
 
index b3a8ac00fb2cc84e43c688dd71e8b531ba3b4b8d..9f3a089cd0244d334d31f4523ae41e88023c47a7 100644 (file)
@@ -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 */
index d6e72c8a7c41496eef2037c487485d2a8a3637d1..d481541955530cc2f4fe00a6f446a71b6ff68905 100644 (file)
@@ -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',