Previous: Providing info, Up: Extending service discovery


16.6.2 Requesting info

jabber.el has a facility for requesting disco items and info. All positive responses are cached.

To request disco items or info from an entity, user one of these functions:

— Function: jabber-disco-get-info jc jid node callback closure-data &optional force

Get disco information for jid and node. A request is sent asynchronously on the connection jc. When the response arrives, callback is called with three arguments: jc, closure-data, and the result. The result may be retrieved from the cache, unless force is non-nil.

If the request was successful, or retrieved from cache, it looks like (identities features), where identities and features are lists. Each identity is ["name" "category" "type"], and each feature is a string denoting the namespace of the feature.

If the request failed, the result is an <error/> node.

— Function: jabber-disco-get-items jc jid node callback closure-data &optional force

Get disco information for jid and node. A request is sent asynchronously on the connection jc. When the response arrives, callback is called with three arguments: jc, closure-data, and the result. The result may be retrieved from the cache, unless force is non-nil.

If the request was successful, or retrieved from cache, the result is a list of items, where each item is ["name" "jid" "node"]. The values are either strings or nil.

If the request failed, the result is an <error/> node.

If you only want to see what is in the cache, use one of the following functions. They don't use a callback, but return the result directly.

— Function: jabber-disco-get-info-immediately jid node

Return cached disco information for jid and node, or nil if the cache doesn't contain this information. The result is the same as for jabber-disco-get-info.

— Function: jabber-disco-get-items-immediately jid node

Return cached disco items for jid and node, or nil if the cache doesn't contain this information. The result is the same as for jabber-disco-get-items.

In the future, this facility will be expanded to provide information acquired through XEP-0115, Entity capabilities, which is a protocol for sending disco information in <presence/> stanzas.