Can send command on connection, defined in configuration file

This commit is contained in:
nemunaire 2014-09-27 23:57:19 +02:00
parent 41da1c0780
commit 99a5e8e5ad

View File

@ -106,7 +106,10 @@ class IRCServer(SocketServer):
# Respond to 001 # Respond to 001
def _on_connect(msg): def _on_connect(msg):
# First, JOIN some channels # First, send user defined command
if node.hasAttribute("on_connect"):
self.write(node["on_connect"])
# Then, JOIN some channels
for chn in node.getNodes("channel"): for chn in node.getNodes("channel"):
if chn["password"] is not None: if chn["password"] is not None:
self.write("JOIN %s %s" % (chn["name"], chn["password"])) self.write("JOIN %s %s" % (chn["name"], chn["password"]))