Prosody provides an API for manipulating JIDs in various ways.
local jid = require "util.jid";
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).
Same as jid.split(id), but runs stringprep over the JID before splitting.
Returns the passed JID, after applying the stringprep rules.
Returns the bare JID, that is the JID without any resource (if it had one).