| | 3791 | |
| | 3792 | class ESessionInfoWindow: |
| | 3793 | '''Class for displaying information about a XEP-0116 encrypted session''' |
| | 3794 | def __init__(self, session): |
| | 3795 | self.session = session |
| | 3796 | |
| | 3797 | self.xml = gtkgui_helpers.get_glade('esession_info_window.glade') |
| | 3798 | self.xml.signal_autoconnect(self) |
| | 3799 | |
| | 3800 | self.update_info() |
| | 3801 | |
| | 3802 | self.window = self.xml.get_widget('esession_info_window') |
| | 3803 | self.window.show_all() |
| | 3804 | |
| | 3805 | def update_info(self): |
| | 3806 | labeltext = _('''Your chat session with %s is encrypted.\n\nSAS is: %s''') % (self.session.jid, self.session.sas) |
| | 3807 | |
| | 3808 | if self.session.verified_identity: |
| | 3809 | labeltext += '\n\n' + _('''You have already verified this contact's identity.''') |
| | 3810 | w = self.xml.get_widget('verification_info') |
| | 3811 | w.set_no_show_all(True) |
| | 3812 | w.hide() |
| | 3813 | |
| | 3814 | self.xml.get_widget('info_display').set_text(labeltext) |
| | 3815 | |
| | 3816 | def on_close_button_clicked(self, widget): |
| | 3817 | self.window.destroy() |
| | 3818 | |
| | 3819 | def on_verify_now_button_clicked(self, widget): |
| | 3820 | pritext = _('''Have you verified the remote contact's identity?''') |
| | 3821 | sectext = _('''To prevent a man-in-the-middle attack, you should speak to this person directly (in person or on the phone) and verify that they see the same SAS as you.\n\nThis session's SAS: %s''') % self.session.sas |
| | 3822 | sectext += '\n\n' + _('Did you talk to the remote contact and verify the SAS?') |
| | 3823 | |
| | 3824 | dialog = YesNoDialog(pritext, sectext) |
| | 3825 | |
| | 3826 | if dialog.get_response() == gtk.RESPONSE_YES: |
| | 3827 | self.session._verified_srs_cb() |
| | 3828 | self.session.verified_identity = True |
| | 3829 | self.update_info() |