Next: , Previous: Extending service discovery, Up: Extending service discovery


16.6.1 Providing info

Your new IQ request 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 connection object and the entire IQ stanza and returning a list; in either case this list contains 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 connection object and a JID as arguments, 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, or one of the user's configured accounts.