class JBEvent

A Jabber stream event. More...

Full nameTelEngine::JBEvent
Definition#include <libs/yjingle/yatejabber.h>
InheritsTelEngine::RefObject [public ]
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Types

Public Methods

Public Static Methods


Detailed Description

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 = 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, }

Type

Event type enumeration

 JBEvent (Type type, JBStream* stream, XMLElement* element, XMLElement* child = 0)

JBEvent

Constructor. Constructs an event from a stream

Parameters:
typeType of this event
streamThe stream that generated the event
elementElement that generated the event
childOptional type depending element's child

 JBEvent (Type type, JBStream* stream, XMLElement* element, const String& senderID)

JBEvent

Constructor. Constructs a WriteSuccess/WriteFail event from a stream

Parameters:
typeType of this event
streamThe stream that generated the event
elementElement that generated the event
senderIDSender's id

 ~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

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

inline XMLElement*  releaseXML (bool del = false)

releaseXML

Delete the underlying XMLElement(s). Release the ownership. The caller is responsable of the returned pointer

Parameters:
delTrue to delete all xml elements owned by this event

Returns: XMLElement pointer if not deleted or 0

void  releaseStream ()

releaseStream

Release the link with the stream to let the stream continue with events

XMLElement*  createError (XMPPError::ErrorType type, XMPPError::Type error, const char* text = 0)

createError

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

Parameters:
typeError type
errorThe error condition
textOptional text to add to the error element

Returns: A valid XMLElement pointer

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 Wed Oct 21 01:57:30 2009, using kdoc 2.0a54.