prevent a TB and print an error message to the user when he/she tries to et a non valid nickname in a room

This commit is contained in:
Yann Leboulanger 2006-07-29 17:57:12 +00:00
parent 90dc135539
commit ccc942fcbb
1 changed files with 11 additions and 1 deletions

View File

@ -1394,7 +1394,17 @@ class ConnectionHandlers(ConnectionVcard, ConnectionBytestream, ConnectionDisco)
if ptype == 'available': if ptype == 'available':
ptype = None ptype = None
gajim.log.debug('PresenceCB: %s' % ptype) gajim.log.debug('PresenceCB: %s' % ptype)
try:
who = helpers.get_full_jid_from_iq(prs) 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) jid_stripped, resource = gajim.get_room_and_nick_from_fjid(who)
timestamp = None timestamp = None
is_gc = False # is it a GC presence ? is_gc = False # is it a GC presence ?