Yate
|
A Jabber stream event. More...
#include <yatejabber.h>
Public Types | |
enum | Type { Terminated, Destroy, Start, Auth, Bind, Running, Message, Presence, Iq, DbResult, DbVerify, RegisterOk, RegisterFailed, Unknown } |
Public Member Functions | |
JBEvent (Type type, JBStream *stream, XmlElement *element, const JabberID &from, const JabberID &to, XmlElement *child=0) | |
JBEvent (Type type, JBStream *stream, XmlElement *element, XmlElement *child=0) | |
virtual | ~JBEvent () |
int | type () const |
const char * | name () const |
const String & | stanzaType () const |
const JabberID & | from () const |
const JabberID & | to () const |
const String & | id () const |
const String & | text () const |
JBStream * | stream () const |
JBClientStream * | clientStream () |
JBServerStream * | serverStream () |
JBClusterStream * | clusterStream () |
XmlElement * | element () const |
XmlElement * | child () const |
XmlElement * | releaseXml (bool del=false) |
XmlElement * | buildIqResult (bool addTags, XmlElement *child=0) |
bool | sendIqResult (XmlElement *child=0) |
XmlElement * | buildIqError (bool addTags, XMPPError::Type error, const char *reason=0, XMPPError::ErrorType type=XMPPError::TypeModify) |
bool | sendStanzaError (XMPPError::Type error, const char *reason=0, XMPPError::ErrorType type=XMPPError::TypeModify) |
void | releaseStream (bool release=false) |
Static Public Member Functions | |
static const char * | lookup (int type) |
Friends | |
class | JBStream |
class | JBClientStream |
class | JBServerStream |
A Jabber stream event.
This class holds a Jabber stream event. Stream events are raised by streams and sent by the engine to the proper service
enum Type |
Event type enumeration
JBEvent | ( | Type | type, |
JBStream * | stream, | ||
XmlElement * | element, | ||
const JabberID & | from, | ||
const JabberID & | to, | ||
XmlElement * | child = 0 |
||
) | [inline] |
Constructor. Constructs an event from a stream
type | Type of this event |
stream | The stream that generated the event |
element | Element that generated the event |
from | Already parsed source JID |
to | Already parsed destination JID |
child | Optional type depending element's child |
JBEvent | ( | Type | type, |
JBStream * | stream, | ||
XmlElement * | element, | ||
XmlElement * | child = 0 |
||
) | [inline] |
Constructor. Constructs an event from a stream
type | Type of this event |
stream | The stream that generated the event |
element | Element that generated the event |
child | Optional type depending element's child |
virtual ~JBEvent | ( | ) | [virtual] |
Destructor. Delete the XML element if valid
XmlElement* buildIqError | ( | bool | addTags, |
XMPPError::Type | error, | ||
const char * | reason = 0 , |
||
XMPPError::ErrorType | type = XMPPError::TypeModify |
||
) |
Build an 'iq' error stanza from event data The event's element will be released and added to the error one if the id is empty
addTags | True to add the 'from' and 'to' attributes |
error | Error to be returned to the event's XML sender |
reason | Optional text to be attached to the error |
type | Error type |
XmlElement* buildIqResult | ( | bool | addTags, |
XmlElement * | child = 0 |
||
) |
Build an 'iq' result stanza from event data
addTags | True to add the 'from' and 'to' attributes |
child | Optional 'iq' child (will be consumed) |
XmlElement* child | ( | ) | const [inline] |
Get the first child of the underlying element if any
Get a client-to-server stream from the event's stream
Get a cluster stream from event's stream
XmlElement* element | ( | ) | const [inline] |
Get the underlying XmlElement
Get the 'from' attribute of a received stanza
Get the sender's id for Write... events or the 'id' attribute if the event carries a received stanza
static const char* lookup | ( | int | type | ) | [inline, static] |
const char* name | ( | ) | const [inline] |
void releaseStream | ( | bool | release = false | ) |
Release the link with the stream to let the stream continue with events
release | True to release the reference to the stream |
XmlElement* releaseXml | ( | bool | del = false | ) |
Delete the underlying XmlElement(s). Release the ownership. The caller will own the returned pointer
del | True to delete all xml elements owned by this event |
bool sendIqResult | ( | XmlElement * | child = 0 | ) |
Build and send a stanza 'result' from enclosed 'iq' element Release the element on success
child | Optional 'iq' child (will be consumed) |
bool sendStanzaError | ( | XMPPError::Type | error, |
const char * | reason = 0 , |
||
XMPPError::ErrorType | type = XMPPError::TypeModify |
||
) |
Build and send a stanza error from enclosed element Release the element on success
error | Error to be returned to the event's XML sender |
reason | Optional text to be attached to the error |
type | Error type |
Get a server-to-server stream from the event's stream
const String& stanzaType | ( | ) | const [inline] |
Get the element's 'type' attribute if any
Get the stream that generated this event
The stanza's text or termination reason for Terminated/Destroy events
Get the 'to' attribute of a received stanza
int type | ( | ) | const [inline] |
Get the event type