about summary refs log tree commit diff
diff options
context:
space:
mode:
authorDNS777 <dns@rbose.org>2012-09-25 13:08:39 +0200
committerAlexander Barton <alex@barton.de>2012-09-25 13:08:39 +0200
commit808c291c76b7ecb4ae13b6ee12e8afe658b627c1 (patch)
treee294d774a105550b3649d18866411704f237e540
parent62a07596d6a3a8da206bde8d34edc8b02781d33d (diff)
downloadngircd-808c291c76b7ecb4ae13b6ee12e8afe658b627c1.tar.gz
ngircd-808c291c76b7ecb4ae13b6ee12e8afe658b627c1.zip
New configuration option "OperChanPAutoOp"
If disabled, IRC operators don't become channel operators in persistent
channels when joining. Enabled by default, which has been the behavior
of ngIRCd up to this patch.

Closes bug #135.

(Cosmetic fixes by Alex.)
-rw-r--r--doc/sample-ngircd.conf.tmpl3
-rw-r--r--man/ngircd.conf.5.tmpl4
-rw-r--r--src/ngircd/conf.c7
-rw-r--r--src/ngircd/conf.h3
-rw-r--r--src/ngircd/irc-channel.c6
5 files changed, 21 insertions, 2 deletions
diff --git a/doc/sample-ngircd.conf.tmpl b/doc/sample-ngircd.conf.tmpl
index 57e65892..018855d5 100644
--- a/doc/sample-ngircd.conf.tmpl
+++ b/doc/sample-ngircd.conf.tmpl
@@ -165,6 +165,9 @@
 	# they are not(!) channel-operators?
 	;OperCanUseMode = no
 
+	# Should IRC Operators get AutoOp (+o) in persistent (+P) channels?
+	;OperChanPAutoOp = yes
+
 	# Mask IRC Operator mode requests as if they were coming from the
 	# server? (This is a compatibility hack for ircd-irc2 servers)
 	;OperServerMode = no
diff --git a/man/ngircd.conf.5.tmpl b/man/ngircd.conf.5.tmpl
index aff11a67..c03cf740 100644
--- a/man/ngircd.conf.5.tmpl
+++ b/man/ngircd.conf.5.tmpl
@@ -268,6 +268,10 @@ while connecting. Default: no.
 Should IRC Operators be allowed to use the MODE command even if they are
 not(!) channel-operators? Default: no.
 .TP
+\fBOperChanPAutoOp\fR (boolean)
+Should IRC Operators get AutoOp (+o) in persistent (+P) channels?
+Default: yes.
+.TP
 \fBOperServerMode\fR (boolean)
 If \fBOperCanUseMode\fR is enabled, this may lead the compatibility problems
 with Servers that run the ircd-irc2 Software. This Option "masks" mode
diff --git a/src/ngircd/conf.c b/src/ngircd/conf.c
index 0052de8f..4ac37ad4 100644
--- a/src/ngircd/conf.c
+++ b/src/ngircd/conf.c
@@ -372,6 +372,7 @@ Conf_Test( void )
 	printf("  MorePrivacy = %s\n", yesno_to_str(Conf_MorePrivacy));
 	printf("  NoticeAuth = %s\n", yesno_to_str(Conf_NoticeAuth));
 	printf("  OperCanUseMode = %s\n", yesno_to_str(Conf_OperCanMode));
+	printf("  OperChanPAutoOp = %s\n", yesno_to_str(Conf_OperChanPAutoOp));
 	printf("  OperServerMode = %s\n", yesno_to_str(Conf_OperServerMode));
 #ifdef PAM
 	printf("  PAM = %s\n", yesno_to_str(Conf_PAM));
@@ -733,6 +734,7 @@ Set_Defaults(bool InitServers)
 	Conf_MorePrivacy = false;
 	Conf_NoticeAuth = false;
 	Conf_OperCanMode = false;
+	Conf_OperChanPAutoOp = true;
 	Conf_OperServerMode = false;
 #ifdef PAM
 	Conf_PAM = true;
@@ -1181,6 +1183,7 @@ CheckLegacyGlobalOption(int Line, char *Var, char *Arg)
 	    || strcasecmp(Var, "ConnectIPv4") == 0
 	    || strcasecmp(Var, "ConnectIPv6") == 0
 	    || strcasecmp(Var, "OperCanUseMode") == 0
+	    || strcasecmp(Var, "OperChanPAutoOp") == 0
 	    || strcasecmp(Var, "OperServerMode") == 0
 	    || strcasecmp(Var, "PredefChannelsOnly") == 0
 	    || strcasecmp(Var, "SyslogFacility") == 0
@@ -1556,6 +1559,10 @@ Handle_OPTIONS(int Line, char *Var, char *Arg)
 		Conf_OperCanMode = Check_ArgIsTrue(Arg);
 		return;
 	}
+	if (strcasecmp(Var, "OperChanPAutoOp") == 0) {
+		Conf_OperChanPAutoOp = Check_ArgIsTrue(Arg);
+		return;
+	}
 	if (strcasecmp(Var, "OperServerMode") == 0) {
 		Conf_OperServerMode = Check_ArgIsTrue(Arg);
 		return;
diff --git a/src/ngircd/conf.h b/src/ngircd/conf.h
index 7a4e38aa..90d74d20 100644
--- a/src/ngircd/conf.h
+++ b/src/ngircd/conf.h
@@ -151,6 +151,9 @@ GLOBAL bool Conf_PredefChannelsOnly;
 /** Flag indicating if IRC operators are allowed to always use MODE (true) */
 GLOBAL bool Conf_OperCanMode;
 
+/** Flag indicating if IRC operators get AutoOp in persistent (+P) channels */
+GLOBAL bool Conf_OperChanPAutoOp;
+
 /**
  * If true, mask channel MODE commands of IRC operators to the server.
  * Background: ircd2 will ignore channel MODE commands if an IRC operator
diff --git a/src/ngircd/irc-channel.c b/src/ngircd/irc-channel.c
index 72fbdc24..4a157d67 100644
--- a/src/ngircd/irc-channel.c
+++ b/src/ngircd/irc-channel.c
@@ -167,8 +167,10 @@ join_set_channelmodes(CHANNEL *chan, CLIENT *target, const char *flags)
 		}
 	}
 
-	/* If channel persistent and client is ircop: make client chanop */
-	if (strchr(Channel_Modes(chan), 'P') && strchr(Client_Modes(target), 'o'))
+	/* If the channel is persistent (+P) and client is an IRC op:
+	 * make client chanop, if not disabled in configuration. */
+	if (strchr(Channel_Modes(chan), 'P') && Conf_OperChanPAutoOp
+	    && strchr(Client_Modes(target), 'o'))
 		Channel_UserModeAdd(chan, target, 'o');
 } /* join_set_channelmodes */