util.jid API

Prosody provides an API for manipulating JIDs in various ways.

Using

   local jid = require "util.jid";

Reference

jid.split(id)

Returns 3 strings, the node, host and resource. The node and/or resource may be nil (in the case of a bare or domain JID). The host will be nil only for invalid JIDs (in which case all returns will also be nil).

jid.prepped_split(id)

Same as jid.split(id), but runs stringprep over the JID before splitting.

jid.prep(id)

Returns the passed JID, after applying the stringprep rules.

jid.bare(id)

Returns the bare JID, that is the JID without any resource (if it had one).

 
doc/developers/util/jid.txt · Last modified: 2009/12/20 17:43 (external edit)