Next: , Previous: Sending new requests, Up: Hacking and extending



16.5 Service discovery

Your new handlers will likely want to advertise their existence through service discovery.

To have an additional feature reported in response to disco info requests, add a string to jabber-advertised-features.

By default, the service discovery functions reject all requests containing a node identifier with an “Item not found” error. To make them respond, add the appropriate entries to jabber-disco-items-nodes and jabber-disco-info-nodes. Both variables work in the same way. They are alists, where the keys are the node names, and the values are lists of two items.

The first item is the data to return — either a list or a function taking the entire IQ stanza and returning a list, this list containing the XML nodes to include in the <query/> node in the response.

The second item is the access control function. An access control function receives the JID as its only argument, and returns non-nil if access is to be granted. If nil is specified instead of a function, access is always granted. One such function is provided, jabber-my-jid-p, which grants access for JIDs where the username and server (not necessarily resource) are equal to those of the user.