|
|
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:
| engine | The Jabber engine |
| params | Service's parameters |
| prio | The 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:
| params | Service'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:
| time | Current time |
| void processDisco (JBEvent* event)
| processDisco |
[virtual]
Process disco info elements
Parameters:
| event | The event with the element |
| void processError (JBEvent* event)
| processError |
[virtual]
Process a presence error element
Parameters:
| event | The event with the element |
| void processProbe (JBEvent* event)
| processProbe |
[virtual]
Process a presence probe element
Parameters:
| event | The event with the element |
| void processSubscribe (JBEvent* event, Presence presence)
| processSubscribe |
[virtual]
Process a presence subscribe element
Parameters:
| event | The event with the element |
| presence | Presence type: Subscribe,Subscribed,Unsubscribe,Unsubscribed |
| void processUnavailable (JBEvent* event)
| processUnavailable |
[virtual]
Process a presence unavailable element
Parameters:
| event | The event with the element |
| void processPresence (JBEvent* event)
| processPresence |
[virtual]
Process a presence element
Parameters:
| event | The event with the element |
| bool notifyProbe (JBEvent* event)
| notifyProbe |
[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
| bool notifySubscribe (JBEvent* event, Presence presence)
| notifySubscribe |
[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
| void notifySubscribe (XMPPUser* user, Presence presence)
| notifySubscribe |
[virtual]
Notify on subscribe event
Parameters:
| user | The user that received the event |
| presence | Presence 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:
| event | The event with the element |
| available | The 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:
| user | The user that received the event |
| resource | The 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:
| user | The 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:
| 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
| 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:
| 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
| void removeRemoteUser (const JabberID& local, const JabberID& remote)
| removeRemoteUser |
Remove a remote peer of a local one This method is thread safe
Parameters:
| local | The local peer |
| remote | The remote peer |
| bool validDomain (const String& domain)
| validDomain |
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
| 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:
| element | Element to send |
| stream | The 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:
| from | The 'from' attribute |
| to | The 'to' attribute |
| type | Presence 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:
| 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
| inline Presence presenceType (const char* text)
| presenceType |
[static]
Get the type of a 'presence' stanza as enumeration
Parameters:
| text | The text to check |
Returns: Presence type as enumeration
| inline const char* presenceText (Presence presence)
| presenceText |
[static]
Get the text from a presence type
Parameters:
| presence | The 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:
| 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.
| 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. |