Commit 299351c1 authored by Philipp Hörist's avatar Philipp Hörist

Add /disco command

parent 1fa2c4b5
Pipeline #6780 passed with stages
in 4 minutes and 47 seconds
......@@ -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):
"""
......
......@@ -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'
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment