From 913018368ba2eb61e06e655757b34ad7313d8176 Mon Sep 17 00:00:00 2001 From: Bob Mottram Date: Mon, 24 May 2021 11:16:44 +0100 Subject: [PATCH] Check channel --- README.md | 4 ++++ miniircd | 34 ++++++++++++++++++---------------- 2 files changed, 22 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 2786523..e822b4b 100644 --- a/README.md +++ b/README.md @@ -167,6 +167,10 @@ Messages can be filtered. Filters can also contain wildcard characters. To assign other operators who can help with moderation: /mode +o #channel [nickname] + +To only allow registered users onto channels: + + /mode +M License diff --git a/miniircd b/miniircd index f9473af..e3dac6b 100755 --- a/miniircd +++ b/miniircd @@ -780,23 +780,25 @@ class Client: meta=True ) elif flag == b"+M" or flag == b"+R": - if not self.server.registered_only: - self.server.registered_only = True - self.message_channel( - channel, - b"MODE", - b"%s -M" % (channel.name), - True - ) + if irc_lower(channel.name) in self.channels: + if not self.server.registered_only: + self.server.registered_only = True + self.message_channel( + channel, + b"MODE", + b"%s -M" % (channel.name), + True + ) elif flag == b"-M" or flag == b"-R": - if self.server.registered_only: - self.server.registered_only = False - self.message_channel( - channel, - b"MODE", - b"%s -M" % (channel.name), - True - ) + if irc_lower(channel.name) in self.channels: + if self.server.registered_only: + self.server.registered_only = False + self.message_channel( + channel, + b"MODE", + b"%s -M" % (channel.name), + True + ) else: self.reply( b"472 %s %s :Unknown MODE flag" % (self.nickname, flag)