Show
Ignore:
Timestamp:
08/29/07 23:10:41 (15 months ago)
Author:
roidelapluie
Message:

Print resource in chat window only if several resources. Fix #3175.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/gajim_0.11.1/src/roster_window.py

    r8598 r8603  
    11801180                contact.show = show 
    11811181                contact.status = status 
     1182                # name is to show in conversation window 
     1183                name = contact.get_shown_name() 
     1184 
    11821185                if show in ('offline', 'error') and \ 
    11831186                len(gajim.events.get_events(account, contact.get_full_jid())) == 0: 
    11841187                        if len(contact_instances) > 1: 
    11851188                                # if multiple resources 
     1189                                if contact.resource != '': 
     1190                                        name += '/' + contact.resource 
    11861191                                jid_with_resource = contact.jid + '/' + contact.resource 
    11871192                                if gajim.interface.msg_win_mgr.has_window(jid_with_resource, 
     
    11931198                                        win.redraw_tab(ctrl) 
    11941199                                gajim.contacts.remove_contact(account, contact) 
     1200                elif len(contact_instances) > 1 and contact.resource != '': 
     1201                        name += '/' + contact.resource 
    11951202                self.remove_contact(contact, account) 
    11961203                self.add_contact_to_roster(contact.jid, account) 
    11971204                # print status in chat window and update status/GPG image 
    1198                 jid_list = [contact.jid] 
    1199                 for jid in jid_list: 
    1200                         if gajim.interface.msg_win_mgr.has_window(jid, account): 
    1201                                 win = gajim.interface.msg_win_mgr.get_window(jid, account) 
    1202                                 ctrl = win.get_control(jid, account) 
    1203                                 ctrl.contact = gajim.contacts.get_contact_with_highest_priority( 
    1204                                         account, contact.jid) 
    1205                                 ctrl.update_ui() 
    1206                                 win.redraw_tab(ctrl) 
    1207  
    1208                                 name = contact.get_shown_name() 
    1209  
    1210                                 # if multiple resources (or second one disconnecting) 
    1211                                 if (len(contact_instances) > 1 or (len(contact_instances) == 1 and \ 
    1212                                 show in ('offline', 'error'))) and contact.resource != '': 
    1213                                         name += '/' + contact.resource 
    1214                                  
    1215                                 uf_show = helpers.get_uf_show(show) 
    1216                                 if status:  
    1217                                         ctrl.print_conversation(_('%s is now %s (%s)') % (name, uf_show, 
    1218                                                 status), 'status') 
    1219                                 else: # No status message 
    1220                                         ctrl.print_conversation(_('%s is now %s') % (name, uf_show), 
    1221                                                 'status') 
     1205                if gajim.interface.msg_win_mgr.has_window(contact.jid, account): 
     1206                        win = gajim.interface.msg_win_mgr.get_window(contact.jid, account) 
     1207                        ctrl = win.get_control(contact.jid, account) 
     1208                        ctrl.contact = gajim.contacts.get_contact_with_highest_priority( 
     1209                                account, contact.jid) 
     1210                        ctrl.update_ui() 
     1211                        win.redraw_tab(ctrl) 
     1212  
     1213                        uf_show = helpers.get_uf_show(show) 
     1214                        if status: 
     1215                                ctrl.print_conversation(_('%s is now %s (%s)') % (name, uf_show, 
     1216                                        status), 'status') 
     1217                        else: # No status message 
     1218                                ctrl.print_conversation(_('%s is now %s') % (name, uf_show), 
     1219                                        'status') 
     1220 
    12221221 
    12231222                if not contact.groups: