# HG changeset patch # User Charly COSTE # Date 1250508025 -7200 # Node ID 1a1f2a0d35c79e78e3996f20a4d6b55cfa10e351 # Parent a9077fa9cac9807af045d7fda5221e3d307d0f41 Fixed bug that prevented the bot from connecting to freenode and all other servers that don't send "umode" Signed-off-by: Charly COSTE diff --git a/README b/README --- a/README +++ b/README @@ -1,3 +1,5 @@ +> Introduction + This is the first release of xib so some things are not implemented yet, if you want/need an error-safe bot, don't use this one ! Here is the list of the important things that still need to be implemented: @@ -11,17 +13,35 @@ and a list of features that should be im xib includes its own version of the old irclib.py because this library doesn't correctly handle the different character encodings, I'm sorry about it but I don't have time to contribute to the upstream version right now, I don't know if it still has developers anyway -xib depends on: + +> xib dependencies: - python 2.6 - xmppony 0.1 -How to install and run xib bots: +> Contributors: +Changaco + + +> Changelog: +0.1.1: + - fixed bug that prevented the bot from connecting to freenode and all other servers that don't send "umode" + - added optional parameter to start_bots_from_xml_config.py +0.1: Initial release + + +> How to install and run xib bots: If you are not installing xib from a package manager I suggest you put the files in /usr/local/share/xib -To start xib bots just execute start_bots_from_xml_config.py, this script will search the *current* directory for a file named "config.xml" which must have the same schema as "example_config.xml". +To start xib bots just execute "start_bots_from_xml_config.py", this script takes the path to a configuration file as optional first parameter, if no such parameter is given it will search the *current* directory for a file named "config.xml". + + +> How to write a configuration file understandable by "start_bots_from_xml_config.py": -How to log xib bots output: +Copy "example_config.xml" and modify it to fit your needs. + + +> How to log xib bots output: xib does not directly handle logging for now so you have to do it the old school way, for example: mkdir /var/log/xib diff --git a/bot.py b/bot.py --- a/bot.py +++ b/bot.py @@ -15,14 +15,6 @@ # along with this program. If not, see . -# *** CONTRIBUTORS *** -# Contributor: Changaco - - -# *** Changelog *** -# 0.1: First release - - # *** Versioning *** # Major will pass to 1 when xib will be considered fault-tolerant # After that major will only be changed if the new version is not retro-compatible (e.g. requires changes in config file) @@ -206,7 +198,7 @@ class bot(Thread): if 'motd' in event.eventtype(): self.error('=> Debug: ignoring event containing "motd" in the eventtype ('+event.eventtype()+')', debug=True) return - if event.eventtype() in ['pong', 'welcome', 'yourhost', 'created', 'myinfo', 'featurelist', 'luserclient', 'luserop', 'luserchannels', 'luserme', 'n_local', 'n_global', 'endofnames', 'luserunknown']: + if event.eventtype() in ['pong', 'privnotice']: self.error('=> Debug: ignoring '+event.eventtype(), debug=True) return if event.eventtype() == 'pubmsg' and connection.get_nickname() != connection.bridge.irc_connection.get_nickname(): @@ -215,6 +207,17 @@ class bot(Thread): if event.eventtype() == 'ping': connection.pong(connection.get_server_name()) return + if event.eventtype() in ['umode', 'welcome', 'yourhost', 'created', 'myinfo', 'featurelist', 'luserclient', 'luserop', 'luserchannels', 'luserme', 'n_local', 'n_global', 'endofnames', 'luserunknown', 'luserconns']: + if connection.really_connected == False: + connection.really_connected = True + self.error('===> Debug: now really connected', debug=True) + if connection.nick_callback: + connection.nick_callback(None) + else: + self.error('=> Debug: no nick callback for "'+str(event.target())+'"', debug=True) + self.error('connection.nick_callback='+str(connection.nick_callback), debug=True) + self.error('=> Debug: ignoring '+event.eventtype(), debug=True) + return self.error('==> Debug: Received IRC event.', debug=True) self.error('server='+connection.get_server_name(), debug=True) self.error('eventtype='+event.eventtype(), debug=True) @@ -243,13 +246,6 @@ class bot(Thread): else: self.error('=> Debug: no nick callback for "'+str(event.target())+'"', debug=True) return - elif event.eventtype() == 'umode': - if connection.nick_callback: - connection.nick_callback(None) - else: - self.error('=> Debug: no nick callback for "'+str(event.target())+'"', debug=True) - self.error('connection.nick_callback='+str(connection.nick_callback), debug=True) - return elif event.eventtype() == 'namreply': for nickname in re.split('(?:^[@\+]?|(?: [@\+]?)*)', event.arguments()[2].strip()): if nickname == '': diff --git a/irclib.py b/irclib.py --- a/irclib.py +++ b/irclib.py @@ -375,6 +375,7 @@ class ServerConnection(Connection): def __init__(self, irclibobj): Connection.__init__(self, irclibobj) self.connected = 0 # Not connected yet. + self.really_connected = False self.socket = None self.ssl = None @@ -411,7 +412,7 @@ class ServerConnection(Connection): if self.connected: self.disconnect("Changing servers") - self.closing = False # added for xib + self.closing = False self.previous_buffer = "" self.handlers = {} self.real_server_name = ""