class JBPresence

A Jabber presence service. More...

Full nameTelEngine::JBPresence
Definition#include <libs/yjingle/yatejabber.h>
InheritsTelEngine::JBService [public ], TelEngine::JBThreadList [public ]
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

Public Types

Public Methods

Public Static Methods

Protected Methods

Protected Members


Detailed Description

This class is a presence service for Jabber engine. Handle presence stanzas and iq query info or items with destination containing a node and a valid domain

enum Presence { Error = 0, Probe = 1, Subscribe = 2, Subscribed = 3, Unavailable = 4, Unsubscribe = 5, Unsubscribed = 6, None = 7, }

Presence

Presence type enumeration

 JBPresence (JBEngine* engine, const NamedList* params, int prio = 0)

JBPresence

Constructor. Constructs a Jabber Component presence service

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

 ~JBPresence ()

~JBPresence

[virtual]

Destructor

inline XMPPDirVal  autoSubscribe ()

autoSubscribe

[const]

Get the auto subscribe parameter

Returns: The auto subscribe parameter

inline bool  delUnavailable ()

delUnavailable

[const]

Check if the unavailable resources must be deleted

Returns: The delete unavailable parameter

inline XMPPDirVal  addOnSubscribe ()

addOnSubscribe

[const]

Get the 'add on subscribe' flags

Returns: The 'add on subscribe' flags

inline XMPPDirVal  addOnProbe ()

addOnProbe

[const]

Get the 'add on probe' flags

Returns: The 'add on probe' flags

inline XMPPDirVal  addOnPresence ()

addOnPresence

[const]

Get the 'add on presence' flags

Returns: The 'add on presence' flags

inline bool  autoRoster ()

autoRoster

[const]

Check if this service should add new users when receiving presence, probe or subscribe

Returns: True if should add a new user when receiving presence, probe or subscribe

inline bool  ignoreNonRoster ()

ignoreNonRoster

[const]

Check if this service should ignore destination users not in roster

Returns: True if non existent destinations should be ignored

inline u_int32_t  probeInterval ()

probeInterval

Get the probe interval. Time to send a probe if nothing was received from that user

Returns: The probe interval

inline u_int32_t  expireInterval ()

expireInterval

Get the expire after probe interval

Returns: The expire after probe interval

void  initialize (const NamedList& params)

initialize

[virtual]

Initialize the presence service

Parameters:
paramsService's parameters

Reimplemented from JBService.

bool  process ()

process

[virtual]

Process an event from the receiving list This method is thread safe

Returns: False if the list is empty

void  checkTimeout (u_int64_t time)

checkTimeout

[virtual]

Check presence timeout This method is thread safe

Parameters:
timeCurrent time

void  processDisco (JBEvent* event)

processDisco

[virtual]

Process disco info elements

Parameters:
eventThe event with the element

void  processError (JBEvent* event)

processError

[virtual]

Process a presence error element

Parameters:
eventThe event with the element

void  processProbe (JBEvent* event)

processProbe

[virtual]

Process a presence probe element

Parameters:
eventThe event with the element

void  processSubscribe (JBEvent* event, Presence presence)

processSubscribe

[virtual]

Process a presence subscribe element

Parameters:
eventThe event with the element
presencePresence type: Subscribe,Subscribed,Unsubscribe,Unsubscribed

void  processUnavailable (JBEvent* event)

processUnavailable

[virtual]

Process a presence unavailable element

Parameters:
eventThe event with the element

void  processPresence (JBEvent* event)

processPresence

[virtual]

Process a presence element

Parameters:
eventThe event with the element

bool  notifyProbe (JBEvent* event)

notifyProbe

[virtual]

Notify on probe request with users we don't know about

Parameters:
eventThe event with the element

Returns: False to send item-not-found error

bool  notifySubscribe (JBEvent* event, Presence presence)

notifySubscribe

[virtual]

Notify on subscribe event with users we don't know about

Parameters:
eventThe event with the element
presencePresence type: Subscribe,Subscribed,Unsubscribe,Unsubscribed

Returns: False to send item-not-found error

void  notifySubscribe (XMPPUser* user, Presence presence)

notifySubscribe

[virtual]

Notify on subscribe event

Parameters:
userThe user that received the event
presencePresence type: Subscribe,Subscribed,Unsubscribe,Unsubscribed

