Mercurial > xib
comparison bridge.py @ 135:922858915907
handle xmpp.muc.RemoteServerNotFound
Signed-off-by: Charly COSTE <changaco@changaco.net>
author | Charly COSTE <changaco@changaco.net> |
---|---|
date | Sat, 16 Jan 2010 12:36:37 +0100 |
parents | 6a6885dbed25 |
children | 9f39cead20cb |
comparison
equal
deleted
inserted
replaced
134:931a5edc7971 | 135:922858915907 |
---|---|
111 traceback.print_exc() | 111 traceback.print_exc() |
112 self.bot.error('[Error] failed to connect to the IRC chan of bridge "'+str(self)+'", stopping bridge', send_to_admins=True) | 112 self.bot.error('[Error] failed to connect to the IRC chan of bridge "'+str(self)+'", stopping bridge', send_to_admins=True) |
113 self.stop(message='failed to connect to the IRC chan') | 113 self.stop(message='failed to connect to the IRC chan') |
114 | 114 |
115 | 115 |
116 def _RemoteServerNotFound_handler(self): | |
117 server = xmpp.protocol.JID(self.xmpp_room_jid).getDomain() | |
118 bridges = self.bot.findBridges([server]) | |
119 error_message = '[Warning] The MUC server '+server+' seems to be down, the bot will try to recreate all bridges related to this server in 5 minutes' | |
120 self.bot.restart_bridges_delayed(bridges, 300, error_message) | |
121 | |
122 | |
116 def _xmpp_join_callback(self, errors): | 123 def _xmpp_join_callback(self, errors): |
117 """Called by muc._xmpp_presence_handler""" | 124 """Called by muc._xmpp_presence_handler""" |
118 if len(errors) == 0: | 125 if len(errors) == 0: |
119 if hasattr(self, 'reconnecting'): | 126 if hasattr(self, 'reconnecting'): |
120 del self.reconnecting | 127 del self.reconnecting |
127 if self.irc_connection.really_connected == True: | 134 if self.irc_connection.really_connected == True: |
128 self.say('[Error] failed to connect to the XMPP room, leaving ...', on_xmpp=False) | 135 self.say('[Error] failed to connect to the XMPP room, leaving ...', on_xmpp=False) |
129 for error in errors: | 136 for error in errors: |
130 try: | 137 try: |
131 raise error | 138 raise error |
139 except xmpp.muc.RemoteServerNotFound: | |
140 self._RemoteServerNotFound_handler() | |
132 except: | 141 except: |
133 traceback.print_exc() | 142 traceback.print_exc() |
134 self.bot.error('[Error] failed to connect to the XMPP room of bridge "'+str(self)+'", stopping bridge', send_to_admins=True) | 143 self.bot.error('[Error] failed to connect to the XMPP room of bridge "'+str(self)+'", stopping bridge', send_to_admins=True) |
135 self.stop(message='failed to connect to the XMPP room') | 144 self.stop(message='failed to connect to the XMPP room') |
136 | 145 |