plugin XEP-0060: implemented getFeatures, data has a "service" key if service is found for this profile
This commit is contained in:
parent
0bf9461416
commit
3080368825
1 changed files with 15 additions and 0 deletions
|
|
@ -21,6 +21,7 @@ from sat.core.i18n import _
|
|||
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 @@ class XEP_0060(object):
|
|||
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
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue