Fix a bug with my last commits

This commit is contained in:
Julien Pivotto 2007-07-19 18:37:11 +00:00
parent 3a1b83228d
commit 3087a66ccb
1 changed files with 92 additions and 88 deletions

View File

@ -889,6 +889,7 @@ class GroupchatControl(ChatControlBase):
# statusCode
# http://www.xmpp.org/extensions/xep-0045.html#registrar-statuscodes-init
if statusCode:
if '100' in statusCode:
# Can be a message (see handle_event_gc_config_change in gajim.py)
self.print_conversation(\
@ -903,7 +904,8 @@ class GroupchatControl(ChatControlBase):
_('The server has assigned or modified your roomnick'))
if show in ('offline', 'error'):
if '307' in statusCode:
if statusCode:
if statuscode '307' in statusCode:
if actor is None: # do not print 'kicked by None'
s = _('%(nick)s has been kicked: %(reason)s') % {
'nick': nick,
@ -984,7 +986,8 @@ class GroupchatControl(ChatControlBase):
c = gajim.contacts.get_gc_contact(self.account, self.room_jid, nick)
c.show = show
c.status = status
if nick == self.nick and '303' not in statusCode: # We became offline
if nick == self.nick and (not statusCode or \
'303' not in statusCode): # We became offline
self.got_disconnected()
contact = gajim.contacts.\
get_contact_with_highest_priority(self.account, self.room_jid)
@ -998,7 +1001,7 @@ class GroupchatControl(ChatControlBase):
iter = self.add_contact_to_roster(nick, show, role, affiliation,
status, jid)
newly_created = True
if '201' in statusCode: # We just created the room
if statusCode and '201' in statusCode: # We just created the room
gajim.connections[self.account].request_gc_config(self.room_jid)
else:
gc_c = gajim.contacts.get_gc_contact(self.account, self.room_jid,
@ -1051,7 +1054,8 @@ class GroupchatControl(ChatControlBase):
if self.parent_win:
self.parent_win.redraw_tab(self)
if (time.time() - self.room_creation) > 30 and \
nick != self.nick and '303' not in statusCode:
nick != self.nick and (not statusCode or \
'303' not in statusCode):
st = ''
print_status = None
for bookmark in gajim.connections[self.account].bookmarks:
@ -1069,7 +1073,7 @@ class GroupchatControl(ChatControlBase):
if nick in self.attention_list:
self.attention_list.remove(nick)
if show == 'offline' and print_status in ('all', 'in_and_out') and \
'307' not in statusCode:
(not statusCode or '307' not in statusCode):
st = _('%s has left') % nick_jid
if reason:
st += ' [%s]' % reason