Changeset 9894

Show
Ignore:
Timestamp:
07/07/08 00:24:58 (2 months ago)
Author:
steve-e
Message:

Correctly readd a metacontact family after removing a single brother.

* Coding standards
* remove useless key-list creation

Location:
trunk/src
Files:
2 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/gajim.py

    r9889 r9894  
    927927                                        # This way we'll really remove it 
    928928                                        gajim.to_be_removed[account].remove(c.jid) 
    929                                 self.roster.remove_contact(c.jid, account, backend = True) 
     929                                self.roster.remove_contact(c.jid, account, backend=True) 
    930930 
    931931        def handle_event_register_agent_info(self, account, array): 
     
    13951395                        # contact removes us. 
    13961396                        if contacts: 
    1397                                 self.roster.remove_contact(jid, account, backend = True) 
     1397                                self.roster.remove_contact(jid, account, backend=True) 
    13981398                                return 
    13991399                elif not contacts: 
  • trunk/src/roster_window.py

    r9892 r9894  
    668668 
    669669 
    670         def remove_contact(self, jid, account, force = False, backend = False): 
     670        def remove_contact(self, jid, account, force=False, backend=False): 
    671671                '''Remove contact from roster. 
    672672 
     
    693693                        # Contact has pending events 
    694694                        key = (jid, account) 
    695                         if not key in self.contacts_to_be_removed.keys(): 
     695                        if not key in self.contacts_to_be_removed: 
    696696                                self.contacts_to_be_removed[key] = {'backend': backend} 
    697697                        return False 
     
    706706                                self._remove_entity(contact, account) 
    707707 
    708                         # Draw all groups of the contact 
    709708 
    710709                        if backend: 
    711710                                # Remove contact before redrawing, otherwise the old 
    712711                                # numbers will still be show 
    713                                 gajim.contacts.remove_jid(account, jid) 
    714  
     712                                gajim.contacts.remove_jid(account, jid, remove_meta=True) 
     713                                family = gajim.contacts.get_metacontacts_family(account, jid) 
     714                                if family: 
     715                                        # reshow the rest of the family 
     716                                        self._add_metacontact_family(family, account) 
     717 
     718                        # Draw all groups of the contact 
    715719                        for group in contact.get_shown_groups(): 
    716720                                self.draw_group(group, account) 
     
    746750                contact = gajim.contacts.get_contact_with_highest_priority(account, jid) 
    747751                if contact.is_groupchat(): 
    748                         self.remove_contact(jid, account, force = True, backend = True) 
     752                        self.remove_contact(jid, account, force=True, backend=True) 
    749753                        return True 
    750754                else: 
     
    768772                '''Remove transport from roster and redraw account and group.''' 
    769773                contact = gajim.contacts.get_contact_with_highest_priority(account, jid) 
    770                 self.remove_contact(jid, account, force = True, backend = True) 
     774                self.remove_contact(jid, account, force=True, backend=True) 
    771775                return True 
    772776 
     
    16041608                                del self.contacts_to_be_removed[key] 
    16051609                                # Remove contact will delay removal if there are more events pending 
    1606                                 self.remove_contact(jid, account, backend = True) 
     1610                                self.remove_contact(jid, account, backend=True) 
    16071611                self.show_title() 
    16081612 
     
    18181822                show in ('offline', 'error'): 
    18191823                        # SelfContact went offline. Remove him when last pending message was read 
    1820                         self.remove_contact(contact.jid, account, backend = True) 
     1824                        self.remove_contact(contact.jid, account, backend=True) 
    18211825 
    18221826                # print status in chat window and update status/GPG image 
     
    22742278                                # remove it from treeview 
    22752279                                gajim.connections[account].unsubscribe(contact.jid) 
    2276                                 self.remove_contact(contact.jid, account, backend = True) 
     2280                                self.remove_contact(contact.jid, account, backend=True) 
    22772281                                return 
    22782282 
     
    22822286                                gajim.connections[account].unsubscribe_agent(full_jid) 
    22832287                                # remove transport from treeview 
    2284                                 self.remove_contact(contact.jid, account, backend = True) 
     2288                                self.remove_contact(contact.jid, account, backend=True) 
    22852289 
    22862290                # Check if there are unread events from some contacts 
     
    25452549                                else: 
    25462550                                        gajim.connections[account].unsubscribe(contact.jid) 
    2547                                         self.remove_contact(contact.jid, account, backend = True) 
     2551                                        self.remove_contact(contact.jid, account, backend=True) 
    25482552 
    25492553        def on_assign_pgp_key(self, widget, contact, account): 
     
    29192923                        for (contact, account) in list_: 
    29202924                                gajim.connections[account].unsubscribe(contact.jid, remove_auth) 
    2921                                 self.remove_contact(contact.jid, account, backend = True) 
     2925                                self.remove_contact(contact.jid, account, backend=True) 
    29222926                                if not remove_auth and contact.sub == 'both': 
    29232927                                        contact.name = ''