Yate
Public Types | Public Member Functions | Static Public Member Functions | Static Public Attributes | Protected Member Functions

JBMessage Class Reference

A Jabber message service. More...

#include <yatejabber.h>

Inheritance diagram for JBMessage:
JBService JBThreadList DebugEnabler Mutex GenObject Lockable

List of all members.

Public Types

enum  MsgType {
  Chat, GroupChat, HeadLine, Normal,
  Error, None
}

Public Member Functions

 JBMessage (JBEngine *engine, const NamedList *params, int prio=0)
virtual ~JBMessage ()
virtual void initialize (const NamedList &params)
JBEventgetMessage ()
virtual void processMessage (JBEvent *event)

Static Public Member Functions

static XMLElementcreateMessage (const char *type, const char *from, const char *to, const char *id, const char *message)
static XMLElementcreateMessage (MsgType type, const char *from, const char *to, const char *id, const char *message)
static MsgType msgType (const char *text)
static const char * msgText (MsgType msg)

Static Public Attributes

static TokenDict s_msg []

Protected Member Functions

virtual bool accept (JBEvent *event, bool &processed, bool &insert)

Detailed Description

A Jabber message service.

This class is a message receiver service for the Jabber engine


Member Enumeration Documentation

enum MsgType

Message type enumeration


Constructor & Destructor Documentation

JBMessage ( JBEngine engine,
const NamedList params,
int  prio = 0 
) [inline]

Constructor. Constructs a Jabber message service

Parameters:
engineThe Jabber engine
paramsService's parameters
prioThe priority of this service

References JBThreadList::setOwner().

virtual ~JBMessage ( ) [inline, virtual]

Destructor. Cancel private thread(s)


Member Function Documentation

virtual bool accept ( JBEvent event,
bool &  processed,
bool &  insert 
) [protected, virtual]

Accept an event from the engine and process it if configured to do that

Parameters:
eventThe event to accept
processedSet to true on exit to signal that the event was already processed
insertSet to true if accepted to insert on top of the event queue
Returns:
False if not accepted, let the engine try another service

Reimplemented from JBService.

static XMLElement* createMessage ( const char *  type,
const char *  from,
const char *  to,
const char *  id,
const char *  message 
) [static]

Create a 'message' element

Parameters:
typeMessage type string
fromThe 'from' attribute
toThe 'to' attribute
idThe 'id' attribute
messageThe message body
Returns:
A valid XMLElement pointer

Referenced by JGSession::sendMessage().

static XMLElement* createMessage ( MsgType  type,
const char *  from,
const char *  to,
const char *  id,
const char *  message 
) [inline, static]

Create a 'message' element

Parameters:
typeMessage type as enumeration
fromThe 'from' attribute
toThe 'to' attribute
idThe 'id' attribute
messageThe message body
Returns:
A valid XMLElement pointer

References JBMessage::createMessage(), and TelEngine::lookup().

Referenced by JBMessage::createMessage().

JBEvent* getMessage ( ) [inline]

Get a message from queue

Returns:
JBEvent pointer or 0 if no messages
virtual void initialize ( const NamedList params) [virtual]

Initialize the service

Parameters:
paramsService's parameters

Reimplemented from JBService.

static const char* msgText ( MsgType  msg) [inline, static]

Get the text from a message type

Parameters:
msgThe message type
Returns:
The associated text or 0

References TelEngine::lookup().

static MsgType msgType ( const char *  text) [inline, static]

Get the type of a 'message' stanza

Parameters:
textThe text to check
Returns:
Message type as enumeration

References TelEngine::lookup().

virtual void processMessage ( JBEvent event) [virtual]

Message processor. The derived classes must override this method to process received messages

Parameters:
eventThe event to process

Member Data Documentation

TokenDict s_msg[] [static]

Keep the types of 'message' stanzas


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