Philipp Hörist pushed to branch master at gajim / gajim


Commits:
ec7827c6 by lovetox at 2022-02-05T12:58:29+01:00
Remove unused import

- - - - -
cd40d79f by lovetox at 2022-02-05T13:21:26+01:00
Contacts: Add is_jingle_available property

- - - - -


3 changed files:

- gajim/common/modules/contacts.py
- gajim/gtk/controls/chat.py
- gajim/gtk/controls/groupchat.py


Changes:

=====================================
gajim/common/modules/contacts.py
=====================================
@@ -26,6 +26,7 @@
 import cairo
 from nbxmpp.const import Affiliation
 from nbxmpp.const import Role
+from nbxmpp.namespaces import Namespace
 from nbxmpp.protocol import JID
 from nbxmpp.structs import DiscoInfo
 from nbxmpp.structs import LocationData
@@ -415,6 +416,12 @@ def set_blocked(self) -> None:
     def set_unblocked(self) -> None:
         self.notify('blocking-update')
 
+    @property
+    def is_jingle_available(self) -> bool:
+        if not self.supports(Namespace.JINGLE_FILE_TRANSFER_5):
+            return False
+        return self.is_available
+
 
 class ResourceContact(CommonContact):
     def __init__(self, logger: logging.Logger, jid: JID, account: str) -> None:


=====================================
gajim/gtk/controls/chat.py
=====================================
@@ -215,12 +215,8 @@ def update_actions(self) -> None:
                                self._client.get_module('HTTPUpload').available)
 
         # Send file (Jingle)
-        jingle_support = 
self.contact.supports(Namespace.JINGLE_FILE_TRANSFER_5)
-        jingle_conditions = bool(jingle_support and
-                                 self.contact.is_available and
-                                 not self.contact.is_pm_contact)
         jingle = self._get_action('send-file-jingle-')
-        jingle.set_enabled(online and jingle_conditions)
+        jingle.set_enabled(online and self.contact.is_jingle_available)
 
         # Send file
         self._get_action('send-file-').set_enabled(jingle.get_enabled() or


=====================================
gajim/gtk/controls/groupchat.py
=====================================
@@ -49,7 +49,6 @@
 from gajim.common import ged
 from gajim.common import helpers
 from gajim.common.client import Client
-from gajim.common.config import Option
 from gajim.common.const import AvatarSize
 from gajim.common.const import SimpleClientState
 from gajim.common.helpers import AdditionalDataDict



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/compare/c81f009d76dbea13abe17c26a4a4012b53c0863b...cd40d79f637166eab82aa5df133532a50f78564c

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


_______________________________________________
Commits mailing list
[email protected]
https://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to