Daniel Brötzmann pushed to branch mainwindow at gajim / gajim


Commits:
64b4f0c1 by wurstsalat at 2021-09-12T17:34:45+02:00
Helpers: Fix ignore_contact

- - - - -
48d26cfd by wurstsalat at 2021-09-12T17:35:28+02:00
ServiceDiscoveryWindow: Fix detecting gateway

- - - - -
2e58361c by wurstsalat at 2021-09-12T17:38:56+02:00
ZeroconfVcardWindow: Move to gtk folder

- - - - -
e7df467a by wurstsalat at 2021-09-12T17:47:30+02:00
Remove Zeroconf context menu

All options this menu offers would fit on an account page

- - - - -


4 changed files:

- gajim/common/helpers.py
- − gajim/data/gui/zeroconf_context_menu.ui
- gajim/gtk/discovery.py
- gajim/vcard.py → gajim/gtk/zeroconf_vcard.py


Changes:

=====================================
gajim/common/helpers.py
=====================================
@@ -802,16 +802,19 @@ def load_json(path, key=None, default=None):
         return json_dict
     return json_dict.get(key, default)
 
+
 def ignore_contact(account, jid):
-    jid = str(jid)
-    known_contact = app.contacts.get_contacts(account, jid)
-    ignore = app.settings.get_account_setting(account,
-                                              'ignore_unknown_contacts')
-    if ignore and not known_contact:
-        log.info('Ignore unknown contact %s', jid)
+    client = app.get_client(account)
+    contact = client.get_module('Contact').get_contact(jid)
+
+    ignore_unknown = app.settings.get_account_setting(
+        account, 'ignore_unknown_contacts')
+    if ignore_unknown and not contact.is_in_roster:
+        log.info('Ignore unknown contact %s', str(jid))
         return True
     return False
 
+
 class AdditionalDataDict(collections.UserDict):
     def __init__(self, initialdata=None):
         collections.UserDict.__init__(self, initialdata)


=====================================
gajim/data/gui/zeroconf_context_menu.ui deleted
=====================================
@@ -1,31 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
-<interface>
-  <requires lib="gtk+" version="3.12"/>
-  <object class="GtkMenu" id="zeroconf_context_menu">
-    <property name="can_focus">False</property>
-    <child>
-      <object class="GtkMenuItem" id="status_menuitem">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="label" translatable="yes">_Status</property>
-        <property name="use_underline">True</property>
-      </object>
-    </child>
-    <child>
-      <object class="GtkSeparatorMenuItem" id="separatormenuitem1">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="events">GDK_POINTER_MOTION_MASK | 
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | 
GDK_BUTTON_RELEASE_MASK</property>
-      </object>
-    </child>
-    <child>
-      <object class="GtkMenuItem" id="zeroconf_properties_menuitem">
-        <property name="visible">True</property>
-        <property name="can_focus">False</property>
-        <property name="label" translatable="yes">_Modify Account…</property>
-        <property name="use_underline">True</property>
-      </object>
-    </child>
-  </object>
-</interface>


=====================================
gajim/gtk/discovery.py
=====================================
@@ -1413,12 +1413,10 @@ def _update_actions(self, jid, node, identities, 
features, data):
                 jid != self.jid):
             # We can register this agent
             registered_transports = []
-            jid_list = app.contacts.get_jid_list(self.account)
-            for jid_ in jid_list:
-                contact = app.contacts.get_first_contact_from_jid(
-                    self.account, jid_)
-                if _('Transports') in contact.groups:
-                    registered_transports.append(jid_)
+            client = app.get_client(self.account)
+            for contact in client.get_module('Roster').iter_contacts():
+                if contact.is_gateway:
+                    registered_transports.append(contact.jid)
             registered_transports.append(self.jid)
             if jid in registered_transports:
                 self.register_button.set_label(_('_Edit'))


=====================================
gajim/vcard.py → gajim/gtk/zeroconf_vcard.py
=====================================
@@ -1,16 +1,3 @@
-# Copyright (C) 2003-2014 Yann Leboulanger <asterix AT lagaule.org>
-# Copyright (C) 2005 Vincent Hanquez <tab AT snarc.org>
-# Copyright (C) 2005-2006 Nikos Kouremenos <kourem AT gmail.com>
-# Copyright (C) 2006 Junglecow J <junglecow AT gmail.com>
-#                    Dimitur Kirov <dkirov AT gmail.com>
-#                    Travis Shirk <travis AT pobox.com>
-#                    Stefan Bethge <stefan AT lanpartei.de>
-# Copyright (C) 2006-2008 Jean-Marie Traissard <jim AT lapin.org>
-# Copyright (C) 2007 Lukas Petrovicky <lukas AT petrovicky.net>
-# Copyright (C) 2008 Brendan Taylor <whateley AT gmail.com>
-#                    Jonathan Schleifer <js-gajim AT webkeks.org>
-#                    Stephan Erb <steve-e AT h3c.de>
-#
 # This file is part of Gajim.
 #
 # Gajim is free software; you can redistribute it and/or modify



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/compare/17950bf7e189744120b2bc1d8d78755f03182e96...e7df467a1174d465b595182f1392693e19751293

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/compare/17950bf7e189744120b2bc1d8d78755f03182e96...e7df467a1174d465b595182f1392693e19751293
You're receiving this email because of your account on dev.gajim.org.


_______________________________________________
Commits mailing list
Commits@gajim.org
https://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to