Use Channel class when creating Server

This commit is contained in:
nemunaire 2015-10-29 12:35:43 +01:00
parent 2fdef0afe4
commit e4d67ec345
2 changed files with 5 additions and 5 deletions

View File

@ -46,7 +46,7 @@ class IRC(SocketServer):
realname -- the bot's realname realname -- the bot's realname
encoding -- the encoding used on the whole server encoding -- the encoding used on the whole server
caps -- client capabilities to register on the server caps -- client capabilities to register on the server
channels -- list of channels to join on connection (if a channel is password protected, give a tuple: (channel_name, password)) channels -- list of channels to join on connection
on_connect -- generator to call when connection is done on_connect -- generator to call when connection is done
""" """
@ -134,10 +134,10 @@ class IRC(SocketServer):
self.write(oc) self.write(oc)
# Then, JOIN some channels # Then, JOIN some channels
for chn in channels: for chn in channels:
if isinstance(chn, tuple): if chn.password:
self.write("JOIN %s %s" % chn) self.write("JOIN %s %s" % (chn.name, chn.password))
else: else:
self.write("JOIN %s" % chn) self.write("JOIN %s" % chn.name)
self.hookscmd["001"] = _on_connect self.hookscmd["001"] = _on_connect
# Respond to ERROR # Respond to ERROR

View File

@ -132,7 +132,7 @@ class ServerConfig:
self.caps += parent.caps self.caps += parent.caps
return factory(self.uri, **self.args) return factory(self.uri, caps=self.caps, channels=self.channels, **self.args)
class IncludeConfig: class IncludeConfig: