Author: asterix Date: 2006-07-29 19:57:12 +0200 (Sat, 29 Jul 2006) New Revision: 6620
Modified: trunk/src/common/connection_handlers.py Log: prevent a TB and print an error message to the user when he/she tries to et a non valid nickname in a room
Modified: trunk/src/common/connection_handlers.py =================================================================== --- trunk/src/common/connection_handlers.py 2006-07-28 16:15:18 UTC (rev 6619) +++ trunk/src/common/connection_handlers.py 2006-07-29 17:57:12 UTC (rev 6620) @@ -1394,7 +1394,17 @@ if ptype == 'available': ptype = None gajim.log.debug('PresenceCB: %s' % ptype) - who = helpers.get_full_jid_from_iq(prs) + try: + who = helpers.get_full_jid_from_iq(prs) + except: + if prs.getTag('error').getTag('jid-malformed'): + # wrong jid, we probably tried to change our nick in a room to a non valid + # one + who = str(prs.getFrom()) + jid_stripped, resource = gajim.get_room_and_nick_from_fjid(who) + self.dispatch('GC_MSG', (jid_stripped, _('Nickname not allowed: %s') % \ + resource, None)) + return jid_stripped, resource = gajim.get_room_and_nick_from_fjid(who) timestamp = None is_gc = False # is it a GC presence ?