jid (jid v2.2.3)
View SourceSummary
Types
JID data structure.
literal binary containing a bare or full JID, not ensured to be string-prepped.
3-tuple containing the string-prepped binaries.
2-tuple containing string-prepped user and server parts.
3-tuple containing not-yet string-prepped binaries.
Functions
Returns true if are_equal(to_bare(A), to_bare(B))
Compares jid structures according to the RFC, i.e., only after normalisation
Equivalent to jid:to_bare(jid:from_binary(BinaryJid)).
Parses a binary and returns a jid record or an error
Parses a binary and returns a jid record or an error, but without normalisation of the parts
Returns true if the input is a valid user part
Extract the string-prepped resource part of the jid
Extract the string-prepped server part of the jid
Extract the string-prepped user part of the jid
Equivalent to make(User, Server, Resource).
Takes the user, server, and resource parts, and returns a jid record or an error.
Takes the user and server parts, and returns a jid record with an empty resource, or an error.
Equivalent to make_noprep(User, Server, Resource).
Creates a jid record without validating the input. Useful when input is already trusted.
Prepares the server part of a jid
Prepares the user part of a jid
Replaces the resource part of a jid with a new resource
Replaces the resource part of a jid with a new resource, but without normalisation
Prepares the resource part of a jid
Lowercases a string using the stringprep algorithm
Takes a jid and returns the same jid without its resourcepart
Takes a representation of a jid, and outputs such jid as a literal binary in bare form.
Takes a representation of a jid, and outputs such jid as a literal binary.
Returns a jid that contains only prepared strings
Takes a jid and returns a prepared bare jid
Types
-type jid() :: #jid{luser :: jid:luser(), lserver :: jid:lserver(), lresource :: jid:lresource()}.
JID data structure.
-type literal_jid() :: binary().
literal binary containing a bare or full JID, not ensured to be string-prepped.
3-tuple containing the string-prepped binaries.
-type lresource() :: binary().
-type lserver() :: binary().
-type luser() :: binary().
-type resource() :: binary().
-type server() :: binary().
2-tuple containing string-prepped user and server parts.
3-tuple containing not-yet string-prepped binaries.
-type user() :: binary().
Functions
Returns true if are_equal(to_bare(A), to_bare(B))
Compares jid structures according to the RFC, i.e., only after normalisation
Equivalent to jid:to_bare(jid:from_binary(BinaryJid)).
Parses a binary and returns a jid record or an error
Parses a binary and returns a jid record or an error, but without normalisation of the parts
Returns true if the input is a valid user part
-spec lresource(jid() | ljid() | simple_bare_jid()) -> lresource().
Extract the string-prepped resource part of the jid
-spec lserver(jid() | ljid() | simple_bare_jid()) -> lserver().
Extract the string-prepped server part of the jid
-spec luser(jid() | ljid() | simple_bare_jid()) -> luser().
Extract the string-prepped user part of the jid
-spec make(simple_jid()) -> jid() | error.
Equivalent to make(User, Server, Resource).
Takes the user, server, and resource parts, and returns a jid record or an error.
Takes the user and server parts, and returns a jid record with an empty resource, or an error.
-spec make_noprep(simple_jid()) -> jid().
Equivalent to make_noprep(User, Server, Resource).
Creates a jid record without validating the input. Useful when input is already trusted.
Prepares the server part of a jid
Prepares the user part of a jid
Replaces the resource part of a jid with a new resource
Replaces the resource part of a jid with a new resource, but without normalisation
Prepares the resource part of a jid
Lowercases a string using the stringprep algorithm
-spec to_bare(jid()) -> jid(); (ljid()) -> ljid(); (simple_bare_jid()) -> simple_bare_jid(); (error) -> error.
Takes a jid and returns the same jid without its resourcepart
-spec to_bare_binary(ljid() | simple_bare_jid() | jid() | literal_jid()) -> binary() | error.
Takes a representation of a jid, and outputs such jid as a literal binary in bare form.
-spec to_binary(simple_jid() | simple_bare_jid() | jid() | literal_jid()) -> binary().
Takes a representation of a jid, and outputs such jid as a literal binary.
-spec to_lower(simple_jid() | jid()) -> error | ljid().
Returns a jid that contains only prepared strings
-spec to_lus(jid() | ljid() | simple_bare_jid()) -> simple_bare_jid(); (error) -> error.
Takes a jid and returns a prepared bare jid