# HG changeset patch # User Charly COSTE # Date 1263641797 -3600 # Node ID 92285891590758b19b9750264ed49b111f4c7f32 # Parent 931a5edc7971e3a9d103a79b0205d8eca276f0c1 handle xmpp.muc.RemoteServerNotFound Signed-off-by: Charly COSTE diff --git a/bridge.py b/bridge.py --- a/bridge.py +++ b/bridge.py @@ -113,6 +113,13 @@ class Bridge: self.stop(message='failed to connect to the IRC chan') + def _RemoteServerNotFound_handler(self): + server = xmpp.protocol.JID(self.xmpp_room_jid).getDomain() + bridges = self.bot.findBridges([server]) + 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' + self.bot.restart_bridges_delayed(bridges, 300, error_message) + + def _xmpp_join_callback(self, errors): """Called by muc._xmpp_presence_handler""" if len(errors) == 0: @@ -129,6 +136,8 @@ class Bridge: for error in errors: try: raise error + except xmpp.muc.RemoteServerNotFound: + self._RemoteServerNotFound_handler() except: traceback.print_exc() self.bot.error('[Error] failed to connect to the XMPP room of bridge "'+str(self)+'", stopping bridge', send_to_admins=True) diff --git a/participant.py b/participant.py --- a/participant.py +++ b/participant.py @@ -99,6 +99,8 @@ class Participant: except xmpp.muc.RoomIsFull: self.bridge.bot.error('[Warning] XMPP MUC of bridge "'+str(self.bridge)+'" is full', send_to_admins=True) self.bridge.say('[Warning] XMPP room is full') + except xmpp.muc.RemoteServerNotFound: + self.bridge._RemoteServerNotFound_handler() if isinstance(self.xmpp_c, xmpp.client.Client): self.bridge.bot.close_xmpp_connection(self.nickname)