Produits Support Open Source Company
 
 
 
Home > Wiki > jlib

Article - Talk jlib

Return the list of ejabberd core modules

Utilities (jlib)

Various helper functions. Modules should include the jlib.hrl file in order to use the records defined by this module.

API

JID handling

-record(jid, {user, server, resource, luser, lserver, lresource}).

Define a JID. The fields beginning with ‘l’ are the normalized lowercase versions of the three first ones.
make_jid(User, Server, Ressource) -> #jid
make_jid({User, Server, Ressource}) -> #jid
string_to_jid(JID) -> #jid
jid_to_string(#jid) -> JID
* JID = Username = Server = Resource = string()

Create a #jid from string and vice versa.

IQ handling

-record(iq, {id = "", type, xmlns = "", lang = "", sub_el}).
*
type = get | set
* sub_el = {xmlelement, Name, Attrs, SubEl}
* Attrs = [{Name, Value}]
* Name = Value = string()
*
SubEl = Packet

Define an IQ.
iq_query_info(Packet) -> #iq
iq_to_xml(#iq) -> Packet
* Packet = {xmlelement, Name, Attrs, SubEl}
* Attrs = [{Name, Value}]
* Name = Value = string()
*
SubEl = Packet

Create an IQ from a Packet and vice versa.

XMPP errors

make_error_reply(Packet, Error) -> ErrorPacket
* Packet = ErrorPacket = {xmlelement, Name, Attrs, SubEl}
* Error = ?STANZA_ERROR/3

Return a XMPP error packet. Packet is the XMPP packet initially received. Error is one of the ERR_\* macros defined in jlib.hrl

Miscanelleous

tolower(string()) -> string()

 
 
 
Valid HTML 4.01!   Valid CSS!