comparison bot.py @ 212:aa03c7ca53cb

use Bot.get_bridge instead of Bot.get_bridges in Bot._irc_event_handler Signed-off-by: Charly COSTE <changaco@changaco.net>
author Charly COSTE <changaco@changaco.net>
date Sat, 06 Mar 2010 16:50:58 +0100
parents 3fe9fed07b64
children fbe40b397f67
comparison
equal deleted inserted replaced
211:3fe9fed07b64 212:aa03c7ca53cb
668 668
669 669
670 # Joining events 670 # Joining events
671 if event.eventtype() in ['namreply', 'join']: 671 if event.eventtype() in ['namreply', 'join']:
672 if event.eventtype() == 'namreply': 672 if event.eventtype() == 'namreply':
673 for bridge in self.get_bridges(irc_room=event.arguments()[1].lower(), irc_server=connection.server): 673 bridge = self.get_bridge(irc_room=event.arguments()[1].lower(), irc_server=connection.server)
674 for nickname in re.split('(?:^[&@\+%]?|(?: [&@\+%]?)*)', event.arguments()[2].strip()): 674 for nickname in re.split('(?:^[&@\+%]?|(?: [&@\+%]?)*)', event.arguments()[2].strip()):
675 if nickname == '' or nickname == self.nickname: 675 if nickname == '' or nickname == self.nickname:
676 continue 676 continue
677 bridge.add_participant('irc', nickname) 677 bridge.add_participant('irc', nickname)
678 return 678 return
679 elif event.eventtype() == 'join': 679 elif event.eventtype() == 'join':
680 bridges = self.get_bridges(irc_room=event.target().lower(), irc_server=connection.server) 680 bridge = self.get_bridge(irc_room=event.target().lower(), irc_server=connection.server)
681 if len(bridges) == 0: 681 bridge.add_participant('irc', nickname, irc_id=event.source())
682 self.error(2, debug_str, debug=True)
683 self.error(3, 'no bridge found for "'+event.target().lower()+' at '+connection.server+'"', debug=True)
684 return
685 for bridge in bridges:
686 bridge.add_participant('irc', nickname, irc_id=event.source())
687 return 682 return
688 683
689 684
690 # Mode event 685 # Mode event
691 if event.eventtype() == 'mode': 686 if event.eventtype() == 'mode':