comparison irclib.py @ 43:9f72353e4064

Minor change to irclib.py Signed-off-by: Charly COSTE <changaco@changaco.net>
author Charly COSTE <changaco@changaco.net>
date Mon, 24 Aug 2009 19:00:45 +0200
parents ebf516b2e5c9
children b048c4c03b00
comparison
equal deleted inserted replaced
42:b8c9ddf320f8 43:9f72353e4064
393 self.socket = None 393 self.socket = None
394 self.ssl = None 394 self.ssl = None
395 self.server = server 395 self.server = server
396 self.port = port 396 self.port = port
397 self.nickname = nickname 397 self.nickname = nickname
398 self.lock = threading.RLock()
398 399
399 400
400 def __str__(self): 401 def __str__(self):
401 return self.real_nickname+' at '+self.server+':'+str(self.port) 402 return self.real_nickname+' at '+self.server+':'+str(self.port)
402 403
424 This function can be called to reconnect a closed connection. 425 This function can be called to reconnect a closed connection.
425 426
426 Returns the ServerConnection object. 427 Returns the ServerConnection object.
427 """ 428 """
428 429
430 self.lock.acquire()
429 431
430 if self.connected == True: 432 if self.connected == True:
431 self.lock.acquire()
432 self.used_by += 1 433 self.used_by += 1
433 self.irclibobj.bot.error('===> Debug: using existing IRC connection for '+str(self)+', this connection is now used by '+str(self.used_by)+' bridges', debug=True) 434 self.irclibobj.bot.error('===> Debug: using existing IRC connection for '+str(self)+', this connection is now used by '+str(self.used_by)+' bridges', debug=True)
434 self.nick(self.real_nickname, callback=nick_callback) 435 self.nick(self.real_nickname, callback=nick_callback)
435 self.lock.release() 436 self.lock.release()
436 return self 437 return self
437 438
438 439
439 self.lock = threading.RLock()
440 self.lock.acquire()
441 self.nick_callbacks = [] 440 self.nick_callbacks = []
442 self.previous_buffer = "" 441 self.previous_buffer = ""
443 self.handlers = {} 442 self.handlers = {}
444 self.real_server_name = "" 443 self.real_server_name = ""
445 self.real_nickname = self.nickname 444 self.real_nickname = self.nickname