don't remove contact in gc roster when he leaves if there are awaiting events from him, but only when we read his messages

This commit is contained in:
Yann Leboulanger 2005-12-13 22:13:07 +00:00
parent 7b31cb56de
commit 761528f213
2 changed files with 14 additions and 7 deletions

View File

@ -486,7 +486,13 @@ class GroupchatWindow(chat.Chat):
s = _('%s is now known as %s') % (nick, new_nick)
self.print_conversation(s, room_jid)
if not gajim.awaiting_events[self.account].has_key(
room_jid + '/' + nick):
self.remove_contact(room_jid, nick)
else:
c = gajim.gc_contacts[self.account][room_jid][nick]
c.show = show
c.status = status
if nick == self.nicks[room_jid] and statusCode != '303': # We became offline
self.got_disconnected(room_jid)
else:

View File

@ -828,7 +828,7 @@ class TabbedChatWindow(chat.Chat):
contact = self.contacts[jid]
# Is it a pm ?
is_pm = False
room_jid = jid.split('/', 1)[0]
room_jid, nick = gajim.get_room_and_nick_from_fjid(jid)
gcs = gajim.interface.instances[self.account]['gc']
if gcs.has_key(room_jid):
is_pm = True
@ -864,7 +864,6 @@ class TabbedChatWindow(chat.Chat):
del gajim.awaiting_events[self.account][jid]
typ = 'chat' # Is it a normal chat or a pm ?
# reset to status image in gc if it is a pm
room_jid = jid.split('/', 1)[0]
gcs = gajim.interface.instances[self.account]['gc']
if gcs.has_key(room_jid):
gcs[room_jid].draw_all_roster()
@ -873,11 +872,13 @@ class TabbedChatWindow(chat.Chat):
gajim.interface.roster.draw_contact(jid, self.account)
if gajim.interface.systray_enabled:
gajim.interface.systray.remove_jid(jid, self.account, typ)
if (contact.show == 'offline' or contact.show == 'error'):
showOffline = gajim.config.get('showoffline')
if (contact.show == 'offline' or contact.show == 'error') and \
not showOffline and typ == 'chat':
if len(gajim.contacts[self.account][jid]) == 1:
if not showOffline and typ == 'chat' and \
len(gajim.contacts[self.account][jid]) == 1:
gajim.interface.roster.really_remove_contact(contact, self.account)
elif typ == 'pm':
gcs[room_jid].remove_contact(room_jid, nick)
def print_conversation(self, text, jid, frm = '', tim = None,
encrypted = False, subject = None):