Here are the examples of the python api xmpp.protocol.NS_DISCO_INFO taken from open source projects. By voting up you can indicate which examples are most useful and appropriate.
1 Examples
0
Example 1
Project: buddycloud-server-python Source File: channel_server.py
def xmpp_base_disco(self, conn, event, disco_type):
"""Callback to handle XMPP Disco requests."""
self.logger.debug('Disco event: %s', event)
fromjid = event.getFrom().getStripped().__str__()
to = event.getTo()
node = event.getQuerynode()
if to == self.jid:
if node is None:
if disco_type == 'info':
features = [xmpp.protocol.NS_DISCO_INFO,
xmpp.protocol.NS_DISCO_ITEMS,
xmpp.protocol.NS_PUBSUB,
NS_PUBSUB_OWNER]
if self.allow_register:
features.append(xmpp.protocol.NS_REGISTER)
return {
'ids': [{'category': 'pubsub', 'type': 'service',
'name': 'XEP-0060 service'},
{'category': 'pubsub', 'type': 'channels',
'name': 'Channels service'},
{'category': 'pubsub', 'type': 'inbox',
'name': 'Channels inbox service'}],
'features': features}
elif disco_type == 'items':
return [
dict(node=x.node, jid=self.jid) for x in
self.storage.get_nodes()]
else:
channel = self.storage.get_node(node)
if channel and disco_type == 'info':
features = [xmpp.protocol.NS_DISCO_INFO,
xmpp.protocol.NS_DISCO_ITEMS,
xmpp.protocol.NS_PUBSUB,
NS_PUBSUB_OWNER]
if self.allow_register:
features.append(xmpp.protocol.NS_REGISTER)
fields = [
xmpp.protocol.DataField(name='FORM_TYPE', typ='hidden',
value=FORM_TYPE_PUBSUB_METADATA)]
for c in channel.config:
if c.key in BUDDYCLOUD_FIELDS:
fields.append(xmpp.protocol.DataField(
**dict(BUDDYCLOUD_FIELDS[c.key].items() +
[('value', c.value)])))
elif c.key in PUBSUB_FIELDS:
fields.append(xmpp.protocol.DataField(
**dict(PUBSUB_FIELDS[c.key].items() +
[('value', c.value)])))
return {
'ids': [{'category': 'pubsub', 'type': 'leaf',
'name': 'XEP-0060 service'},
{'category': 'pubsub', 'type': 'channel',
'name': 'buddycloud channel'}],
'features': features,
# TODO Populate this from the node configuration
'xdata': xmpp.protocol.DataForm(
typ='result', data=fields)}