comparison bot.py @ 188:bd185885d4ca

minor fixes in bot.py, error messages that weren't flagged as debug Signed-off-by: Charly COSTE <changaco@changaco.net>
author Charly COSTE <changaco@changaco.net>
date Sat, 20 Feb 2010 19:03:12 +0100
parents 594f570f4657
children 6db99e458168
comparison
equal deleted inserted replaced
187:594f570f4657 188:bd185885d4ca
456 if connection.really_connected == False: 456 if connection.really_connected == False:
457 if event.target() == connection.nickname: 457 if event.target() == connection.nickname:
458 connection.really_connected = True 458 connection.really_connected = True
459 connection._call_nick_callbacks(None) 459 connection._call_nick_callbacks(None)
460 elif len(connection.nick_callbacks) > 0: 460 elif len(connection.nick_callbacks) > 0:
461 self.error(3, 'event target ('+event.target()+') and connection nickname ('+connection.nickname+') don\'t match') 461 self.error(3, 'event target ('+event.target()+') and connection nickname ('+connection.nickname+') don\'t match', debug=True)
462 connection._call_nick_callbacks('nicknametoolong', arguments=[len(event.target())]) 462 connection._call_nick_callbacks('nicknametoolong', arguments=[len(event.target())])
463 self.error(1, 'ignoring '+event.eventtype(), debug=True) 463 self.error(1, 'ignoring '+event.eventtype(), debug=True)
464 return 464 return
465 465
466 466
544 bridge.removeParticipant('irc', kicked.nickname, 'Kicked by '+nickname+' with reason: '+event.arguments()[1]) 544 bridge.removeParticipant('irc', kicked.nickname, 'Kicked by '+nickname+' with reason: '+event.arguments()[1])
545 else: 545 else:
546 bridge.removeParticipant('irc', kicked.nickname, 'Kicked by '+nickname+' (no reason was given)') 546 bridge.removeParticipant('irc', kicked.nickname, 'Kicked by '+nickname+' (no reason was given)')
547 return 547 return
548 except Bridge.NoSuchParticipantException: 548 except Bridge.NoSuchParticipantException:
549 self.error(1, 'a participant that was not here has been kicked ? WTF ?') 549 self.error(1, 'a participant that was not here has been kicked ? WTF ?', debug=True)
550 return 550 return
551 else: 551 else:
552 continue 552 continue
553 553
554 554
591 591
592 592
593 # Handle bannedfromchan 593 # Handle bannedfromchan
594 if event.eventtype() == 'bannedfromchan': 594 if event.eventtype() == 'bannedfromchan':
595 if len(event.arguments()) < 1: 595 if len(event.arguments()) < 1:
596 self.error(1, 'length of arguments should be greater than 0 for a '+event.eventtype()+' event') 596 self.error(1, 'length of arguments should be greater than 0 for a '+event.eventtype()+' event', debug=True)
597 return 597 return
598 598
599 for bridge in self.bridges: 599 for bridge in self.bridges:
600 if connection.server != bridge.irc_server or event.arguments()[0].lower() != bridge.irc_room: 600 if connection.server != bridge.irc_server or event.arguments()[0].lower() != bridge.irc_room:
601 continue 601 continue
611 self.error(2, debug_str, debug=True) 611 self.error(2, debug_str, debug=True)
612 bridge.say(say_levels.warning, 'the nickname "'+event.target()+'" is banned from the IRC chan', log=True) 612 bridge.say(say_levels.warning, 'the nickname "'+event.target()+'" is banned from the IRC chan', log=True)
613 else: 613 else:
614 self.error(1, 'ignoring '+event.eventtype(), debug=True) 614 self.error(1, 'ignoring '+event.eventtype(), debug=True)
615 except Bridge.NoSuchParticipantException: 615 except Bridge.NoSuchParticipantException:
616 self.error(1, 'no such participant. WTF ?') 616 self.error(1, 'no such participant. WTF ?', debug=True)
617 return 617 return
618 618
619 return 619 return
620 620
621 621
622 if event.eventtype() in ['disconnect', 'kill', 'error']: 622 if event.eventtype() in ['disconnect', 'kill', 'error']:
623 if len(event.arguments()) > 0 and event.arguments()[0] == 'Connection reset by peer': 623 if len(event.arguments()) > 0 and event.arguments()[0] == 'Connection reset by peer':
624 self.error(2, debug_str, debug=True) 624 self.error(2, debug_str, debug=True)
625 else: 625 else:
626 self.error(2, debug_str, send_to_admins=True) 626 self.error(say_levels.debug, debug_str, send_to_admins=True)
627 return 627 return
628 628
629 629
630 if event.eventtype() in ['cannotsendtochan', 'notonchannel']: 630 if event.eventtype() in ['cannotsendtochan', 'notonchannel']:
631 self.error(2, debug_str, debug=True) 631 self.error(2, debug_str, debug=True)