Yate
|
A Jabber stream event. More...
#include <yatejabber.h>
Public Types | |
enum | Type { Terminated = 1, Destroy = 2, Running = 3, WriteFail = 10, Presence = 20, Message = 30, Iq = 50, IqError = 51, IqResult = 52, IqDiscoInfoGet = 60, IqDiscoInfoSet = 61, IqDiscoInfoRes = 62, IqDiscoInfoErr = 63, IqDiscoItemsGet = 64, IqDiscoItemsSet = 65, IqDiscoItemsRes = 66, IqDiscoItemsErr = 67, IqCommandGet = 70, IqCommandSet = 71, IqCommandRes = 72, IqCommandErr = 73, IqJingleGet = 80, IqJingleSet = 81, IqJingleRes = 82, IqJingleErr = 83, IqRosterSet = 91, IqRosterRes = 92, IqRosterErr = 93, IqClientRosterUpdate = 150, Unhandled = 200, Invalid = 500 } |
Public Member Functions | |
JBEvent (Type type, JBStream *stream, XMLElement *element, XMLElement *child=0) | |
JBEvent (Type type, JBStream *stream, XMLElement *element, const String &senderID) | |
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 |
XMLElement * | element () const |
XMLElement * | child () const |
XMLElement * | releaseXML (bool del=false) |
void | releaseStream () |
XMLElement * | createError (XMPPError::ErrorType type, XMPPError::Type error, const char *text=0) |
Static Public Member Functions | |
static const char * | lookup (int type) |
Friends | |
class | JBStream |
class | JBClientStream |
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, | ||
XMLElement * | child = 0 |
||
) |
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 |
JBEvent | ( | Type | type, |
JBStream * | stream, | ||
XMLElement * | element, | ||
const String & | senderID | ||
) |
Constructor. Constructs a WriteSuccess/WriteFail event from a stream
type | Type of this event |
stream | The stream that generated the event |
element | Element that generated the event |
senderID | Sender's id |
virtual ~JBEvent | ( | ) | [virtual] |
Destructor. Delete the XML element if valid
XMLElement* child | ( | ) | const [inline] |
Get the first child of the underlying element if any
XMLElement* createError | ( | XMPPError::ErrorType | type, |
XMPPError::Type | error, | ||
const char * | text = 0 |
||
) |
Create an error response from this event if it contains a known type. Don't create the error response if this event is carrying a response
type | Error type |
error | The error condition |
text | Optional text to add to the error element |
XMLElement* element | ( | ) | const [inline] |
Get the underlying XMLElement
const JabberID& from | ( | ) | const [inline] |
Get the 'from' attribute of a received stanza
const String& id | ( | ) | const [inline] |
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 | ( | ) |
Release the link with the stream to let the stream continue with events
XMLElement* releaseXML | ( | bool | del = false | ) | [inline] |
Delete the underlying XMLElement(s). Release the ownership. The caller is responsable of the returned pointer
del | True to delete all xml elements owned by this event |
References TelEngine::destruct().
const String& stanzaType | ( | ) | const [inline] |
Get the element's 'type' attribute if any
JBStream* stream | ( | ) | const [inline] |
Get the stream that generated this event
const String& text | ( | ) | const [inline] |
The stanza's text or termination reason for Terminated/Destroy events
const JabberID& to | ( | ) | const [inline] |
Get the 'to' attribute of a received stanza
int type | ( | ) | const [inline] |
Get the event type