Module exmpp_iq

The module exmpp_iq provides helpers to do IQ common operations.

Authors: Jean-Sébastien Pédron (js.pedron@meetic-corp.com).

Description

The module exmpp_iq provides helpers to do IQ common operations.

Data Types

iq()

iq() = {iq, Kind, Type, ID, NS, Payload, Error, Lang, IQ_NS}

Record representing an IQ stanza.

It's created from an #xmlel using xmlel_to_iq/1. This record eases matching in function clauses. It may be passed to functions in exmpp_stanza and exmpp_iq. For other operations, it must be converted back to #xmlel using iq_to_xmlel/1.

Function Index

error/2Prepare an <iq/> to notify an error.
error_without_original/2Prepare an <iq/> to notify an error.
get/2Prepare an <iq/> to transport the given get request.
get/3Prepare an <iq/> to transport the given get request.
get_kind/1Tell if an IQ is a request or a response.
get_payload/1Extract the request, the result or the error from IQ.
get_payload_ns_as_atom/1Returns the query namespace.
get_request/1Return the request contained in a get or set IQ, or returned by an error IQ (if present).
get_result/1Return the result contained in a result IQ.
get_type/1Return the type of the given <iq/>.
iq_to_xmlel/1Convert an IQ stanza from its #iq form to its #xmlel form.
iq_to_xmlel/3Convert an IQ stanza from its #iq form to its #xmlel form and set the sender and recipient at the same time.
is_error/1Tell if the IQ is an error (response of type error).
is_iq/1Tell if El is an IQ.
is_iq_record/1Tell if El is an IQ record.
is_request/1Tell if the IQ is a request.
is_response/1Tell if the IQ is a response.
is_result/1Tell if the IQ is a result (response of type result).
result/1Prepare an <iq/> to answer to the given request.
result/2Prepare an <iq/> to answer to the given request with Result.
set/2Prepare an <iq/> to transport the given set request.
set/3Prepare an <iq/> to transport the given set request.
xmlel_to_iq/1Convert an IQ stanza from its #xmlel form to its #iq form.

Function Details

error/2

error(IQ::Request_IQ, Condition::Error) -> Response_IQ

Prepare an <iq/> to notify an error.

If Error is an atom, it must be a standard condition defined by XMPP Core.

error_without_original/2

error_without_original(IQ::Request_IQ, Condition::Error) -> Response_IQ

Prepare an <iq/> to notify an error.

Child elements from Request_IQ are not kept.

If Error is an atom, it must be a standard condition defined by XMPP Core.

get/2

get(NS, Request) -> IQ

Prepare an <iq/> to transport the given get request.

get/3

get(NS, Request, ID) -> Request_IQ

Prepare an <iq/> to transport the given get request.

get_kind/1

get_kind(IQ) -> Kind

Tell if an IQ is a request or a response.

get_payload/1

get_payload(IQ) -> Payload

throws {iq, get_payload, unexpected_iq, IQ}

Extract the request, the result or the error from IQ.

get_payload_ns_as_atom/1

get_payload_ns_as_atom(IQ) -> NS | undefined

Returns the query namespace. returns 'undefined' is there is no query element.

get_request/1

get_request(IQ) -> Request | undefined

throws {iq, get_request, unexpected_iq, IQ} | {iq, get_request, invalid_iq, IQ}

Return the request contained in a get or set IQ, or returned by an error IQ (if present).

get_result/1

get_result(IQ) -> Result | undefined

throws {iq, get_request, unexpected_iq, IQ} | {iq, get_result, invalid_iq, IQ}

Return the result contained in a result IQ.

get_type/1

get_type(IQ) -> Type

Return the type of the given <iq/>.

iq_to_xmlel/1

iq_to_xmlel(IQ_Rec) -> IQ

Convert an IQ stanza from its #iq form to its #xmlel form.

iq_to_xmlel/3

iq_to_xmlel(IQ_Rec, Sender, Recipient) -> IQ

Convert an IQ stanza from its #iq form to its #xmlel form and set the sender and recipient at the same time.

is_error/1

is_error(IQ) -> bool()

Tell if the IQ is an error (response of type error).

is_iq/1

is_iq(IQ::El) -> bool()

Tell if El is an IQ.

You should probably use the IS_IQ(El) guard expression.

is_iq_record/1

is_iq_record(IQ::El) -> bool()

Tell if El is an IQ record.

You should probably use the IS_IQ_RECORD(El) guard expression.

is_request/1

is_request(IQ) -> bool()

Tell if the IQ is a request.

is_response/1

is_response(IQ) -> bool()

Tell if the IQ is a response.

is_result/1

is_result(IQ) -> bool()

Tell if the IQ is a result (response of type result).

result/1

result(Request_IQ) -> Response_IQ

Prepare an <iq/> to answer to the given request.

result/2

result(Request_IQ, Result) -> Response_IQ

Prepare an <iq/> to answer to the given request with Result.

set/2

set(NS, Request) -> Request_IQ

Prepare an <iq/> to transport the given set request.

set/3

set(NS, Request, ID) -> Request_IQ

Prepare an <iq/> to transport the given set request.

xmlel_to_iq/1

xmlel_to_iq(Xmlel::IQ) -> IQ_Rec

Convert an IQ stanza from its #xmlel form to its #iq form.


Generated by EDoc, Jan 21 2011, 01:43:52.