JBPresence Class Reference
A Jabber presence service.
More...
#include <yatejabber.h>
List of all members.
Public Types |
enum | Presence {
Error = 0,
Probe = 1,
Subscribe = 2,
Subscribed = 3,
Unavailable = 4,
Unsubscribe = 5,
Unsubscribed = 6,
None = 7
} |
Public Member Functions |
| JBPresence (JBEngine *engine, const NamedList *params, int prio=0) |
virtual | ~JBPresence () |
XMPPDirVal | autoSubscribe () const |
bool | delUnavailable () const |
XMPPDirVal | addOnSubscribe () const |
XMPPDirVal | addOnProbe () const |
XMPPDirVal | addOnPresence () const |
bool | autoRoster () const |
bool | ignoreNonRoster () const |
u_int32_t | probeInterval () |
u_int32_t | expireInterval () |
virtual void | initialize (const NamedList ¶ms) |
virtual bool | process () |
virtual void | checkTimeout (u_int64_t time) |
virtual void | processDisco (JBEvent *event) |
virtual void | processError (JBEvent *event) |
virtual void | processProbe (JBEvent *event) |
virtual void | processSubscribe (JBEvent *event, Presence presence) |
virtual void | processUnavailable (JBEvent *event) |
virtual void | processPresence (JBEvent *event) |
virtual bool | notifyProbe (JBEvent *event) |
virtual bool | notifySubscribe (JBEvent *event, Presence presence) |
virtual void | notifySubscribe (XMPPUser *user, Presence presence) |
virtual bool | notifyPresence (JBEvent *event, bool available) |
virtual void | notifyPresence (XMPPUser *user, JIDResource *resource) |
virtual void | notifyNewUser (XMPPUser *user) |
XMPPUserRoster * | getRoster (const JabberID &jid, bool add, bool *added) |
XMPPUser * | getRemoteUser (const JabberID &local, const JabberID &remote, bool addLocal, bool *addedLocal, bool addRemote, bool *addedRemote) |
void | removeRemoteUser (const JabberID &local, const JabberID &remote) |
bool | validDomain (const String &domain) |
bool | sendStanza (XMLElement *element, JBStream *stream) |
void | cleanup () |
Static Public Member Functions |
static XMLElement * | createPresence (const char *from, const char *to, Presence type=None) |
static bool | decodeError (const XMLElement *element, String &code, String &type, String &error) |
static Presence | presenceType (const char *text) |
static const char * | presenceText (Presence presence) |
Protected Member Functions |
virtual bool | accept (JBEvent *event, bool &processed, bool &insert) |
Protected Attributes |
XMPPDirVal | m_autoSubscribe |
bool | m_delUnavailable |
bool | m_autoRoster |
bool | m_ignoreNonRoster |
XMPPDirVal | m_addOnSubscribe |
XMPPDirVal | m_addOnProbe |
XMPPDirVal | m_addOnPresence |
bool | m_autoProbe |
u_int32_t | m_probeInterval |
u_int32_t | m_expireInterval |
ObjList | m_rosters |
JIDIdentity * | m_defIdentity |
JIDFeatureList | m_defFeatures |
Static Protected Attributes |
static TokenDict | s_presence [] |
Friends |
class | XMPPUserRoster |
Detailed Description
A Jabber presence service.
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
Member Enumeration Documentation
Presence type enumeration
Constructor & Destructor Documentation
Constructor. Constructs a Jabber Component presence service
- Parameters:
-
| engine | The Jabber engine |
| params | Service's parameters |
| prio | The priority of this service |
Member Function Documentation
virtual bool accept |
( |
JBEvent * |
event, |
|
|
bool & |
processed, |
|
|
bool & |
insert | |
|
) |
| | [protected, virtual] |
Accept an event from the engine
- Parameters:
-
| event | The event to accept |
| processed | Set to true on exit to signal that the event was already processed |
| insert | Set 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.
Get the 'add on presence' flags
- Returns:
- The 'add on presence' flags
Get the 'add on probe' flags
- Returns:
- The 'add on probe' flags
Get the 'add on subscribe' flags
- Returns:
- The 'add on subscribe' flags
bool autoRoster |
( |
|
) |
const [inline] |
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
Get the auto subscribe parameter
- Returns:
- The auto subscribe parameter
virtual void checkTimeout |
( |
u_int64_t |
time |
) |
[virtual] |
Check presence timeout This method is thread safe
- Parameters:
-
static XMLElement* createPresence |
( |
const char * |
from, |
|
|
const char * |
to, |
|
|
Presence |
type = None | |
|
) |
| | [static] |
Create an 'presence' element
- Parameters:
-
| from | The 'from' attribute |
| to | The 'to' attribute |
| type | Presence type as enumeration |
- Returns:
- A valid XMLElement pointer
Decode an error element
- Parameters:
-
| element | The XML element |
| code | The 'code' attribute |
| type | The 'type' attribute |
| error | The name of the 'error' child |
- Returns:
- False if 'element' is 0 or is not a presence one
bool delUnavailable |
( |
|
) |
const [inline] |
Check if the unavailable resources must be deleted
- Returns:
- The delete unavailable parameter
u_int32_t expireInterval |
( |
|
) |
[inline] |
Get the expire after probe interval
- Returns:
- The expire after probe interval
XMPPUser* getRemoteUser |
( |
const JabberID & |
local, |
|
|
const JabberID & |
remote, |
|
|
bool |
addLocal, |
|
|
bool * |
addedLocal, |
|
|
bool |
addRemote, |
|
|
bool * |
addedRemote | |
|
) |
| | |
Get a remote peer of a local one. Add a new one if requested. This method is thread safe
- Parameters:
-
| local | The local peer |
| remote | The remote peer |
| addLocal | True to add the local user if doesn't exists |
| addedLocal | Optional parameter to be set if a new local user was added |
| addRemote | True to add the remote user if doesn't exists |
| addedRemote | Optional parameter to be set if a new remote user was added |
- Returns:
- Referenced pointer or 0 if none
Get a roster. Add a new one if requested. This method is thread safe
- Parameters:
-
| jid | The user's jid |
| add | True to add the user if doesn't exists |
| added | Optional parameter to be set if a new user was added |
- Returns:
- Referenced pointer or 0 if none
bool ignoreNonRoster |
( |
|
) |
const [inline] |
Check if this service should ignore destination users not in roster
- Returns:
- True if non existent destinations should be ignored
virtual void initialize |
( |
const NamedList & |
params |
) |
[virtual] |
Initialize the presence service
- Parameters:
-
| params | Service's parameters |
Reimplemented from JBService.
virtual void notifyNewUser |
( |
XMPPUser * |
user |
) |
[virtual] |
Notify when a new user is added Used basically to add a local resource
- Parameters:
-
Notify on state/capabilities change
- Parameters:
-
| user | The user that received the event |
| resource | The resource that changet its state or capabilities |
virtual bool notifyPresence |
( |
JBEvent * |
event, |
|
|
bool |
available | |
|
) |
| | [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:
-
| event | The event with the element |
| available | The availability of the remote user |
- Returns:
- False to send item-not-found error
virtual bool notifyProbe |
( |
JBEvent * |
event |
) |
[virtual] |
Notify on probe request with users we don't know about
- Parameters:
-
| event | The event with the element |
- Returns:
- False to send item-not-found error
Notify on subscribe event
- Parameters:
-
| user | The user that received the event |
| presence | Presence type: Subscribe,Subscribed,Unsubscribe,Unsubscribed |
virtual bool notifySubscribe |
( |
JBEvent * |
event, |
|
|
Presence |
presence | |
|
) |
| | [virtual] |
Notify on subscribe event with users we don't know about
- Parameters:
-
| event | The event with the element |
| presence | Presence type: Subscribe,Subscribed,Unsubscribe,Unsubscribed |
- Returns:
- False to send item-not-found error
static const char* presenceText |
( |
Presence |
presence |
) |
[inline, static] |
Get the text from a presence type
- Parameters:
-
| presence | The presence type |
- Returns:
- The associated text or 0
References TelEngine::lookup().
static Presence presenceType |
( |
const char * |
text |
) |
[inline, static] |
Get the type of a 'presence' stanza as enumeration
- Parameters:
-
- Returns:
- Presence type as enumeration
References TelEngine::lookup().
u_int32_t probeInterval |
( |
|
) |
[inline] |
Get the probe interval. Time to send a probe if nothing was received from that user
- Returns:
- The probe interval
virtual bool process |
( |
|
) |
[virtual] |
Process an event from the receiving list This method is thread safe
- Returns:
- False if the list is empty
virtual void processDisco |
( |
JBEvent * |
event |
) |
[virtual] |
Process disco info elements
- Parameters:
-
| event | The event with the element |
virtual void processError |
( |
JBEvent * |
event |
) |
[virtual] |
Process a presence error element
- Parameters:
-
| event | The event with the element |
virtual void processPresence |
( |
JBEvent * |
event |
) |
[virtual] |
Process a presence element
- Parameters:
-
| event | The event with the element |
virtual void processProbe |
( |
JBEvent * |
event |
) |
[virtual] |
Process a presence probe element
- Parameters:
-
| event | The event with the element |
virtual void processSubscribe |
( |
JBEvent * |
event, |
|
|
Presence |
presence | |
|
) |
| | [virtual] |
Process a presence subscribe element
- Parameters:
-
| event | The event with the element |
| presence | Presence type: Subscribe,Subscribed,Unsubscribe,Unsubscribed |
virtual void processUnavailable |
( |
JBEvent * |
event |
) |
[virtual] |
Process a presence unavailable element
- Parameters:
-
| event | The event with the element |
Remove a remote peer of a local one This method is thread safe
- Parameters:
-
| local | The local peer |
| remote | The remote peer |
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:
-
| element | Element to send |
| stream | The stream to send through |
- Returns:
- The result of send operation. False if element is 0
bool validDomain |
( |
const String & |
domain |
) |
|
Check if the given domain is a valid (known) one
- Parameters:
-
| domain | The domain name to check |
- Returns:
- True if the given domain is a valid one
The documentation for this class was generated from the following file: