# HG changeset patch
# User Charly COSTE <changaco@changaco.net>
# Date 1259360334 -3600
# Node ID a817ad05dd1d53dc098226f51742712e50ac2cab
# Parent  59401ac0f47a2091ac8c69732cf4b970b75bc1dc
stop bridge on error instead of removing it

Signed-off-by: Charly COSTE <changaco@changaco.net>

diff --git a/bot.py b/bot.py
--- 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)
diff --git a/bridge.py b/bridge.py
--- 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):