changeset 49a335d2e7f7 in /home/hg/repos/gajim-plugins
author: lovetox forenjunkie@chello.at branches: details:gajim-plugins?cmd=changeset;node=49a335d2e7f7 description: Finterprint Dialog Button in ChatWindow added
diffstat:
omemo/fpr_dialog.ui | 230 ++++++++++++++++++++++++++++++++++++ omemo/omemo/liteidentitykeystore.py | 10 + omemo/ui.py | 178 ++++++++++++++++++++++++++- 3 files changed, 410 insertions(+), 8 deletions(-)
diffs (truncated from 482 to 300 lines):
diff -r e72d2b833933 -r 49a335d2e7f7 omemo/fpr_dialog.ui --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/omemo/fpr_dialog.ui Sat Jun 04 14:00:09 2016 +0200 @@ -0,0 +1,230 @@ +<?xml version="1.0" encoding="UTF-8"?> +<interface> + <requires lib="gtk+" version="2.16"/> + <!-- interface-naming-policy toplevel-contextual --> + <object class="GtkListStore" id="account_store"> + <columns> + <!-- column-name accountname --> + <column type="gchararray"/> + </columns> + </object> + <object class="GtkListStore" id="fingerprint_store"> + <columns> + <!-- column-name id --> + <column type="gint"/> + <!-- column-name screenname --> + <column type="gchararray"/> + <!-- column-name trust --> + <column type="gchararray"/> + <!-- column-name fingerprint --> + <column type="gchararray"/> + </columns> + </object> + <object class="GtkNotebook" id="notebook1"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <child> + <object class="GtkVBox" id="vbox4"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="border_width">12</property> + <child> + <object class="GtkFrame" id="frame2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="border_width">12</property> + <property name="label_xalign">0</property> + <property name="shadow_type">none</property> + <child> + <object class="GtkAlignment" id="alignment2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="top_padding">10</property> + <property name="left_padding">12</property> + <child> + <object class="GtkVBox" id="vbox3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="spacing">6</property> + <child> + <object class="GtkHBox" id="hbox2"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="spacing">5</property> + <child> + <object class="GtkLabel" id="fingerprint_label_desc"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes" comments="Descriptive label">Fingerprint:</property> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="fingerprint_label"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label"><tt>-------- -------- -------- -------- -------- </tt></property> + <property name="use_markup">True</property> + <property name="selectable">True</property> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + </object> + </child> + </object> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkScrolledWindow" id="scrolledwindow1"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="hscrollbar_policy">automatic</property> + <property name="vscrollbar_policy">automatic</property> + <child> + <object class="GtkTreeView" id="fingerprint_view"> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="model">fingerprint_store</property> + <property name="search_column">0</property> + <property name="tooltip_column">3</property> + <signal name="button-press-event" handler="fpr_button_pressed_cb" swapped="no"/> + <child> + <object class="GtkTreeViewColumn" id="name_column"> + <property name="resizable">True</property> + <property name="title">Name</property> + <child> + <object class="GtkCellRendererText" id="cellrenderertext2"/> + <attributes> + <attribute name="text">1</attribute> + </attributes> + </child> + </object> + </child> + <child> + <object class="GtkTreeViewColumn" id="trust_column"> + <property name="resizable">True</property> + <property name="title">Trust</property> + <child> + <object class="GtkCellRendererText" id="cellrenderertoggle1"/> + <attributes> + <attribute name="text">2</attribute> + </attributes> + </child> + </object> + </child> + <child> + <object class="GtkTreeViewColumn" id="fingerprint_column"> + <property name="resizable">True</property> + <property name="title">Fingerprint</property> + <child> + <object class="GtkCellRendererText" id="cellrenderertext4"/> + <attributes> + <attribute name="markup">3</attribute> + </attributes> + </child> + </object> + </child> + </object> + </child> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + <child> + <object class="GtkHBox" id="hbox3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="spacing">5</property> + <property name="homogeneous">True</property> + <child> + <object class="GtkButton" id="trust_button"> + <property name="label" translatable="yes" comments="button">Trust Fingerprint</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <signal name="clicked" handler="trust_button_clicked_cb" swapped="no"/> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">0</property> + </packing> + </child> + <child> + <object class="GtkButton" id="untrust_button"> + <property name="label" translatable="yes" comments="button">UnTrust Fingerprint</property> + <property name="visible">True</property> + <property name="can_focus">True</property> + <property name="receives_default">True</property> + <signal name="clicked" handler="untrust_button_clicked_cb" swapped="no"/> + </object> + <packing> + <property name="expand">True</property> + <property name="fill">True</property> + <property name="position">1</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">2</property> + </packing> + </child> + </object> + </child> + <child type="tab"> + <object class="GtkLabel" id="label3"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes" comments="tab label">Known Fingerprints</property> + </object> + <packing> + <property name="tab_fill">False</property> + </packing> + </child> + </object> + <object class="GtkMenu" id="fprclipboard_menu"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <object class="GtkMenuItem" id="copyfprclipboard_item"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes" comments="Context menu item">Copy to clipboard</property> + <property name="use_underline">True</property> + <signal name="activate" handler="clipboard_button_cb" swapped="no"/> + </object> + </child> + </object> +</interface> diff -r e72d2b833933 -r 49a335d2e7f7 omemo/omemo/liteidentitykeystore.py --- a/omemo/omemo/liteidentitykeystore.py Fri Jun 03 18:24:20 2016 +0200 +++ b/omemo/omemo/liteidentitykeystore.py Sat Jun 04 14:00:09 2016 +0200 @@ -100,6 +100,16 @@ result.append((row[0], row[1], row[2], row[3])) return result
+ def getFingerprints(self, jid): + q = "SELECT _id, recipient_id, public_key, trust FROM identities " + \ + "WHERE recipient_id = '" + jid + "' ORDER BY trust ASC" + c = self.dbConn.cursor() + + result = [] + for row in c.execute(q): + result.append((row[0], row[1], row[2], row[3])) + return result + def setTrust(self, _id, trust): q = "UPDATE identities SET trust = '" + str(trust) + "'" + \ "WHERE _id = '" + str(_id) + "'" diff -r e72d2b833933 -r 49a335d2e7f7 omemo/ui.py --- a/omemo/ui.py Fri Jun 03 18:24:20 2016 +0200 +++ b/omemo/ui.py Sat Jun 04 14:00:09 2016 +0200 @@ -28,18 +28,21 @@
log = logging.getLogger('gajim.plugin_system.omemo')
-# from plugins.helpers import log +TRUSTED = 1 +UNTRUSTED = 0
-class ClearDevicesButton(gtk.Button): +class FingerprintButton(gtk.Button): def __init__(self, plugin, contact): - super(ClearDevicesButton, self).__init__(label='Clear Devices') + super(FingerprintButton, self).__init__(label='Fingerprints') self.plugin = plugin self.contact = contact self.connect('clicked', self.on_click)
def on_click(self, widget): - self.plugin.clear_device_list(self.contact) + dlg = FingerprintWindow(self.plugin, self.contact) + dlg.run() + dlg.destroy()
class Checkbox(gtk.CheckButton): @@ -85,7 +88,7 @@ self.contact = chat_control.contact self.chat_control = chat_control self.checkbox = Checkbox(plugin, chat_control) - self.clear_button = ClearDevicesButton(plugin, self.contact) + self.finger_button = FingerprintButton(plugin, self.contact)
if enabled: self.checkbox.set_active(True) @@ -93,7 +96,7 @@ self.encryption_disable()
_add_widget(self.checkbox, self.chat_control) - _add_widget(self.clear_button, self.chat_control) + _add_widget(self.finger_button, self.chat_control)
def encryption_active(self):