|
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) |
Public Member Functions inherited from RefObject | |
| RefObject () | |
| virtual | ~RefObject () |
| virtual void * | getObject (const String &name) const |
| virtual bool | alive () const |
| bool | ref () |
| bool | deref () |
| int | refcount () const |
| virtual void | destruct () |
Public Member Functions inherited from GenObject | |
| GenObject () | |
| virtual | ~GenObject () |
| virtual const String & | toString () const |
| virtual const String & | traceId () const |
| NamedCounter * | getObjCounter () const |
| NamedCounter * | setObjCounter (NamedCounter *counter) |
Static Public Member Functions | |
| static const char * | lookup (int type) |
Static Public Member Functions inherited from RefObject | |
| static bool | alive (const RefObject *obj) |
| static bool | efficientIncDec () |
Static Public Member Functions inherited from GenObject | |
| static void * | getObject (const String &name, const GenObject *obj) |
| static bool | getObjCounting () |
| static void | setObjCounting (bool enable) |
| static NamedCounter * | getObjCounter (const String &name, bool create=true) |
| static ObjList & | getObjCounters () |
Friends | |
| class | JBStream |
| class | JBClientStream |
| class | JBServerStream |
Additional Inherited Members | |
Protected Member Functions inherited from RefObject | |
| virtual void | zeroRefs () |
| bool | resurrect () |
| virtual void | destroyed () |
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
|
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 |
References child(), element(), from(), stream(), to(), and type().
|
inline |
|
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 |
References 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) |
References child().
|
inline |
Get the first child of the underlying element if any
Referenced by buildIqResult(), JBEvent(), JBEvent(), and sendIqResult().
| JBClientStream * clientStream | ( | ) |
Get a client-to-server stream from the event's stream
| JBClusterStream * clusterStream | ( | ) |
Get a cluster stream from event's stream
|
inline |
Get the underlying XmlElement
|
inline |
|
inline |
Get the sender's id for Write... events or the 'id' attribute if the event carries a received stanza
|
inlinestatic |
|
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) |
References child().
| 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 |
References type().
| JBServerStream * serverStream | ( | ) |
Get a server-to-server stream from the event's stream
|
inline |
Get the element's 'type' attribute if any
|
inline |
|
inline |
The stanza's text or termination reason for Terminated/Destroy events
|
inline |
|
inline |
Get the event type
Referenced by buildIqError(), JBEvent(), JBEvent(), lookup(), name(), and sendStanzaError().