# HG changeset patch # User Goffi # Date 1440169783 -7200 # Node ID 0f0889028eea46a051c1891c12c103f0b9148554 # Parent 80cd55dd5b0484934b9927365415f9584d623971 plugin XEP-0060: implemented getFeatures, data has a "service" key if service is found for this profile diff -r 80cd55dd5b04 -r 0f0889028eea src/plugins/plugin_xep_0060.py --- a/src/plugins/plugin_xep_0060.py Fri Aug 21 17:08:26 2015 +0200 +++ b/src/plugins/plugin_xep_0060.py Fri Aug 21 17:09:43 2015 +0200 @@ -21,6 +21,7 @@ from sat.core.constants import Const as C from sat.core.log import getLogger log = getLogger(__name__) +from sat.core import exceptions from sat.tools import sat_defer @@ -102,6 +103,20 @@ else: client.pubsub_service = None + def getFeatures(self, profile): + try: + client = self.host.getClient(profile) + except exceptions.ProfileNotSetError: + return {} + try: + return {'service': client.pubsub_service.full() if client.pubsub_service is not None else ''} + except AttributeError: + if self.host.isConnected(profile): + log.debug("Profile is not connected, service is not checked yet") + else: + log.error("Service should be available !") + return {} + def parseExtra(self, extra): """Parse extra dictionnary