diff participant.py @ 123:75a03f10a863

Code refactoring (new method participant.set_both_sides()) Signed-off-by: Charly COSTE <changaco@changaco.net>
author Charly COSTE <changaco@changaco.net>
date Wed, 13 Jan 2010 22:27:00 +0100
parents b29fd5696a78
children 99f3dee1fad7
line wrap: on
line diff
--- a/participant.py
+++ b/participant.py
@@ -170,6 +170,20 @@ class participant:
 				self.irc_connection = error
 	
 	
+	def set_both_sides(self):
+		self.bridge.bot.error('===> Debug: "'+self.nickname+'" is on both sides of bridge "'+str(self.bridge)+'"', debug=True)
+		self.bridge.say('[Warning] The nickname "'+self.nickname+'" is used on both sides of the bridge, please avoid that if possible')
+		if isinstance(self.irc_connection, ServerConnection):
+			self.irc_connection.close('')
+		if self.irc_connection != 'both':
+			self.irc_connection = 'both'
+		if isinstance(self.muc, xmpp.muc):
+			self.muc.leave('')
+			self.bridge.bot.close_xmpp_connection(self.nickname)
+		if self.xmpp_c != 'both':
+			self.xmpp_c = 'both'
+	
+	
 	def changeNickname(self, newnick, on_protocol):
 		"""Change participant's nickname."""