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/message_control.py

    r8926 r9113  
    118118 
    119119        def set_session(self, session): 
    120                 if session == self.session: 
     120                if hasattr(self, 'session') and session == self.session: 
    121121                        return 
    122122 
    123                 if self.session: 
     123                was_encrypted = False 
     124 
     125                if hasattr(self, 'session') and self.session: 
     126                        if self.session.enable_encryption: 
     127                                was_encrypted = True 
     128 
    124129                        print "starting a new session, dropping the old one!" 
    125130                        gajim.connections[self.account].delete_session(self.session.jid, self.session.thread_id) 
    126131 
    127132                self.session = session 
     133 
     134                if session: 
     135                        session.control = self 
     136 
     137                        if was_encrypted: 
     138                                self.print_esession_details() 
    128139 
    129140        def send_message(self, message, keyID = '', type = 'chat', 
     
    135146 
    136147                if not self.session: 
    137                         self.session = gajim.connections[self.account].make_new_session(self.contact.get_full_jid()) 
     148                        fjid = self.contact.get_full_jid() 
     149                        new_session = gajim.connections[self.account].make_new_session(fjid) 
     150 
     151                        self.set_session(new_session) 
    138152 
    139153                # Send and update history