comparison bot.py @ 48:cb08ea878db9

lower() for "join" and "namreply" IRC events Signed-off-by: Charly COSTE <changaco@changaco.net>
author Charly COSTE <changaco@changaco.net>
date Mon, 24 Aug 2009 23:32:34 +0200
parents dd9d93ae405a
children 714e78fb912e
comparison
equal deleted inserted replaced
47:dd9d93ae405a 48:cb08ea878db9
359 self.error('=> Debug: ignoring IRC '+event.eventtype()+' not received on bridge connection', debug=True) 359 self.error('=> Debug: ignoring IRC '+event.eventtype()+' not received on bridge connection', debug=True)
360 return 360 return
361 361
362 if event.eventtype() == 'namreply': 362 if event.eventtype() == 'namreply':
363 # TODO: lock self.bridges for thread safety 363 # TODO: lock self.bridges for thread safety
364 for bridge in self.getBridges(irc_room=event.arguments()[1], irc_server=connection.server): 364 for bridge in self.getBridges(irc_room=event.arguments()[1].lower(), irc_server=connection.server):
365 for nickname in re.split('(?:^[&@\+]?|(?: [&@\+]?)*)', event.arguments()[2].strip()): 365 for nickname in re.split('(?:^[&@\+]?|(?: [&@\+]?)*)', event.arguments()[2].strip()):
366 if nickname == '' or nickname == self.nickname: 366 if nickname == '' or nickname == self.nickname:
367 continue 367 continue
368 bridge.addParticipant('irc', nickname) 368 bridge.addParticipant('irc', nickname)
369 return 369 return
370 elif event.eventtype() == 'join': 370 elif event.eventtype() == 'join':
371 bridges = self.getBridges(irc_room=event.target(), irc_server=connection.server) 371 bridges = self.getBridges(irc_room=event.target().lower(), irc_server=connection.server)
372 if len(bridges) == 0: 372 if len(bridges) == 0:
373 self.error('===> Debug: no bridge found for "'+event.target()+' at '+connection.server+'"', debug=True) 373 self.error('===> Debug: no bridge found for "'+event.target().lower()+' at '+connection.server+'"', debug=True)
374 return 374 return
375 for bridge in bridges: 375 for bridge in bridges:
376 bridge.addParticipant('irc', nickname) 376 bridge.addParticipant('irc', nickname)
377 return 377 return
378 378