summaryrefslogtreecommitdiff
path: root/miniircd
diff options
context:
space:
mode:
authorJoel Rosdahl <joel@rosdahl.net>2011-11-22 23:03:52 +0100
committerJoel Rosdahl <joel@rosdahl.net>2011-11-23 22:24:48 +0100
commit3517616a73f47217f20b7ebe0a1cace73253ef1d (patch)
tree2e723e2cd6fbae3c5938d1c885b320483fe77b9e /miniircd
parent60b4d67273ef0aaf04d9364b7f1317c61018229e (diff)
downloadminiircd-3517616a73f47217f20b7ebe0a1cace73253ef1d.tar.gz
miniircd-3517616a73f47217f20b7ebe0a1cace73253ef1d.zip
Refactor code into Server.add_channel function
Diffstat (limited to 'miniircd')
-rwxr-xr-xminiircd9
1 files changed, 6 insertions, 3 deletions
diff --git a/miniircd b/miniircd
index 74f1fc6..f0d5a01 100755
--- a/miniircd
+++ b/miniircd
@@ -205,7 +205,6 @@ class Client(object):
continue
server.add_member_to_channel(self, channelname)
channel = server.get_channel(channelname)
- self.channels[irc_lower(channelname)] = channel
self.message_channel(channel, "JOIN", channelname, True)
self.channel_log(channel, "joined", meta=True)
if channel.topic:
@@ -640,8 +639,7 @@ class Server(object):
if irc_lower(channelname) in self.channels:
channel = self.channels[irc_lower(channelname)]
else:
- channel = Channel(self, channelname)
- self.channels[irc_lower(channelname)] = channel
+ channel = self.add_channel(channelname)
channel.add_member(client)
def remove_member_from_channel(self, client, channelname):
@@ -659,6 +657,11 @@ class Server(object):
del self.nicknames[irc_lower(client.nickname)]
del self.clients[client.socket]
+ def add_channel(self, name):
+ channel = Channel(self, channelname)
+ self.channels[irc_lower(channelname)] = channel
+ return channel
+
def remove_channel(self, channel):
del self.channels[irc_lower(channel.name)]