diff options
author | Samuel Hand <samuel.d.hand@gmail.com> | 2018-08-08 21:57:24 +0100 |
---|---|---|
committer | Samuel Hand <samuel.d.hand@gmail.com> | 2018-08-08 22:02:51 +0100 |
commit | 18419b3268c2b00d1099b55a22a1c11c349bafd9 (patch) | |
tree | 9a601a2ff9a658a605ee6aa7248941db734c9c7b /plugins/omemo/src/contact_details_dialog.vala | |
parent | cdaa29d7f08fcee1099c53184ba8b36bb93a1bc1 (diff) | |
download | dino-18419b3268c2b00d1099b55a22a1c11c349bafd9.tar.gz dino-18419b3268c2b00d1099b55a22a1c11c349bafd9.zip |
Show a verification QR code for an accounts own key
Diffstat (limited to 'plugins/omemo/src/contact_details_dialog.vala')
-rw-r--r-- | plugins/omemo/src/contact_details_dialog.vala | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/plugins/omemo/src/contact_details_dialog.vala b/plugins/omemo/src/contact_details_dialog.vala index b14a108a..575437ff 100644 --- a/plugins/omemo/src/contact_details_dialog.vala +++ b/plugins/omemo/src/contact_details_dialog.vala @@ -3,6 +3,8 @@ using Xmpp; using Gee; using Qlite; using Dino.Entities; +using Qrencode; +using Gdk; namespace Dino.Plugins.Omemo { @@ -23,6 +25,9 @@ public class ContactDetailsDialog : Gtk.Dialog { [GtkChild] private ListBox keys; [GtkChild] private Switch auto_accept; [GtkChild] private Button copy; + [GtkChild] private Button show_qrcode; + [GtkChild] private Image qrcode; + [GtkChild] private Popover qrcode_popover; private void set_device_trust(Row device, bool trust) { Database.IdentityMetaTable.TrustLevel trust_level = trust ? Database.IdentityMetaTable.TrustLevel.TRUSTED : Database.IdentityMetaTable.TrustLevel.UNTRUSTED; @@ -87,7 +92,7 @@ public class ContactDetailsDialog : Gtk.Dialog { if(row == lbr) { Row updated_device = plugin.db.identity_meta.with_address(device[plugin.db.identity_meta.identity_id], device[plugin.db.identity_meta.address_name]).with(plugin.db.identity_meta.device_id, "=", device[plugin.db.identity_meta.device_id]).single().row().inner; ManageKeyDialog manage_dialog = new ManageKeyDialog(updated_device, plugin.db); - manage_dialog.set_transient_for((Window) get_toplevel()); + manage_dialog.set_transient_for((Gtk.Window) get_toplevel()); manage_dialog.present(); manage_dialog.response.connect((response) => { set_row(response, device[plugin.db.identity_meta.now_active], img, status_lbl, lbl, lbr); @@ -184,6 +189,12 @@ public class ContactDetailsDialog : Gtk.Dialog { own_fingerprint.set_markup(fingerprint_markup(fingerprint)); copy.clicked.connect(() => {Clipboard.get_default(get_display()).set_text(fingerprint, fingerprint.length);}); + + int sid = plugin.db.identity.row_with(plugin.db.identity.account_id, account.id)[plugin.db.identity.device_id]; + Pixbuf pixbuf = new QRcode(@"xmpp:$(account.bare_jid)?omemo-sid-$(sid)=$(fingerprint)", 2).to_pixbuf(); + pixbuf = pixbuf.scale_simple(150, 150, InterpType.NEAREST); + qrcode.set_from_pixbuf(pixbuf); + show_qrcode.clicked.connect(qrcode_popover.popup); } new_keys.set_header_func((row, before_row) => { |