JBEvent Class Reference

A Jabber stream event. More...

#include <yatejabber.h>

Inheritance diagram for JBEvent:

RefObject GenObject

List of all members.

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 StringstanzaType () const
const JabberIDfrom () const
const JabberIDto () const
const Stringid () const
const Stringtext () const
JBStreamstream () const
XMLElementelement () const
XMLElementchild () const
XMLElementreleaseXML (bool del=false)
void releaseStream ()
XMLElementcreateError (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


Detailed Description

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


Member Enumeration Documentation

enum Type

Event type enumeration


Constructor & Destructor Documentation

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

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 ( Type  type,
JBStream stream,
XMLElement element,
const String senderID 
)

Constructor. Constructs a WriteSuccess/WriteFail event from a stream

Parameters:
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


Member Function Documentation

XMLElement* child (  )  const [inline]

Get the first child of the underlying element if any

Returns:
XMLElement pointer or 0

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

Parameters:
type Error type
error The error condition
text Optional text to add to the error element
Returns:
A valid XMLElement pointer

XMLElement* element (  )  const [inline]

Get the underlying XMLElement

Returns:
XMLElement pointer or 0

const JabberID& from (  )  const [inline]

Get the 'from' attribute of a received stanza

Returns:
The 'from' attribute

const String& id (  )  const [inline]

Get the sender's id for Write... events or the 'id' attribute if the event carries a received stanza

Returns:
The event id

static const char* lookup ( int  type  )  [inline, static]

Get the name of an event type

Returns:
The name an event type

References TelEngine::lookup().

const char* name (  )  const [inline]

Get the event name

Returns:
The name of this event

References TelEngine::lookup().

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

Parameters:
del True to delete all xml elements owned by this event
Returns:
XMLElement pointer if not deleted or 0

References TelEngine::destruct().

const String& stanzaType (  )  const [inline]

Get the element's 'type' attribute if any

Returns:
The element's 'type' attribute

JBStream* stream (  )  const [inline]

Get the stream that generated this event

Returns:
The stream that generated this event

const String& text (  )  const [inline]

The stanza's text or termination reason for Terminated/Destroy events

Returns:
The event's text

const JabberID& to (  )  const [inline]

Get the 'to' attribute of a received stanza

Returns:
The 'to' attribute

int type (  )  const [inline]

Get the event type

Returns:
The type of this event as enumeration


The documentation for this class was generated from the following file:

Generated on Sun Dec 7 21:36:13 2008 for Yate by  doxygen 1.5.7.1