Show
Ignore:
Timestamp:
12/08/07 06:49:38 (12 months ago)
Author:
bct
Message:

realtime notification of esession begin/end

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • trunk/src/chat_control.py

    r9071 r9113  
    10581058                        self.xml.get_widget('gpg_togglebutton').set_active(True) 
    10591059 
    1060                 self.session = session 
    1061  
    1062                 # does this window have an existing, active esession? 
    1063                 self.esessioned = False 
     1060                self.set_session(session) 
    10641061 
    10651062                self.status_tooltip = gtk.Tooltips() 
     
    14681465                self.kbd_activity_in_last_30_secs = False 
    14691466 
     1467 
     1468        # print esession settings to textview 
     1469        def print_esession_details(self): 
     1470                if self.session and self.session.enable_encryption: 
     1471                        msg = _('E2E encryption enabled') 
     1472                        ChatControlBase.print_conversation_line(self, msg, 'status', '', None) 
     1473 
     1474                        if self.session.loggable: 
     1475                                msg = _('Session WILL be logged') 
     1476                        else: 
     1477                                msg = _('Session WILL NOT be logged') 
     1478 
     1479                        ChatControlBase.print_conversation_line(self, msg, 'status', '', None) 
     1480                else: 
     1481                        msg = _('E2E encryption disabled') 
     1482                        ChatControlBase.print_conversation_line(self, msg, 'status', '', None) 
     1483 
    14701484        def print_conversation(self, text, frm = '', tim = None, 
    14711485                encrypted = False, subject = None, xhtml = None): 
     
    14871501                        name = '' 
    14881502                else: 
    1489                         # ESessions 
    14901503                        if self.session and self.session.enable_encryption: 
    1491                                 if not self.esessioned: 
    1492                                         msg = _('Encryption enabled') 
    1493                                         ChatControlBase.print_conversation_line(self, msg,  
    1494                                                 'status', '', tim) 
    1495  
    1496                                         if self.session.loggable: 
    1497                                                 msg = _('Session WILL be logged') 
    1498                                         else: 
    1499                                                 msg = _('Session WILL NOT be logged') 
    1500  
    1501                                         ChatControlBase.print_conversation_line(self, msg,  
    1502                                                 'status', '', tim) 
    1503  
    1504                                         self.esessioned = True 
    1505                                 elif not encrypted: 
     1504                                if not encrypted: 
    15061505                                        msg = _('The following message was NOT encrypted') 
    15071506                                        ChatControlBase.print_conversation_line(self, msg,  
    15081507                                                'status', '', tim) 
    1509                         elif self.esessioned: 
    1510                                 msg = _('Encryption disabled') 
    1511                                 ChatControlBase.print_conversation_line(self, msg,  
    1512                                         'status', '', tim) 
    1513                                 self.esessioned = False 
    15141508                        else: 
    15151509                                # GPG encryption 
    15161510                                ec = gajim.encrypted_chats[self.account] 
    15171511                                if encrypted and jid not in ec: 
    1518                                         msg = _('Encryption enabled') 
     1512                                        msg = _('OpenPGP Encryption enabled') 
    15191513                                        ChatControlBase.print_conversation_line(self, msg,  
    15201514                                                'status', '', tim) 
    15211515                                        ec.append(jid) 
    15221516                                elif not encrypted and jid in ec: 
    1523                                         msg = _('Encryption disabled') 
     1517                                        msg = _('OpenPGP Encryption disabled') 
    15241518                                        ChatControlBase.print_conversation_line(self, msg, 
    15251519                                                'status', '', tim) 
     
    20041998        def read_queue(self): 
    20051999                '''read queue and print messages containted in it''' 
     2000 
    20062001                jid = self.contact.jid 
    20072002                jid_with_resource = jid 
     
    20092004                        jid_with_resource += '/' + self.resource 
    20102005                events = gajim.events.get_events(self.account, jid_with_resource) 
     2006 
     2007                if hasattr(self, 'session') and self.session and self.session.enable_encryption: 
     2008                        self.print_esession_details() 
    20112009 
    20122010                # Is it a pm ? 
     
    21702168                        ChatControlBase.print_conversation_line(self, msg,  
    21712169                                'status', '', None) 
    2172                         self.esessioned = False 
    21732170 
    21742171                        jid = str(self.session.jid) 
     
    21772174                                self.session.thread_id) 
    21782175 
    2179                         self.session = gajim.connections[self.account].make_new_session(jid) 
     2176                        self.set_session(gajim.connections[self.account].make_new_session(jid)) 
    21802177                else: 
    21812178                        if not self.session: 
    2182                                 self.session = gajim.connections[self.account].make_new_session( 
    2183                                         self.contact.jid) 
     2179                                fjid = self.contact.get_full_jid() 
     2180                                new_sess = gajim.connections[self.account].make_new_session(fjid) 
     2181                                self.set_session(new_sess) 
    21842182 
    21852183                        # XXX decide whether to use 4 or 3 message negotiation