bool  notifyPresence (JBEvent* event, bool available)

notifyPresence

[virtual]

Notify on presence event with users we don't know about or presence unavailable received without resource (the remote user is entirely unavailable)

Parameters:
eventThe event with the element
availableThe availability of the remote user

Returns: False to send item-not-found error

void  notifyPresence (XMPPUser* user, JIDResource* resource)

notifyPresence

[virtual]

Notify on state/capabilities change

Parameters:
userThe user that received the event
resourceThe resource that changet its state or capabilities

void  notifyNewUser (XMPPUser* user)

notifyNewUser

[virtual]

Notify when a new user is added Used basically to add a local resource

Parameters:
userThe new user

XMPPUserRoster*  getRoster (const JabberID& jid, bool add, bool* added)

getRoster

Get a roster. Add a new one if requested. This method is thread safe

Parameters:
jidThe user's jid
addTrue to add the user if doesn't exists
addedOptional parameter to be set if a new user was added

Returns: Referenced pointer or 0 if none

XMPPUser*  getRemoteUser (const JabberID& local, const JabberID& remote, bool addLocal, bool* addedLocal, bool addRemote, bool* addedRemote)

getRemoteUser

Get a remote peer of a local one. Add a new one if requested. This method is thread safe

Parameters:
localThe local peer
remoteThe remote peer
addLocalTrue to add the local user if doesn't exists
addedLocalOptional parameter to be set if a new local user was added
addRemoteTrue to add the remote user if doesn't exists
addedRemoteOptional parameter to be set if a new remote user was added

Returns: Referenced pointer or 0 if none

void  removeRemoteUser (const JabberID& local, const JabberID& remote)

removeRemoteUser

Remove a remote peer of a local one This method is thread safe

Parameters:
localThe local peer
remoteThe remote peer

bool  validDomain (const String& domain)

validDomain

Check if the given domain is a valid (known) one

Parameters:
domainThe domain name to check

Returns: True if the given domain is a valid one

bool  sendStanza (XMLElement* element, JBStream* stream)

sendStanza

Send an element through the given stream. If the stream is 0 try to get one from the engine. In any case the element is consumed (deleted)

Parameters:
elementElement to send
streamThe stream to send through

Returns: The result of send operation. False if element is 0

XMLElement*  createPresence (const char* from, const char* to, Presence type = None)

createPresence

[static]

Create an 'presence' element

Parameters:
fromThe 'from' attribute
toThe 'to' attribute
typePresence type as enumeration

Returns: A valid XMLElement pointer

bool  decodeError (const XMLElement* element, String& code, String& type, String& error)

decodeError

[static]

Decode an error element

Parameters:
elementThe XML element
codeThe 'code' attribute
typeThe 'type' attribute
errorThe name of the 'error' child

Returns: False if 'element' is 0 or is not a presence one

inline Presence  presenceType (const char* text)

presenceType

[static]

Get the type of a 'presence' stanza as enumeration

Parameters:
textThe text to check

Returns: Presence type as enumeration

inline const char*  presenceText (Presence presence)

presenceText

[static]

Get the text from a presence type

Parameters:
presenceThe presence type

Returns: The associated text or 0

void  cleanup ()

cleanup

Cleanup rosters

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

accept

[protected virtual]

Accept an event from the engine

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 TokenDict s_presence[]

s_presence[]

[protected]

XMPPDirVal m_autoSubscribe

m_autoSubscribe

[protected]

bool m_delUnavailable

m_delUnavailable

[protected]

bool m_autoRoster

m_autoRoster

[protected]

bool m_ignoreNonRoster

m_ignoreNonRoster

[protected]

XMPPDirVal m_addOnSubscribe

m_addOnSubscribe

[protected]

XMPPDirVal m_addOnProbe

m_addOnProbe

[protected]

XMPPDirVal m_addOnPresence

m_addOnPresence

[protected]

bool m_autoProbe

m_autoProbe

[protected]

u_int32_t m_probeInterval

m_probeInterval

[protected]

u_int32_t m_expireInterval

m_expireInterval

[protected]

ObjList m_rosters

m_rosters

[protected]

JIDIdentity* m_defIdentity

m_defIdentity

[protected]

JIDFeatureList m_defFeatures

m_defFeatures

[protected]


Generated by: paulc on bussard on Mon Mar 8 12:18:15 2010, using kdoc 2.0a54.