]> arthur.barton.de Git - ngircd-alex.git/blobdiff - src/ngircd/irc-channel.c
Implemented new "secure clients only" channel mode: +z
[ngircd-alex.git] / src / ngircd / irc-channel.c
index 010be3520d42b42f366e3bdabde946334cc48957..1014d3aa469f4b158b2e66842def42a66fba6878 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * ngIRCd -- The Next Generation IRC Daemon
- * Copyright (c)2001-2008 Alexander Barton (alex@barton.de)
+ * Copyright (c)2001-2010 Alexander Barton (alex@barton.de)
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
@@ -93,7 +93,7 @@ join_allowed(CLIENT *Client, CHANNEL *chan, const char *channame,
        }
 
        channel_modes = Channel_Modes(chan);
-       if ((strchr(channel_modes, 'i')) && !is_invited) {
+       if (strchr(channel_modes, 'i') && !is_invited) {
                /* Channel is "invite-only" and client is not on invite list */
                IRC_WriteStrClient(Client, ERR_INVITEONLYCHAN_MSG,
                                   Client_ID(Client), channame);
@@ -108,7 +108,7 @@ join_allowed(CLIENT *Client, CHANNEL *chan, const char *channame,
                return false;
        }
 
-       if ((strchr(channel_modes, 'l')) &&
+       if (strchr(channel_modes, 'l') &&
            (Channel_MaxUsers(chan) <= Channel_MemberCount(chan))) {
                /* There are more clints joined to this channel than allowed */
                IRC_WriteStrClient(Client, ERR_CHANNELISFULL_MSG,
@@ -116,6 +116,14 @@ join_allowed(CLIENT *Client, CHANNEL *chan, const char *channame,
                return false;
        }
 
+       if (strchr(channel_modes, 'z') && !Conn_UsesSSL(Client_Conn(Client))) {
+               /* Only "secure" clients are allowed, but clients doesn't
+                * use SSL encryption */
+               IRC_WriteStrClient(Client, ERR_SECURECHANNEL_MSG,
+                                  Client_ID(Client), channame);
+               return false;
+       }
+
        return true;
 }