comparison bot.py @ 152:17305e57f71d

removed automatic switching to limited mode (created Bridge.show_participants_list_on()) Signed-off-by: Charly COSTE <changaco@changaco.net>
author Charly COSTE <changaco@changaco.net>
date Sun, 17 Jan 2010 22:30:23 +0100
parents a04840ad92b7
children 63db565438bd
comparison
equal deleted inserted replaced
151:a04840ad92b7 152:17305e57f71d
647 for bridge in bridges: 647 for bridge in bridges:
648 bridge.addParticipant('irc', nickname, irc_id=event.source()) 648 bridge.addParticipant('irc', nickname, irc_id=event.source())
649 return 649 return
650 650
651 651
652 if event.eventtype() in ['disconnect', 'kill', 'error']:
653 if len(event.arguments()) > 0 and event.arguments()[0] == 'Connection reset by peer':
654 self.error(event_str, debug=True)
655 else:
656 self.error(event_str, send_to_admins=True)
657 return
658
659
652 # From here the event is shown 660 # From here the event is shown
653 self.error(event_str, debug=True) 661 self.error(event_str, debug=True)
654
655
656 if event.eventtype() in ['disconnect', 'kill']:
657 if len(event.arguments()) > 0 and event.arguments()[0] == 'Connection reset by peer':
658 return
659
660 # TODO: lock self.bridges for thread safety
661 for bridge in self.bridges:
662 if connection.server != bridge.irc_server:
663 continue
664 try:
665 p = bridge.getParticipant(connection.get_nickname())
666 if bridge.mode in ['normal', 'bypass']:
667 bridge.changeMode('limited')
668 else:
669 if p.irc_connection.really_connected == True:
670 p.irc_connection.part(bridge.irc_room, message=message)
671 p.irc_connection.used_by -= 1
672 if p.irc_connection.used_by < 1:
673 p.irc_connection.close(message)
674 p.irc_connection = None
675 except Bridge.NoSuchParticipantException:
676 pass
677 return
678 662
679 663
680 # Nickname callbacks 664 # Nickname callbacks
681 # TODO: move this into irclib.py 665 # TODO: move this into irclib.py
682 if event.eventtype() == 'nicknameinuse': 666 if event.eventtype() == 'nicknameinuse':