|
|
This class holds a Jabber stream event. Stream events are raised by streams and sent by the engine to the proper service
| enum Type { Terminated, Destroy, Start, Auth, Bind, Running, Message, Presence, Iq, DbResult, DbVerify, RegisterOk, RegisterFailed, Unknown } | Type |
Event type enumeration
| inline JBEvent (Type type, JBStream* stream, XmlElement* element,
const JabberID& from, const JabberID& to, XmlElement* child = 0)
| JBEvent |
Constructor. Constructs an event from a stream
Parameters:
| 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 |
| inline JBEvent (Type type, JBStream* stream, XmlElement* element,
XmlElement* child = 0)
| JBEvent |
Constructor. Constructs an event from a stream
Parameters:
| 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 |
| ~JBEvent ()
| ~JBEvent |
[virtual]
Destructor. Delete the XML element if valid
| inline int type ()
| type |
[const]
Get the event type
Returns: The type of this event as enumeration
| inline const char* name ()
| name |
[const]
Get the event name
Returns: The name of this event
| inline const String& stanzaType ()
| stanzaType |
[const]
Get the element's 'type' attribute if any
Returns: The element's 'type' attribute
| inline const JabberID& from ()
| from |
[const]
Get the 'from' attribute of a received stanza
Returns: The 'from' attribute
| inline const JabberID& to ()
| to |
[const]
Get the 'to' attribute of a received stanza
Returns: The 'to' attribute
| inline const String& id ()
| id |
[const]
Get the sender's id for Write... events or the 'id' attribute if the event carries a received stanza
Returns: The event id
| inline const String& text ()
| text |
[const]
The stanza's text or termination reason for Terminated/Destroy events
Returns: The event's text
| inline JBStream* stream ()
| stream |
[const]
Get the stream that generated this event
Returns: The stream that generated this event
| JBClientStream* clientStream ()
| clientStream |
Get a client-to-server stream from the event's stream
Returns: JBClientStream pointer or 0
| JBServerStream* serverStream ()
| serverStream |
Get a server-to-server stream from the event's stream
Returns: JBServerStream pointer or 0
| JBClusterStream* clusterStream ()
| clusterStream |
Get a cluster stream from event's stream
Returns: JBClusterStream pointer or 0
| inline XmlElement* element ()
| element |
[const]
Get the underlying XmlElement
Returns: XmlElement pointer or 0
| inline XmlElement* child ()
| child |
[const]
Get the first child of the underlying element if any
Returns: XmlElement pointer or 0
| XmlElement* releaseXml (bool del = false)
| releaseXml |
Delete the underlying XmlElement(s). Release the ownership. The caller will own the returned pointer
Parameters:
| del | True to delete all xml elements owned by this event |
Returns: XmlElement pointer if not deleted or 0
| XmlElement* buildIqResult (bool addTags, XmlElement* child = 0)
| buildIqResult |
Build an 'iq' result stanza from event data
Parameters:
| addTags | True to add the 'from' and 'to' attributes |
| child | Optional 'iq' child (will be consumed) |
Returns: True on success
| bool sendIqResult (XmlElement* child = 0)
| sendIqResult |
Build and send a stanza 'result' from enclosed 'iq' element Release the element on success
Parameters:
| child | Optional 'iq' child (will be consumed) |
Returns: True on success
| XmlElement* buildIqError (bool addTags, XMPPError::Type error, const char* reason = 0,
XMPPError::ErrorType type = XMPPError::TypeModify)
| buildIqError |
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
Parameters:
| 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 |
Returns: True on success
| bool sendStanzaError (XMPPError::Type error, const char* reason = 0,
XMPPError::ErrorType type = XMPPError::TypeModify)
| sendStanzaError |
Build and send a stanza error from enclosed element Release the element on success
Parameters:
| error | Error to be returned to the event's XML sender |
| reason | Optional text to be attached to the error |
| type | Error type |
Returns: True on success
| void releaseStream (bool release = false)
| releaseStream |
Release the link with the stream to let the stream continue with events
Parameters:
| release | True to release the reference to the stream |
| inline const char* lookup (int type)
| lookup |
[static]
Get the name of an event type
Returns: The name an event type
| Generated by: paulc on bussard on Thu Jul 24 18:41:02 2014, using kdoc 2.0a54. |