Mercurial > xib
comparison start_bots_from_xml_config.py @ 150:e0eea72ea493
new bridge attribute "irc_connection_interval" (in seconds)
Signed-off-by: Charly COSTE <changaco@changaco.net>
author | Charly COSTE <changaco@changaco.net> |
---|---|
date | Sun, 17 Jan 2010 21:14:23 +0100 |
parents | 99f3dee1fad7 |
children | 63db565438bd |
comparison
equal
deleted
inserted
replaced
149:332bb2e8e71e | 150:e0eea72ea493 |
---|---|
56 bot = Bot(bot_el.getAttribute('jid'), bot_el.getAttribute('password'), bot_el.getAttribute('nickname'), admins_jid=admins_jid, debug=debug) | 56 bot = Bot(bot_el.getAttribute('jid'), bot_el.getAttribute('password'), bot_el.getAttribute('nickname'), admins_jid=admins_jid, debug=debug) |
57 bots.append(bot) | 57 bots.append(bot) |
58 for bridge_el in bot_el.getElementsByTagName('bridge'): | 58 for bridge_el in bot_el.getElementsByTagName('bridge'): |
59 xmpp_room = bridge_el.getElementsByTagName('xmpp-room')[0] | 59 xmpp_room = bridge_el.getElementsByTagName('xmpp-room')[0] |
60 irc = bridge_el.getElementsByTagName('irc')[0] | 60 irc = bridge_el.getElementsByTagName('irc')[0] |
61 irc_connection_interval = 1 | |
62 if irc.hasAttribute('connection_interval'): | |
63 try: | |
64 irc_connection_interval = float(irc.getAttribute('connection_interval')) | |
65 except ValueError: | |
66 print '[Error] the value of connection_interval must be a number' | |
61 say_level = 'all' | 67 say_level = 'all' |
62 if bridge_el.hasAttribute('say_level'): | 68 if bridge_el.hasAttribute('say_level'): |
63 say_level = bridge_el.getAttribute('say_level') | 69 say_level = bridge_el.getAttribute('say_level') |
64 if bridge_el.hasAttribute('mode'): | 70 if bridge_el.hasAttribute('mode'): |
65 mode = bridge_el.getAttribute('mode') | 71 mode = bridge_el.getAttribute('mode') |
66 else: | 72 else: |
67 mode = 'normal' | 73 mode = 'normal' |
68 bot.new_bridge(xmpp_room.getAttribute('jid'), irc.getAttribute('chan'), irc.getAttribute('server'), mode, say_level) | 74 bot.new_bridge(xmpp_room.getAttribute('jid'), irc.getAttribute('chan'), irc.getAttribute('server'), mode, say_level, irc_connection_interval=irc_connection_interval) |
69 | 75 |
70 | 76 |
71 while True: | 77 while True: |
72 sleep(1) | 78 sleep(1) |
73 except: | 79 except: |