changeset 112:a817ad05dd1d

stop bridge on error instead of removing it Signed-off-by: Charly COSTE <changaco@changaco.net>
author Charly COSTE <changaco@changaco.net>
date Fri, 27 Nov 2009 23:18:54 +0100
parents 59401ac0f47a
children 6daf0854aa9f
files bot.py bridge.py
diffstat 2 files changed, 6 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/bot.py
+++ b/bot.py
@@ -439,8 +439,8 @@ class bot(Thread):
 									elif err == 'forbidden':
 										# we don't have the permission to speak
 										# let's remove the bridge and tell admins
-										self.error('[Error] Not allowed to speak on the XMPP MUC of bridge '+str(b)+', removing it', send_to_admins=True)
-										self.removeBridge(b, message='Not allowed to speak on the XMPP MUC, removing bridge.')
+										self.error('[Error] Not allowed to speak on the XMPP MUC of bridge '+str(b)+', stopping it', send_to_admins=True)
+										b.stop(message='Not allowed to speak on the XMPP MUC, stopping bridge.')
 									else:
 										self.error('==> Debug: recevied unknown error message', debug=True)
 										self.error(message.__str__(fancy=1), debug=True)
--- a/bridge.py
+++ b/bridge.py
@@ -107,8 +107,8 @@ class bridge:
 					raise Exception('[Error] unknown error for "'+self.bot.nickname+'" on bridge "'+str(self)+'", limit seems to be '+str(arguments[0]))
 			except:
 				traceback.print_exc()
-			self.bot.error('[Error] failed to connect to the IRC chan of bridge "'+str(self)+'", removing bridge', send_to_admins=True)
-			self.bot.removeBridge(self)
+			self.bot.error('[Error] failed to connect to the IRC chan of bridge "'+str(self)+'", stopping bridge', send_to_admins=True)
+			self.stop(message='failed to connect to the IRC chan')
 	
 	
 	def _xmpp_join_callback(self, errors):
@@ -129,8 +129,8 @@ class bridge:
 					raise error
 				except:
 					traceback.print_exc()
-			self.bot.error('[Error] failed to connect to the XMPP room of bridge "'+str(self)+'", removing bridge', send_to_admins=True)
-			self.bot.removeBridge(self)
+			self.bot.error('[Error] failed to connect to the XMPP room of bridge "'+str(self)+'", stopping bridge', send_to_admins=True)
+			self.stop(message='failed to connect to the XMPP room')
 	
 	
 	def addParticipant(self, from_protocol, nickname, real_jid=None):