comparison start_bots_from_xml_config.py @ 172:64a0e9636ae6

removed encoding.py, charsets handling is now in irclib and custom charsets can be set per server in the configuration file Signed-off-by: Charly COSTE <changaco@changaco.net>
author Charly COSTE <changaco@changaco.net>
date Tue, 02 Feb 2010 20:19:50 +0100
parents 489c157d9e82
children 102f895347ff
comparison
equal deleted inserted replaced
171:489c157d9e82 172:64a0e9636ae6
63 if irc.hasAttribute('connection_interval'): 63 if irc.hasAttribute('connection_interval'):
64 try: 64 try:
65 irc_connection_interval = float(irc.getAttribute('connection_interval')) 65 irc_connection_interval = float(irc.getAttribute('connection_interval'))
66 except ValueError: 66 except ValueError:
67 print '[Error] the value of connection_interval must be a number' 67 print '[Error] the value of connection_interval must be a number'
68 if irc.hasAttribute('charsets'):
69 irc_charsets = irc.getAttribute('charsets').split()
70 else:
71 irc_charsets = None
68 72
69 if bridge_el.hasAttribute('say_level'): 73 if bridge_el.hasAttribute('say_level'):
70 say_level = bridge_el.getAttribute('say_level') 74 say_level = bridge_el.getAttribute('say_level')
71 else: 75 else:
72 say_level = 'all' 76 say_level = 'all'
74 if bridge_el.hasAttribute('mode'): 78 if bridge_el.hasAttribute('mode'):
75 mode = bridge_el.getAttribute('mode') 79 mode = bridge_el.getAttribute('mode')
76 else: 80 else:
77 mode = 'normal' 81 mode = 'normal'
78 82
79 bot.new_bridge(xmpp_room.getAttribute('jid'), irc.getAttribute('chan'), irc.getAttribute('server'), mode, say_level, irc_connection_interval=irc_connection_interval) 83 bot.new_bridge(xmpp_room.getAttribute('jid'), irc.getAttribute('chan'), irc.getAttribute('server'), mode, say_level, irc_connection_interval=irc_connection_interval, irc_charsets=irc_charsets)
80 84
81 try: 85 try:
82 if len(bots) == 0: 86 if len(bots) == 0:
83 print 'No bots in the configuration file, exiting ...' 87 print 'No bots in the configuration file, exiting ...'
84 exit(0) 88 exit(0)