Author: steve-e Date: 2008-07-07 00:24:58 +0200 (Mon, 07 Jul 2008) New Revision: 9894
Modified: trunk/src/gajim.py trunk/src/roster_window.py Log: Correctly readd a metacontact family after removing a single brother.
* Coding standards * remove useless key-list creation
Modified: trunk/src/gajim.py =================================================================== --- trunk/src/gajim.py 2008-07-06 22:24:19 UTC (rev 9893) +++ trunk/src/gajim.py 2008-07-06 22:24:58 UTC (rev 9894) @@ -926,7 +926,7 @@ if c.jid in gajim.to_be_removed[account]: # This way we'll really remove it 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): # ('REGISTER_AGENT_INFO', account, (agent, infos, is_form)) @@ -1394,7 +1394,7 @@ not name and not groups: # contact removes us. if contacts: - self.roster.remove_contact(jid, account, backend = True) + self.roster.remove_contact(jid, account, backend=True) return elif not contacts: if sub == 'remove':
Modified: trunk/src/roster_window.py =================================================================== --- trunk/src/roster_window.py 2008-07-06 22:24:19 UTC (rev 9893) +++ trunk/src/roster_window.py 2008-07-06 22:24:58 UTC (rev 9894) @@ -667,7 +667,7 @@ 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 all its group. Remove empty groups or redraw @@ -692,7 +692,7 @@ if not force and self.contact_has_pending_roster_events(contact, account): # Contact has pending events 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} return False else: @@ -705,13 +705,17 @@ else: self._remove_entity(contact, account)
- # Draw all groups of the contact
if backend: # Remove contact before redrawing, otherwise the old # 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(): self.draw_group(group, account) self.draw_account(account) @@ -745,7 +749,7 @@ '''Remove groupchat from roster and redraw account and group.''' contact = gajim.contacts.get_contact_with_highest_priority(account, jid) if contact.is_groupchat(): - self.remove_contact(jid, account, force = True, backend = True) + self.remove_contact(jid, account, force=True, backend=True) return True else: return False @@ -767,7 +771,7 @@ def remove_transport(self, jid, account): '''Remove transport from roster and redraw account and group.''' 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
def add_contact_to_groups(self, jid, account, groups, update = True): @@ -1603,7 +1607,7 @@ if key in self.contacts_to_be_removed.keys(): del self.contacts_to_be_removed[key] # 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()
def open_event(self, account, jid, event): @@ -1817,7 +1821,7 @@ elif contact.jid == gajim.get_jid_from_account(account) and \ show in ('offline', 'error'): # 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 if gajim.interface.msg_win_mgr.has_window(contact.jid, account): @@ -2273,7 +2277,7 @@ # We remove the server contact # remove it from treeview gajim.connections[account].unsubscribe(contact.jid) - self.remove_contact(contact.jid, account, backend = True) + self.remove_contact(contact.jid, account, backend=True) return
def remove(list_): @@ -2281,7 +2285,7 @@ full_jid = contact.get_full_jid() gajim.connections[account].unsubscribe_agent(full_jid) # 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 has_unread_events = False @@ -2544,7 +2548,7 @@ self.remove_contact_from_groups(contact.jid,account, [group]) else: 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): attached_keys = gajim.config.get_per('accounts', account, @@ -2918,7 +2922,7 @@ remove_auth = False for (contact, account) in list_: 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': contact.name = '' contact.groups = []