]> arthur.barton.de Git - ngircd-alex.git/commitdiff
Implemented user mode "R" and channel mode "R"
authorAlexander Barton <alex@barton.de>
Fri, 26 Aug 2011 13:26:38 +0000 (15:26 +0200)
committerAlexander Barton <alex@barton.de>
Fri, 26 Aug 2011 13:26:38 +0000 (15:26 +0200)
 - User mode "R": indicates that the nick name of this user is "registered".
   This mode isn't handled by ngIRCd itself, but must be set and unset by
   IRC services like Anope.

 - Channel mode "R": only registered users (having the user mode "R" set)
   are allowed to join this channel.

src/ngircd/defines.h
src/ngircd/irc-channel.c
src/ngircd/irc-mode.c
src/ngircd/messages.h

index 8f62279df460b838d9315a5a58105c15148ac6e8..8db59e892921efe47ba362e344fb3b16dfe54faf 100644 (file)
@@ -82,8 +82,8 @@
 #define RECONNECT_DELAY 3              /* Time to delay re-connect attempts
                                           in seconds. */
 
 #define RECONNECT_DELAY 3              /* Time to delay re-connect attempts
                                           in seconds. */
 
-#define USERMODES "aciorswx"           /* Supported user modes. */
-#define CHANMODES "biIklmnoOPstvz"     /* Supported channel modes. */
+#define USERMODES "aciorRswx"          /* Supported user modes. */
+#define CHANMODES "biIklmnoOPRstvz"    /* Supported channel modes. */
 
 #define CONNECTED true                 /* Internal status codes. */
 #define DISCONNECTED false
 
 #define CONNECTED true                 /* Internal status codes. */
 #define DISCONNECTED false
index 66b3eeb24ed9677d4950709ac5fc06afe6c42b50..233e1731fa0e8b8124f0581e2dcb84429c5dbbc6 100644 (file)
@@ -137,6 +137,13 @@ join_allowed(CLIENT *Client, CHANNEL *chan, const char *channame,
                return false;
        }
 
                return false;
        }
 
+       if (strchr(channel_modes, 'R') && !strchr(Client_Modes(Client), 'R')) {
+               /* Only registered users are allowed! */
+               IRC_WriteStrClient(Client, ERR_REGONLYCHANNEL_MSG,
+                                  Client_ID(Client), channame);
+               return false;
+       }
+
        return true;
 } /* join_allowed */
 
        return true;
 } /* join_allowed */
 
index 3cceaeb898af3d90dd8df5b35daca4c438a00893..ba44a3ba286f1e592058b2fced15e262183c747d 100644 (file)
@@ -479,6 +479,7 @@ Channel_Mode(CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel)
                case 'i': /* Invite only */
                case 'm': /* Moderated */
                case 'n': /* Only members can write */
                case 'i': /* Invite only */
                case 'm': /* Moderated */
                case 'n': /* Only members can write */
+               case 'R': /* Registered users only */
                case 's': /* Secret channel */
                case 't': /* Topic locked */
                case 'z': /* Secure connections only */
                case 's': /* Secret channel */
                case 't': /* Topic locked */
                case 'z': /* Secure connections only */
index 12791d23d3a4ed319e34910d27bc3a25cf333524..78ac06893c6347e4c0fe9871d314c9eb5e176ff8 100644 (file)
 #define ERR_CHANNELISFULL_MSG          "471 %s %s :Cannot join channel (+l)"
 #define ERR_SECURECHANNEL_MSG          "471 %s %s :Cannot join channel (+z)"
 #define ERR_OPONLYCHANNEL_MSG          "471 %s %s :Cannot join channel (+O)"
 #define ERR_CHANNELISFULL_MSG          "471 %s %s :Cannot join channel (+l)"
 #define ERR_SECURECHANNEL_MSG          "471 %s %s :Cannot join channel (+z)"
 #define ERR_OPONLYCHANNEL_MSG          "471 %s %s :Cannot join channel (+O)"
+#define ERR_REGONLYCHANNEL_MSG         "471 %s %s :Cannot join channel (+R)"
 #define ERR_UNKNOWNMODE_MSG            "472 %s: %c :is unknown mode char for %s"
 #define ERR_INVITEONLYCHAN_MSG         "473 %s %s :Cannot join channel (+i)"
 #define ERR_BANNEDFROMCHAN_MSG         "474 %s %s :Cannot join channel (+b)"
 #define ERR_UNKNOWNMODE_MSG            "472 %s: %c :is unknown mode char for %s"
 #define ERR_INVITEONLYCHAN_MSG         "473 %s %s :Cannot join channel (+i)"
 #define ERR_BANNEDFROMCHAN_MSG         "474 %s %s :Cannot join channel (+b)"