Correctly readd a metacontact family after removing a single brother.
* Coding standards * remove useless key-list creation
This commit is contained in:
parent
926953252b
commit
0bb1f1d656
|
@ -926,7 +926,7 @@ class Interface:
|
||||||
if c.jid in gajim.to_be_removed[account]:
|
if c.jid in gajim.to_be_removed[account]:
|
||||||
# This way we'll really remove it
|
# This way we'll really remove it
|
||||||
gajim.to_be_removed[account].remove(c.jid)
|
gajim.to_be_removed[account].remove(c.jid)
|
||||||
self.roster.remove_contact(c.jid, account, backend = True)
|
self.roster.remove_contact(c.jid, account, backend=True)
|
||||||
|
|
||||||
def handle_event_register_agent_info(self, account, array):
|
def handle_event_register_agent_info(self, account, array):
|
||||||
# ('REGISTER_AGENT_INFO', account, (agent, infos, is_form))
|
# ('REGISTER_AGENT_INFO', account, (agent, infos, is_form))
|
||||||
|
@ -1394,7 +1394,7 @@ class Interface:
|
||||||
not name and not groups:
|
not name and not groups:
|
||||||
# contact removes us.
|
# contact removes us.
|
||||||
if contacts:
|
if contacts:
|
||||||
self.roster.remove_contact(jid, account, backend = True)
|
self.roster.remove_contact(jid, account, backend=True)
|
||||||
return
|
return
|
||||||
elif not contacts:
|
elif not contacts:
|
||||||
if sub == 'remove':
|
if sub == 'remove':
|
||||||
|
|
|
@ -667,7 +667,7 @@ class RosterWindow:
|
||||||
return contacts[0][0] # it's contact/big brother with highest priority
|
return contacts[0][0] # it's contact/big brother with highest priority
|
||||||
|
|
||||||
|
|
||||||
def remove_contact(self, jid, account, force = False, backend = False):
|
def remove_contact(self, jid, account, force=False, backend=False):
|
||||||
'''Remove contact from roster.
|
'''Remove contact from roster.
|
||||||
|
|
||||||
Remove contact from all its group. Remove empty groups or redraw
|
Remove contact from all its group. Remove empty groups or redraw
|
||||||
|
@ -692,7 +692,7 @@ class RosterWindow:
|
||||||
if not force and self.contact_has_pending_roster_events(contact, account):
|
if not force and self.contact_has_pending_roster_events(contact, account):
|
||||||
# Contact has pending events
|
# Contact has pending events
|
||||||
key = (jid, account)
|
key = (jid, account)
|
||||||
if not key in self.contacts_to_be_removed.keys():
|
if not key in self.contacts_to_be_removed:
|
||||||
self.contacts_to_be_removed[key] = {'backend': backend}
|
self.contacts_to_be_removed[key] = {'backend': backend}
|
||||||
return False
|
return False
|
||||||
else:
|
else:
|
||||||
|
@ -705,13 +705,17 @@ class RosterWindow:
|
||||||
else:
|
else:
|
||||||
self._remove_entity(contact, account)
|
self._remove_entity(contact, account)
|
||||||
|
|
||||||
# Draw all groups of the contact
|
|
||||||
|
|
||||||
if backend:
|
if backend:
|
||||||
# Remove contact before redrawing, otherwise the old
|
# Remove contact before redrawing, otherwise the old
|
||||||
# numbers will still be show
|
# numbers will still be show
|
||||||
gajim.contacts.remove_jid(account, jid)
|
gajim.contacts.remove_jid(account, jid, remove_meta=True)
|
||||||
|
family = gajim.contacts.get_metacontacts_family(account, jid)
|
||||||
|
if family:
|
||||||
|
# reshow the rest of the family
|
||||||
|
self._add_metacontact_family(family, account)
|
||||||
|
|
||||||
|
# Draw all groups of the contact
|
||||||
for group in contact.get_shown_groups():
|
for group in contact.get_shown_groups():
|
||||||
self.draw_group(group, account)
|
self.draw_group(group, account)
|
||||||
self.draw_account(account)
|
self.draw_account(account)
|
||||||
|
@ -745,7 +749,7 @@ class RosterWindow:
|
||||||
'''Remove groupchat from roster and redraw account and group.'''
|
'''Remove groupchat from roster and redraw account and group.'''
|
||||||
contact = gajim.contacts.get_contact_with_highest_priority(account, jid)
|
contact = gajim.contacts.get_contact_with_highest_priority(account, jid)
|
||||||
if contact.is_groupchat():
|
if contact.is_groupchat():
|
||||||
self.remove_contact(jid, account, force = True, backend = True)
|
self.remove_contact(jid, account, force=True, backend=True)
|
||||||
return True
|
return True
|
||||||
else:
|
else:
|
||||||
return False
|
return False
|
||||||
|
@ -767,7 +771,7 @@ class RosterWindow:
|
||||||
def remove_transport(self, jid, account):
|
def remove_transport(self, jid, account):
|
||||||
'''Remove transport from roster and redraw account and group.'''
|
'''Remove transport from roster and redraw account and group.'''
|
||||||
contact = gajim.contacts.get_contact_with_highest_priority(account, jid)
|
contact = gajim.contacts.get_contact_with_highest_priority(account, jid)
|
||||||
self.remove_contact(jid, account, force = True, backend = True)
|
self.remove_contact(jid, account, force=True, backend=True)
|
||||||
return True
|
return True
|
||||||
|
|
||||||
def add_contact_to_groups(self, jid, account, groups, update = True):
|
def add_contact_to_groups(self, jid, account, groups, update = True):
|
||||||
|
@ -1603,7 +1607,7 @@ class RosterWindow:
|
||||||
if key in self.contacts_to_be_removed.keys():
|
if key in self.contacts_to_be_removed.keys():
|
||||||
del self.contacts_to_be_removed[key]
|
del self.contacts_to_be_removed[key]
|
||||||
# Remove contact will delay removal if there are more events pending
|
# Remove contact will delay removal if there are more events pending
|
||||||
self.remove_contact(jid, account, backend = True)
|
self.remove_contact(jid, account, backend=True)
|
||||||
self.show_title()
|
self.show_title()
|
||||||
|
|
||||||
def open_event(self, account, jid, event):
|
def open_event(self, account, jid, event):
|
||||||
|
@ -1817,7 +1821,7 @@ class RosterWindow:
|
||||||
elif contact.jid == gajim.get_jid_from_account(account) and \
|
elif contact.jid == gajim.get_jid_from_account(account) and \
|
||||||
show in ('offline', 'error'):
|
show in ('offline', 'error'):
|
||||||
# SelfContact went offline. Remove him when last pending message was read
|
# SelfContact went offline. Remove him when last pending message was read
|
||||||
self.remove_contact(contact.jid, account, backend = True)
|
self.remove_contact(contact.jid, account, backend=True)
|
||||||
|
|
||||||
# print status in chat window and update status/GPG image
|
# print status in chat window and update status/GPG image
|
||||||
if gajim.interface.msg_win_mgr.has_window(contact.jid, account):
|
if gajim.interface.msg_win_mgr.has_window(contact.jid, account):
|
||||||
|
@ -2273,7 +2277,7 @@ class RosterWindow:
|
||||||
# We remove the server contact
|
# We remove the server contact
|
||||||
# remove it from treeview
|
# remove it from treeview
|
||||||
gajim.connections[account].unsubscribe(contact.jid)
|
gajim.connections[account].unsubscribe(contact.jid)
|
||||||
self.remove_contact(contact.jid, account, backend = True)
|
self.remove_contact(contact.jid, account, backend=True)
|
||||||
return
|
return
|
||||||
|
|
||||||
def remove(list_):
|
def remove(list_):
|
||||||
|
@ -2281,7 +2285,7 @@ class RosterWindow:
|
||||||
full_jid = contact.get_full_jid()
|
full_jid = contact.get_full_jid()
|
||||||
gajim.connections[account].unsubscribe_agent(full_jid)
|
gajim.connections[account].unsubscribe_agent(full_jid)
|
||||||
# remove transport from treeview
|
# remove transport from treeview
|
||||||
self.remove_contact(contact.jid, account, backend = True)
|
self.remove_contact(contact.jid, account, backend=True)
|
||||||
|
|
||||||
# Check if there are unread events from some contacts
|
# Check if there are unread events from some contacts
|
||||||
has_unread_events = False
|
has_unread_events = False
|
||||||
|
@ -2544,7 +2548,7 @@ class RosterWindow:
|
||||||
self.remove_contact_from_groups(contact.jid,account, [group])
|
self.remove_contact_from_groups(contact.jid,account, [group])
|
||||||
else:
|
else:
|
||||||
gajim.connections[account].unsubscribe(contact.jid)
|
gajim.connections[account].unsubscribe(contact.jid)
|
||||||
self.remove_contact(contact.jid, account, backend = True)
|
self.remove_contact(contact.jid, account, backend=True)
|
||||||
|
|
||||||
def on_assign_pgp_key(self, widget, contact, account):
|
def on_assign_pgp_key(self, widget, contact, account):
|
||||||
attached_keys = gajim.config.get_per('accounts', account,
|
attached_keys = gajim.config.get_per('accounts', account,
|
||||||
|
@ -2918,7 +2922,7 @@ class RosterWindow:
|
||||||
remove_auth = False
|
remove_auth = False
|
||||||
for (contact, account) in list_:
|
for (contact, account) in list_:
|
||||||
gajim.connections[account].unsubscribe(contact.jid, remove_auth)
|
gajim.connections[account].unsubscribe(contact.jid, remove_auth)
|
||||||
self.remove_contact(contact.jid, account, backend = True)
|
self.remove_contact(contact.jid, account, backend=True)
|
||||||
if not remove_auth and contact.sub == 'both':
|
if not remove_auth and contact.sub == 'both':
|
||||||
contact.name = ''
|
contact.name = ''
|
||||||
contact.groups = []
|
contact.groups = []
|
||||||
|
|
Loading…
Reference in New Issue