about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ngircd/defines.h2
-rw-r--r--src/ngircd/irc-channel.c14
-rw-r--r--src/ngircd/irc-mode.c3
-rw-r--r--src/ngircd/messages.h1
4 files changed, 15 insertions, 5 deletions
diff --git a/src/ngircd/defines.h b/src/ngircd/defines.h
index 010dd8ea..94c7dd1e 100644
--- a/src/ngircd/defines.h
+++ b/src/ngircd/defines.h
@@ -81,7 +81,7 @@
 					   in seconds. */
 
 #define USERMODES "aiorsw"		/* Supported user modes. */
-#define CHANMODES "biIklmnoPstv"	/* Supported channel modes. */
+#define CHANMODES "biIklmnoPstvz"	/* Supported channel modes. */
 
 #define CONNECTED true			/* Internal status codes. */
 #define DISCONNECTED false
diff --git a/src/ngircd/irc-channel.c b/src/ngircd/irc-channel.c
index 010be352..1014d3aa 100644
--- a/src/ngircd/irc-channel.c
+++ b/src/ngircd/irc-channel.c
@@ -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;
 }
 
diff --git a/src/ngircd/irc-mode.c b/src/ngircd/irc-mode.c
index 9509fb01..d22d32f0 100644
--- a/src/ngircd/irc-mode.c
+++ b/src/ngircd/irc-mode.c
@@ -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
@@ -401,6 +401,7 @@ Channel_Mode(CLIENT *Client, REQUEST *Req, CLIENT *Origin, CHANNEL *Channel)
 		case 'n': /* Only members can write */
 		case 's': /* Secret channel */
 		case 't': /* Topic locked */
+		case 'z': /* Secure connections only */
 			if (modeok)
 				x[0] = *mode_ptr;
 			else
diff --git a/src/ngircd/messages.h b/src/ngircd/messages.h
index 59c6cdb9..e15bf166 100644
--- a/src/ngircd/messages.h
+++ b/src/ngircd/messages.h
@@ -113,6 +113,7 @@
 #define ERR_ALREADYREGISTRED_MSG	"462 %s :Connection already registered"
 #define ERR_PASSWDMISMATCH_MSG		"464 %s :Invalid password"
 #define ERR_CHANNELISFULL_MSG		"471 %s %s :Cannot join channel (+l)"
+#define ERR_SECURECHANNEL_MSG		"471 %s %s :Cannot join channel (+z)"
 #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)"