comparison bot.py @ 166:0fc24e232997

some fixes related to IRC nicknames Signed-off-by: Charly COSTE <changaco@changaco.net>
author Charly COSTE <changaco@changaco.net>
date Wed, 20 Jan 2010 14:48:52 +0100
parents 3f299ad4d452
children 489c157d9e82
comparison
equal deleted inserted replaced
165:12d564cd0203 166:0fc24e232997
449 connection.pong(connection.get_server_name()) 449 connection.pong(connection.get_server_name())
450 return 450 return
451 451
452 452
453 # Events we always want to ignore 453 # Events we always want to ignore
454 if 'all' in event.eventtype() or 'motd' in event.eventtype(): 454 if 'all' in event.eventtype() or 'motd' in event.eventtype() or event.eventtype() in ['nicknameinuse', 'nickcollision', 'erroneusnickname']:
455 return 455 return
456 if event.eventtype() in ['pong', 'privnotice', 'ctcp', 'nochanmodes', 'notexttosend', 'currenttopic', 'topicinfo', '328']: 456 if event.eventtype() in ['pong', 'privnotice', 'ctcp', 'nochanmodes', 'notexttosend', 'currenttopic', 'topicinfo', '328']:
457 self.error('=> Debug: ignoring IRC '+event.eventtype(), debug=True) 457 self.error('=> Debug: ignoring IRC '+event.eventtype(), debug=True)
458 return 458 return
459 459
661 else: 661 else:
662 self.error(event_str, send_to_admins=True) 662 self.error(event_str, send_to_admins=True)
663 return 663 return
664 664
665 665
666 # From here the event is shown
667 self.error(event_str, debug=True)
668
669
670 # Nickname callbacks
671 # TODO: move this into irclib.py
672 if event.eventtype() == 'nicknameinuse':
673 connection._call_nick_callbacks('nicknameinuse', arguments=[event])
674 return
675 if event.eventtype() == 'nickcollision':
676 connection._call_nick_callbacks('nickcollision', arguments=[event])
677 return
678 if event.eventtype() == 'erroneusnickname':
679 connection._call_nick_callbacks('erroneusnickname', arguments=[event])
680 return
681
682
683 # Unhandled events 666 # Unhandled events
684 self.error('=> Debug: event not handled', debug=True) 667 self.error(event_str+'\n=> Debug: event not handled', debug=True)
685 668
686 669
687 def _send_message_to_admins(self, message): 670 def _send_message_to_admins(self, message):
688 """[Internal] Send XMPP Message to bot admin(s)""" 671 """[Internal] Send XMPP Message to bot admin(s)"""
689 for admin_jid in self.admins_jid: 672 for admin_jid in self.admins_jid: