Changeset 6261

Show
Ignore:
Timestamp:
05/01/06 20:29:12 (2 years ago)
Author:
asterix
Message:

be sure that transport is really removed before we start to remove its contacts.

Location:
trunk/src
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/common/connection_handlers.py

    r6253 r6261  
    4141VCARD_PUBLISHED = 'vcard_published' 
    4242VCARD_ARRIVED = 'vcard_arrived' 
     43AGENT_REMOVED = 'agent_removed' 
    4344HAS_IDLE = True 
    4445try: 
     
    948949                                elif jid == our_jid: 
    949950                                        self.dispatch('MYVCARD', {'jid': jid}) 
     951                elif self.awaiting_answers[id][0] == AGENT_REMOVED: 
     952                        jid = self.awaiting_answers[id][1] 
     953                        self.dispatch('AGENT_REMOVED', jid) 
    950954                del self.awaiting_answers[id] 
    951955         
  • trunk/src/common/connection.py

    r6253 r6261  
    745745                iq = common.xmpp.Iq('set', common.xmpp.NS_REGISTER, to = agent) 
    746746                iq.getTag('query').setTag('remove') 
     747                id = self.connection.getAnID() 
     748                iq.setID(id) 
     749                self.awaiting_answers[id] = (AGENT_REMOVED, agent) 
    747750                self.connection.send(iq) 
    748751                self.connection.getRoster().delItem(agent) 
  • trunk/src/gajim.py

    r6235 r6261  
    730730                        return 
    731731 
     732        def handle_event_agent_removed(self, account, agent): 
     733                # remove transport's contacts from treeview 
     734                jid_list = gajim.contacts.get_jid_list(account) 
     735                for jid in jid_list: 
     736                        if jid.endswith('@' + agent): 
     737                                c = gajim.contacts.get_first_contact_from_jid(account, jid) 
     738                                gajim.log.debug( 
     739                                        'Removing contact %s due to unregistered transport %s'\ 
     740                                        % (jid, agent)) 
     741                                gajim.connections[account].unsubscribe(c.jid) 
     742                                # Transport contacts can't have 2 resources 
     743                                if c.jid in gajim.to_be_removed[account]: 
     744                                        # This way we'll really remove it 
     745                                        gajim.to_be_removed[account].remove(c.jid) 
     746                                gajim.contacts.remove_jid(account, c.jid) 
     747                                self.roster.remove_contact(c, account) 
     748 
    732749        def handle_event_register_agent_info(self, account, array): 
    733750                #('REGISTER_AGENT_INFO', account, (agent, infos, is_form)) 
     
    16241641                        'AGENT_ERROR_INFO': self.handle_event_agent_info_error, 
    16251642                        'AGENT_ERROR_ITEMS': self.handle_event_agent_items_error, 
     1643                        'AGENT_REMOVED': self.handle_event_agent_removed, 
    16261644                        'REGISTER_AGENT_INFO': self.handle_event_register_agent_info, 
    16271645                        'AGENT_INFO_ITEMS': self.handle_event_agent_info_items, 
  • trunk/src/roster_window.py

    r6242 r6261  
    11431143                        # remove transport from treeview 
    11441144                        self.remove_contact(contact, account) 
    1145                         # remove transport's contacts from treeview 
    1146                         jid_list = gajim.contacts.get_jid_list(account) 
    1147                         for jid in jid_list: 
    1148                                 if jid.endswith('@' + contact.jid): 
    1149                                         c = gajim.contacts.get_first_contact_from_jid(account, jid) 
    1150                                         gajim.log.debug( 
    1151                                                 'Removing contact %s due to unregistered transport %s'\ 
    1152                                                 % (jid, contact.jid)) 
    1153                                         gajim.connections[account].unsubscribe(c.jid) 
    1154                                         # Transport contacts can't have 2 resources 
    1155                                         gajim.contacts.remove_jid(account, c.jid) 
    1156                                         self.remove_contact(c, account) 
    11571145                        gajim.contacts.remove_jid(account, contact.jid) 
    11581146                        gajim.contacts.remove_contact(account, contact)