Author: bct Date: 2007-12-08 09:51:10 +0100 (Sat, 08 Dec 2007) New Revision: 9115
Modified: trunk/src/chat_control.py trunk/src/common/stanza_session.py trunk/src/gajim.py trunk/src/negotiation.py Log: corrected realtime notification of session cancellation
Modified: trunk/src/chat_control.py =================================================================== --- trunk/src/chat_control.py 2007-12-08 06:22:23 UTC (rev 9114) +++ trunk/src/chat_control.py 2007-12-08 08:51:10 UTC (rev 9115) @@ -1464,6 +1464,9 @@ self.mouse_over_in_last_30_secs = False self.kbd_activity_in_last_30_secs = False
+ def on_cancel_session_negotiation(self): + msg = _('Session negotiation cancelled') + ChatControlBase.print_conversation_line(self, msg, 'status', '', None)
# print esession settings to textview def print_esession_details(self): @@ -2155,7 +2158,7 @@ # this is reverse logic, as we are on 'activate' (before change happens) tb = self.xml.get_widget('gpg_togglebutton') tb.set_active(not tb.get_active()) - + def _on_convert_to_gc_menuitem_activate(self, widget): '''user want to invite some friends to chat''' dialogs.TransformChatToMUC(self.account, [self.contact.jid]) @@ -2164,9 +2167,7 @@ if self.session and self.session.enable_encryption: self.session.terminate_e2e()
- msg = _('Encryption disabled') - ChatControlBase.print_conversation_line(self, msg, - 'status', '', None) + self.print_esession_details()
jid = str(self.session.jid)
Modified: trunk/src/common/stanza_session.py =================================================================== --- trunk/src/common/stanza_session.py 2007-12-08 06:22:23 UTC (rev 9114) +++ trunk/src/common/stanza_session.py 2007-12-08 08:51:10 UTC (rev 9115) @@ -36,7 +36,7 @@ self.last_send = 0 self.status = None self.negotiated = {} - + def generate_thread_id(self): return "".join([random.choice(string.ascii_letters) for x in xrange(0,32)])
@@ -46,7 +46,7 @@
msg.setAttr('to', self.jid) self.conn.send_stanza(msg) - + if isinstance(msg, xmpp.Message): self.last_send = time.time()
@@ -72,8 +72,7 @@ '''A negotiation has been cancelled, so reset this session to its default state.'''
if hasattr(self, 'control'): - msg = _('Session negotiation cancelled') - self.control.print_conversation_line(self, msg, 'status', '', None) + self.control.on_cancel_session_negotiation()
self.status = None self.negotiated = {} @@ -350,7 +349,7 @@ hash = crypto.sha256(mac_o_calculated)
if not eir_pubkey.verify(hash, signature): - raise exceptions.NegotiationError, 'public key signature verification failed!' + raise exceptions.NegotiationError, 'public key signature verification failed!'
elif mac_o_calculated != mac_o: raise exceptions.NegotiationError, 'calculated mac_%s differs from received mac_%s' % (i_o, i_o) @@ -903,3 +902,9 @@ no_log_for = no_log_for.split()
return self.loggable and account not in no_log_for and self.jid not in no_log_for + + def cancelled_negotiation(self): + StanzaSession.cancelled_negotiation(self) + self.enable_encryption = False + + self.km_o = ''
Modified: trunk/src/gajim.py =================================================================== --- trunk/src/gajim.py 2007-12-08 06:22:23 UTC (rev 9114) +++ trunk/src/gajim.py 2007-12-08 08:51:10 UTC (rev 9115) @@ -1902,8 +1902,6 @@ jid, session, form = data
if form.getField('accept') and not form['accept'] in ('1', 'true'): - dialogs.InformationDialog(_('Session negotiation cancelled'), - _('The client at %s cancelled the session negotiation.') % (jid)) session.cancelled_negotiation() return
@@ -2018,23 +2016,26 @@ except exceptions.Cancelled: # user cancelled the negotiation
- session.cancelled_negotiation() + session.reject_negotiation()
return
- if form.getField('terminate'): - if form.getField('terminate').getValue() in ('1', 'true'): - session.acknowledge_termination() + if form.getField('terminate') and\ + form.getField('terminate').getValue() in ('1', 'true'): + was_encrypted = session.enable_encryption + ctrl = session.control
- gajim.connections[account].delete_session(str(jid), session.thread_id) + session.acknowledge_termination() + gajim.connections[account].delete_session(str(jid), session.thread_id)
- ctrl = gajim.interface.msg_win_mgr.get_control(str(jid), account) + if ctrl: + new_sess = gajim.connections[account].make_new_session(str(jid)) + ctrl.set_session(new_sess)
- if ctrl: - new_sess = gajim.connections[account].make_new_session(str(jid)) - ctrl.set_session(new_sess) + if was_encrypted: + ctrl.print_esession_details()
- return + return
# non-esession negotiation. this isn't very useful, but i'm keeping it around # to test my test suite.
Modified: trunk/src/negotiation.py =================================================================== --- trunk/src/negotiation.py 2007-12-08 06:22:23 UTC (rev 9114) +++ trunk/src/negotiation.py 2007-12-08 08:51:10 UTC (rev 9115) @@ -19,7 +19,7 @@ on_success(checked)
def failure_cb(): - session.cancelled_negotiation() + session.reject_negotiation()
dialogs.ConfirmationDialogCheck(_('''OK to continue with negotiation?'''), _('''You've begun an encrypted session with %s, but it can't be guaranteed that you're talking directly to the person you think you are.