glooxd  0.3-svn
Public Member Functions | List of all members
SM Class Reference

#include <sm.h>

Inheritance diagram for SM:
Inheritance graph
[legend]

Public Member Functions

 SM (Router &router, ConfigManager &cm, const gloox::LogSink &logInstance, RosterProvider *rp, bool threading=false, const gloox::JID &name=gloox::JID("sm."+GLOOXD_DOMAIN))
virtual ~SM ()
void run ()
bool createSession (gloox::JID &jid, const std::string &id)
bool removeSession (const std::string &id)
void addPlugin (Plugin *p)
void dispatchPresence (const gloox::Tag *pres)
bool dispatchMessage (const gloox::Tag *msg)
virtual void handleDomainAdded (const std::string &domain)
virtual void handleDomainRemoved (const std::string &domain)
virtual void handleShutdown ()
- Public Member Functions inherited from ComponentBase
 ComponentBase (Router &_router, ConfigManager &cm, const gloox::JID &_name, const gloox::LogSink &_logInstance)
virtual ~ComponentBase ()
const gloox::JID & name () const
- Public Member Functions inherited from TagHandler
virtual ~TagHandler ()
- Public Member Functions inherited from ConfigHandler
virtual ~ConfigHandler ()
virtual bool handleC2SInterfaceAdded (const std::string &interface, int port)
virtual bool handleC2SInterfaceRemoved (const std::string &interface, int port)

Additional Inherited Members

- Protected Attributes inherited from ComponentBase
gloox::JID m_name
Routerm_router
ConfigManagerm_cm
const gloox::LogSink & m_logInstance

Detailed Description

Implements a client session manager.

Author
Jakob Schroeter js@ca.nosp@m.maya.nosp@m..net

Definition at line 45 of file sm.h.

Constructor & Destructor Documentation

SM ( Router router,
ConfigManager cm,
const gloox::LogSink &  logInstance,
RosterProvider rp,
bool  threading = false,
const gloox::JID &  name = gloox::JID( "sm." + GLOOXD_DOMAIN ) 
)

Creates a new SessionManager.

Parameters
routerThe local Router.
cmThe local ConfigManager.
logInstanceThe LogSink to use for logging.
rpA RosterProvider derived object that will provide the roster.
threadingWhether this instance runs in its own thread.
nameAn internal name by which this SM is known. Default: sm.

Definition at line 36 of file sm.cpp.

~SM ( )
virtual

Virtual destructor.

Definition at line 44 of file sm.cpp.

Member Function Documentation

void addPlugin ( Plugin p)
inline

Adds a protocol handling plugin to this SM instance.

Parameters
pThe Plugin to add.

Definition at line 99 of file sm.h.

bool createSession ( gloox::JID &  jid,
const std::string &  id 
)

Checks whether a new session for the given JID can be created, and creates it if possible. A unique resource identifier will be assigned if none is given.

Parameters
jidThe JID to create a session for. It may be modified (ie. the resource may be updated).
idThe client's connection's ID.
Returns
True if the session could be created successfully, false otherwise.

Definition at line 72 of file sm.cpp.

bool dispatchMessage ( const gloox::Tag *  msg)

Sends message packets to their destinations.

Parameters
msgThe message Tag to send.
Returns
True if the message could be sent (i.e. if there's an open session for the recipient, false otherwise.

Definition at line 228 of file sm.cpp.

void dispatchPresence ( const gloox::Tag *  pres)

Sends broadcast and unicast presence packets to their destinations.

Parameters
presThe presence Tag to send.

Definition at line 157 of file sm.cpp.

void handleDomainAdded ( const std::string &  domain)
virtual

This function is called if a new domain has been added that the server supports.

Parameters
domainThe new domain.

Implements ConfigHandler.

Definition at line 293 of file sm.cpp.

void handleDomainRemoved ( const std::string &  domain)
virtual

This function is called if a domain has been removed.

Parameters
domainThe removed domain.

Implements ConfigHandler.

Definition at line 301 of file sm.cpp.

void handleShutdown ( )
virtual

This function is called to prepare a server shutdown.

Implements ConfigHandler.

Definition at line 309 of file sm.cpp.

bool removeSession ( const std::string &  id)

Removes the session (identified by its ID).

Parameters
idThe ID of the session to be removed.
Returns
True if a session was found and removed, false otherwise.

Definition at line 140 of file sm.cpp.

void run ( )

Starts processing incoming events. Blocks if the threading parameter to the constructor is true.

Definition at line 56 of file sm.cpp.


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