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


Commits:
299351c1 by lovetox at 2020-11-24T22:29:28+01:00
Add /disco command

- - - - -


2 changed files:

- gajim/command_system/implementation/standard.py
- gajim/common/modules/discovery.py


Changes:

=====================================
gajim/command_system/implementation/standard.py
=====================================
@@ -169,6 +169,15 @@ def online(self, message):
                 continue
             connection.change_status('online', message)
 
+    @command
+    @doc(_("Send a disco info request"))
+    def disco(self):
+        client = app.get_client(self.account)
+        if not client.state.is_available:
+            return
+
+        client.get_module('Discovery').disco_contact(self.contact)
+
 
 class StandardCommonChatCommands(CommandContainer):
     """


=====================================
gajim/common/modules/discovery.py
=====================================
@@ -238,6 +238,28 @@ def disco_muc(self,
 
         yield result
 
+    @as_task
+    def disco_contact(self, contact):
+        _task = yield
+
+        fjid = contact.get_full_jid()
+
+        result = yield self.disco_info(fjid)
+        if is_error(result):
+            raise result
+
+        self._log.info('Disco Info received: %s', fjid)
+
+        app.storage.cache.set_last_disco_info(result.jid,
+                                              result,
+                                              cache_only=True)
+
+        app.nec.push_incoming_event(
+            NetworkEvent('caps-update',
+                         account=self._account,
+                         fjid=fjid,
+                         jid=contact.jid))
+
 
 def get_instance(*args, **kwargs):
     return Discovery(*args, **kwargs), 'Discovery'



View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/299351c186f1cf87c3a7be81d2ad846b12c6f8cf

-- 
View it on GitLab: 
https://dev.gajim.org/gajim/gajim/-/commit/299351c186f1cf87c3a7be81d2ad846b12c6f8cf
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