Show
Ignore:
Timestamp:
05/13/08 03:59:10 (6 months ago)
Author:
bct
Message:

merged in session-centric branch, with fixes for OTR compatibility

Files:
1 modified

Legend:

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

    r9616 r9625  
    3333                                self.thread_id = self.generate_thread_id() 
    3434 
     35                self.loggable = True 
     36 
    3537                self.last_send = 0 
    3638                self.status = None 
    3739                self.negotiated = {} 
     40 
     41        def is_loggable(self): 
     42                account = self.conn.name 
     43                no_log_for = gajim.config.get_per('accounts', account, 'no_log_for') 
     44 
     45                if not no_log_for: 
     46                        no_log_for = '' 
     47 
     48                no_log_for = no_log_for.split() 
     49 
     50                return self.loggable and account not in no_log_for and self.jid not in no_log_for 
    3851 
    3952        def generate_thread_id(self): 
     
    7184                '''A negotiation has been cancelled, so reset this session to its default state.''' 
    7285 
    73                 if hasattr(self, 'control'): 
     86                if self.control: 
    7487                        self.control.on_cancel_session_negotiation() 
    7588 
     
    132145        def __init__(self, conn, jid, thread_id, type = 'chat'): 
    133146                StanzaSession.__init__(self, conn, jid, thread_id, type = 'chat') 
    134  
    135                 self.loggable = True 
    136147 
    137148                self.xes = {} 
     
    768779                self.enable_encryption = True 
    769780 
    770                 if hasattr(self, 'control'): 
     781                if self.control: 
    771782                        self.control.print_esession_details() 
    772783 
     
    788799                self.do_retained_secret(k, srs) 
    789800 
    790                 # don't need to calculate ks_s here 
    791  
     801                # ks_s doesn't need to be calculated here 
    792802                self.kc_s, self.km_s, self.ks_s = self.generate_initiator_keys(k) 
    793803                self.kc_o, self.km_o, self.ks_o = self.generate_responder_keys(k) 
     
    796806 
    797807                self.verify_identity(form, self.d, False, 'b') 
    798 # Note: If Alice discovers an error then she SHOULD ignore any encrypted content she received in the stanza. 
     808                # Note: If Alice discovers an error then she SHOULD ignore any encrypted content she received in the stanza. 
    799809 
    800810                if self.negotiated['logging'] == 'mustnot': 
     
    804814                self.enable_encryption = True 
    805815 
    806                 if hasattr(self, 'control'): 
     816                if self.control: 
    807817                        self.control.print_esession_details() 
    808818 
     
    892902                self.km_o = '' 
    893903 
    894         def is_loggable(self): 
    895                 account = self.conn.name 
    896                 no_log_for = gajim.config.get_per('accounts', account, 'no_log_for') 
    897  
    898                 if not no_log_for: 
    899                         no_log_for = '' 
    900  
    901                 no_log_for = no_log_for.split() 
    902  
    903                 return self.loggable and account not in no_log_for and self.jid not in no_log_for 
    904  
    905904        def cancelled_negotiation(self): 
    906905                StanzaSession.cancelled_negotiation(self)