Show
Ignore:
Timestamp:
06/29/08 06:39:29 (5 months ago)
Author:
bct
Message:

make esession authentication warning less obtrusive

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/chat_control.py

    r9811 r9861  
    10571057                        gajim.config.get('hide_chat_banner')) 
    10581058 
     1059                self.authentication_button = self.xml.get_widget('authentication_button') 
     1060                id = self.authentication_button.connect('clicked', self._on_authentication_button_clicked) 
     1061                self.handlers[id] = self.authentication_button 
     1062 
    10591063                # Add lock image to show chat encryption 
    10601064                self.lock_image = self.xml.get_widget('lock_image') 
     
    11161120                self.handlers[id] = widget 
    11171121 
    1118                 self.session = session 
     1122                if not session: 
     1123                        session = gajim.connections[self.account].find_controlless_session(self.contact.jid) 
     1124                        self.session = session 
     1125 
    11191126                if session: 
    11201127                        session.control = self 
    1121  
    1122                 # Enable ecryption if needed 
     1128                        self.session = session 
     1129 
     1130                        if session.enable_encryption: 
     1131                                self.print_esession_details() 
     1132 
     1133                # Enable encryption if needed 
    11231134                e2e_is_active = hasattr(self, 'session') and self.session and self.session.enable_encryption 
    11241135                self.gpg_is_active = False 
     
    11351146                                self.session.loggable = gajim.config.get('log_encrypted_sessions') 
    11361147                        self._show_lock_image(self.gpg_is_active, 'GPG', self.gpg_is_active, self.session and \ 
    1137                                         self.session.is_loggable()) 
     1148                                        self.session.is_loggable(), self.session and self.session.verified_identity) 
    11381149 
    11391150                self.status_tooltip = gtk.Tooltips() 
     
    13661377 
    13671378                self._show_lock_image(self.gpg_is_active, 'GPG', self.gpg_is_active, self.session and \ 
    1368                                 self.session.is_loggable()) 
     1379                                self.session.is_loggable(), self.session and self.session.verified_identity) 
    13691380 
    13701381        def _show_lock_image(self, visible, enc_type = '', enc_enabled = False, chat_logged = False, authenticated = False): 
     
    13741385                logged_string = chat_logged and 'will' or 'will NOT' 
    13751386 
    1376                 if enc_type == 'OTR': 
    1377                         authenticated_string = authenticated \ 
    1378                                 and ' and authenticated' \ 
    1379                                 or ' and NOT authenticated' 
    1380                 else: 
    1381                         authenticated_string = '' 
    1382  
    1383                 tooltip = '%s Encryption %s active%s.\n' \ 
     1387                if authenticated: 
     1388                        authenticated_string = ' and authenticated' 
     1389                        self.lock_image.set_from_stock('gtk-dialog-authentication', 1) 
     1390                else: 
     1391                        authenticated_string = ' and NOT authenticated' 
     1392                        self.lock_image.set_from_stock('gtk-dialog-warning', 1) 
     1393 
     1394                tooltip = '%s encryption %s active%s.\n' \ 
    13841395                        'Your chat session %s be logged.' % \ 
    1385                         (enc_type, status_string, authenticated_string,  
     1396                        (enc_type, status_string, authenticated_string, 
    13861397                        logged_string) 
    13871398 
    1388                 self.lock_tooltip.set_tip(self.lock_image, tooltip) 
    1389                 self.widget_set_visible(self.lock_image, not visible) 
     1399                self.lock_tooltip.set_tip(self.authentication_button, tooltip) 
     1400                self.widget_set_visible(self.authentication_button, not visible) 
    13901401                self.lock_image.set_sensitive(enc_enabled) 
     1402 
     1403        def _on_authentication_button_clicked(self, widget): 
     1404                if self.session and self.session.enable_encryption: 
     1405                        dialogs.ESessionInfoWindow(self.session) 
    13911406 
    13921407        def _process_command(self, message): 
     
    15891604 
    15901605                        ChatControlBase.print_conversation_line(self, msg, 'status', '', None) 
     1606 
     1607                        if not self.session.verified_identity: 
     1608                                ChatControlBase.print_conversation_line(self, 'SAS not verified', 'status', '', None) 
    15911609                else: 
    15921610                        msg = _('E2E encryption disabled') 
    15931611                        ChatControlBase.print_conversation_line(self, msg, 'status', '', None) 
     1612 
    15941613                self._show_lock_image(e2e_is_active, 'E2E', e2e_is_active, self.session and \ 
    1595                                 self.session.is_loggable()) 
     1614                                self.session.is_loggable(), self.session and self.session.verified_identity) 
    15961615 
    15971616        def print_conversation(self, text, frm='', tim=None, encrypted=False,