Changeset 9116

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

merged realtime cancellation patch

Location:
branches/session_centric/src
Files:
4 modified

Legend:

Unmodified
Added
Removed
  • branches/session_centric/src/chat_control.py

    r9113 r9116  
    14651465                self.kbd_activity_in_last_30_secs = False 
    14661466 
     1467        def on_cancel_session_negotiation(self): 
     1468                msg = _('Session negotiation cancelled') 
     1469                ChatControlBase.print_conversation_line(self, msg, 'status', '', None) 
    14671470 
    14681471        # print esession settings to textview 
     
    21562159                tb = self.xml.get_widget('gpg_togglebutton') 
    21572160                tb.set_active(not tb.get_active()) 
    2158          
     2161 
    21592162        def _on_convert_to_gc_menuitem_activate(self, widget): 
    21602163                '''user want to invite some friends to chat''' 
     
    21652168                        self.session.terminate_e2e() 
    21662169 
    2167                         msg = _('Encryption disabled') 
    2168                         ChatControlBase.print_conversation_line(self, msg,  
    2169                                 'status', '', None) 
     2170                        self.print_esession_details() 
    21702171 
    21712172                        jid = str(self.session.jid) 
  • branches/session_centric/src/common/stanza_session.py

    r9113 r9116  
    3737                self.status = None 
    3838                self.negotiated = {} 
    39          
     39 
    4040        def generate_thread_id(self): 
    4141                return "".join([random.choice(string.ascii_letters) for x in xrange(0,32)]) 
     
    4747                msg.setAttr('to', self.jid) 
    4848                self.conn.send_stanza(msg) 
    49          
     49 
    5050                if isinstance(msg, xmpp.Message): 
    5151                        self.last_send = time.time() 
     
    7373 
    7474                if hasattr(self, 'control'): 
    75                         msg = _('Session negotiation cancelled') 
    76                         self.control.print_conversation_line(self, msg, 'status', '', None) 
     75                        self.control.on_cancel_session_negotiation() 
    7776 
    7877                self.status = None 
     
    351350 
    352351                        if not eir_pubkey.verify(hash, signature): 
    353                                 raise exceptions.NegotiationError, 'public key signature verification failed!'  
     352                                raise exceptions.NegotiationError, 'public key signature verification failed!' 
    354353 
    355354                elif mac_o_calculated != mac_o: 
     
    904903 
    905904                return self.loggable and account not in no_log_for and self.jid not in no_log_for 
     905 
     906        def cancelled_negotiation(self): 
     907                StanzaSession.cancelled_negotiation(self) 
     908                self.enable_encryption = False 
     909 
     910                self.km_o = '' 
  • branches/session_centric/src/gajim.py

    r9113 r9116  
    19031903 
    19041904                if form.getField('accept') and not form['accept'] in ('1', 'true'): 
    1905                         dialogs.InformationDialog(_('Session negotiation cancelled'), 
    1906                                         _('The client at %s cancelled the session negotiation.') % (jid)) 
    19071905                        session.cancelled_negotiation() 
    19081906                        return 
     
    20192017                        # user cancelled the negotiation 
    20202018 
    2021                         session.cancelled_negotiation() 
    2022  
    2023                         return 
    2024  
    2025                 if form.getField('terminate'): 
    2026                         if form.getField('terminate').getValue() in ('1', 'true'): 
    2027                                 session.acknowledge_termination() 
    2028  
    2029                                 gajim.connections[account].delete_session(str(jid), session.thread_id) 
    2030  
    2031                                 ctrl = gajim.interface.msg_win_mgr.get_control(str(jid), account) 
    2032  
    2033                                 if ctrl: 
    2034                                         new_sess = gajim.connections[account].make_new_session(str(jid)) 
    2035                                         ctrl.set_session(new_sess) 
    2036  
    2037                                 return 
     2019                        session.reject_negotiation() 
     2020 
     2021                        return 
     2022 
     2023                if form.getField('terminate') and\ 
     2024                form.getField('terminate').getValue() in ('1', 'true'): 
     2025                        was_encrypted = session.enable_encryption 
     2026                        ctrl = session.control 
     2027 
     2028                        session.acknowledge_termination() 
     2029                        gajim.connections[account].delete_session(str(jid), session.thread_id) 
     2030 
     2031                        if ctrl: 
     2032                                new_sess = gajim.connections[account].make_new_session(str(jid)) 
     2033                                ctrl.set_session(new_sess) 
     2034 
     2035                                if was_encrypted: 
     2036                                        ctrl.print_esession_details() 
     2037 
     2038                        return 
    20382039 
    20392040                # non-esession negotiation. this isn't very useful, but i'm keeping it around 
  • branches/session_centric/src/negotiation.py

    r8873 r9116  
    2020 
    2121        def failure_cb(): 
    22                 session.cancelled_negotiation() 
     22                session.reject_negotiation() 
    2323 
    2424        dialogs.ConfirmationDialogCheck(_('''OK to continue with negotiation?'''),