Changeset 9955

Show
Ignore:
Timestamp:
07/19/08 00:42:28 (5 months ago)
Author:
bct
Message:

disconnect session from chat window only when the highest remote contact changes

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/gajim.py

    r9945 r9955  
    629629                        ji = jid 
    630630 
     631                highest = gajim.contacts.get_contact_with_highest_priority(account, jid) 
     632                was_highest = (highest and highest.resource == resource) 
     633 
    631634                # Update contact 
    632635                jid_list = gajim.contacts.get_jid_list(account) 
     
    640643                                        contact1 = c 
    641644                                        break 
    642  
    643                         highest = gajim.contacts.get_highest_prio_contact_from_contacts(lcontact) 
    644                         if not highest or \ 
    645                         (highest.priority < priority and highest.resource != resource) or \ 
    646                         (highest.resource == resource and highest.priority > priority): 
    647                                 # either this contact is the new highest priority contact or it was the 
    648                                 # highest and dropped in priority (so may no longer be the highest) 
    649  
    650                                 # disconnect sessions from this contact's chat controls so we 
    651                                 # don't have to open a new tab if a new session comes in 
    652  
    653                                 ctrl = self.msg_win_mgr.get_control(jid, account) 
    654                                 if ctrl: 
    655                                         ctrl.set_session(None) 
    656645 
    657646                        if contact1: 
     
    690679                                        lcontact.append(contact1) 
    691680                                contact1.resource = resource 
    692                          
     681 
    693682                                self.roster.add_contact(contact1.jid, account) 
    694683 
     
    781770                        self.handle_event_gc_notify(account, (jid, array[1], status_message, 
    782771                                array[3], None, None, None, None, None, [], None, None)) 
     772 
     773                highest = gajim.contacts.get_contact_with_highest_priority(account, jid) 
     774                is_highest = (highest and highest.resource == resource) 
     775 
     776                if was_highest and not is_highest: 
     777                        ctrl = self.msg_win_mgr.get_control(jid, account) 
     778                        if ctrl: 
     779                                ctrl.set_session(None) 
    783780 
    784781        def handle_event_msgerror(self, account, array):