# HG changeset patch
# User Charly COSTE <changaco@changaco.net>
# Date 1251125764 -7200
# Node ID 4c4f4ee72e174e077445973933b011aa15170301
# Parent  faa468731d8a16c0d1240b50968c497073cfbee5
Fixed IRC "nick" event handling. Fixed bot's XMPP infinite loop.

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

diff --git a/bot.py b/bot.py
--- a/bot.py
+++ b/bot.py
@@ -73,10 +73,9 @@ class bot(Thread):
 		"""[Internal] XMPP infinite loop."""
 		while True:
 			try:
-				self.xmpp_c.lock.acquire()
-				self.xmpp_c.Process(0.5)
-				self.xmpp_c.lock.release()
 				try:
+					if len(self.xmpp_connections) == 1:
+						sleep(0.5)  # avoid bot connection being locked all the time
 					for c in self.xmpp_connections.itervalues():
 						if hasattr(c, 'Process'):
 							c.lock.acquire()
@@ -333,7 +332,7 @@ class bot(Thread):
 				
 				
 				# Nickname change
-				if event.eventtype() == 'nick' and from_.protocol == 'irc':
+				if event.eventtype() == 'nick':
 					from_.changeNickname(event.target(), 'xmpp')
 					handled = True
 					continue