XMPPUser Class Reference
An XMPP remote user.
More...
#include <yatejabber.h>
List of all members.
|
Public Member Functions |
| XMPPUser (XMPPUserRoster *local, const char *node, const char *domain, XMPPDirVal sub, bool subTo=true, bool sendProbe=true) |
virtual | ~XMPPUser () |
const JabberID & | jid () const |
XMPPUserRoster * | local () const |
XMPPDirVal & | subscription () |
JIDResourceList & | localRes () |
JIDResourceList & | remoteRes () |
bool | addLocalRes (JIDResource *resource, bool send=true) |
void | removeLocalRes (JIDResource *resource) |
void | clearLocalRes () |
bool | addRemoteRes (JIDResource *resource) |
void | removeRemoteRes (JIDResource *resource) |
JIDResource * | getAudio (bool local, bool availableOnly=true) |
void | processError (JBEvent *event) |
void | processProbe (JBEvent *event, const String *resName=0) |
bool | processPresence (JBEvent *event, bool available) |
void | processSubscribe (JBEvent *event, JBPresence::Presence type) |
bool | probe (JBStream *stream, u_int64_t time=Time::msecNow()) |
bool | sendSubscribe (JBPresence::Presence type, JBStream *stream) |
bool | sendUnavailable (JBStream *stream) |
bool | sendPresence (JIDResource *resource, JBStream *stream=0, bool force=false) |
bool | timeout (u_int64_t time) |
void | notifyResource (bool remote, const String &name, JBStream *stream=0, bool force=false) |
void | notifyResources (bool remote, JBStream *stream=0, bool force=false) |
Protected Member Functions |
void | updateSubscription (bool from, bool value, JBStream *stream) |
void | updateTimeout (bool from, u_int64_t time=Time::msecNow()) |
Friends |
class | XMPPUserRoster |
class | JBPresence |
Detailed Description
An XMPP remote user.
This class holds a remote XMPP user along with his resources and subscribe state.
Constructor & Destructor Documentation
Create a remote user.
- Parameters:
-
| local | The local (owner) user peer. |
| node | The node (username) of the remote peer. |
| domain | The domain of the remote peer. |
| sub | The subscription state. |
| subTo | True to force a subscribe request to remote peer if not subscribed. |
| sendProbe | True to probe the new user. |
Destructor. Send unavailable if not already done.
Member Function Documentation
bool addLocalRes |
( |
JIDResource * |
resource, |
|
|
bool |
send = true | |
|
) |
| | |
Add a local resource to the list. Send presence if the remote peer is subscribed to the local one. This method is thread safe.
- Parameters:
-
| resource | The resource to add. |
| send | True to send presence from the resource if it is a new one |
- Returns:
- False if the the resource already exists in the list.
Add a remote resource to the list. This method is thread safe.
- Parameters:
-
| resource | The resource to add |
- Returns:
- False if the the resource already exists in the list
Remove all local resources. Send unavailable if the remote peer is subscribed to the local one. This method is thread safe.
JIDResource* getAudio |
( |
bool |
local, |
|
|
bool |
availableOnly = true | |
|
) |
| | [inline] |
Get the first remote resource with audio capability.
- Parameters:
-
| local | True to request a local resource, false for a remote one. |
| availableOnly | True to get only if available. |
- Returns:
- A pointer to the resource or 0.
Get the jid of this user.
- Returns:
- The jid of this user.
Get the roster this user belongs to.
- Returns:
- Pointer to the roster this user belongs to.
Get the local resource list
- Returns:
- The local resource list
void notifyResource |
( |
bool |
remote, |
|
|
const String & |
name, |
|
|
JBStream * |
stream = 0 , |
|
|
bool |
force = false | |
|
) |
| | |
Notify the state of a resource. This method is thread safe.
- Parameters:
-
| remote | True for a remote resource: notify the presence engine. False for a local resource: send presence to remote user. |
| name | Resource name. |
| stream | Optional stream to use to send the data if remote is false. |
| force | True to send even if we've already sent presence from this resource. |
void notifyResources |
( |
bool |
remote, |
|
|
JBStream * |
stream = 0 , |
|
|
bool |
force = false | |
|
) |
| | |
Notify the state of all resources. This method is thread safe.
- Parameters:
-
| remote | True for remote resources: notify the presence engine. False for local resources: send presence to remote user. |
| stream | Optional stream to use to send the data if remote is false. |
| force | True to send even if we've already sent presence from a resource. |
bool probe |
( |
JBStream * |
stream, |
|
|
u_int64_t |
time = Time::msecNow() | |
|
) |
| | |
Probe the remote user. This method is thread safe.
- Parameters:
-
| stream | Optional stream to use to send the request. |
| time | Probe time. |
- Returns:
- True if send succeedded.
void processError |
( |
JBEvent * |
event |
) |
|
Process received error elements. This method is thread safe.
- Parameters:
-
| event | The event with the element. |
bool processPresence |
( |
JBEvent * |
event, |
|
|
bool |
available | |
|
) |
| | |
Process received presence from remote peer. This method is thread safe.
- Parameters:
-
| event | The event with the element. |
| available | The availability of the user. |
- Returns:
- False if remote user has no more resources available.
void processProbe |
( |
JBEvent * |
event, |
|
|
const String * |
resName = 0 | |
|
) |
| | |
Process received probe from remote peer. This method is thread safe.
- Parameters:
-
| event | The event with the element. |
| resName | The probed resource if any. |
Process received subscription from remote peer. This method is thread safe.
- Parameters:
-
| event | The event with the element. |
| type | The subscription type: subscribe/unsubscribe/subscribed/unsubscribed. |
Get the remote resource list
- Returns:
- The remote resource list
Remove a local resource from the list. Send unavailable if the remote peer is subscribed to the local one. This method is thread safe.
- Parameters:
-
| resource | The resource to remove. |
Remove a remote resource from the list. This method is thread safe.
- Parameters:
-
| resource | The resource to remove |
Send presence to remote peer. This method is thread safe.
- Parameters:
-
| resource | The resource to send from. |
| stream | Optional stream to use to send the data. |
| force | True to send even if we've already sent presence from this resource. |
- Returns:
- True if send succeedded.
Send subscription to remote peer. This method is thread safe.
- Parameters:
-
| type | The subscription type: subscribe/unsubscribe/subscribed/unsubscribed. |
| stream | Optional stream to use to send the data. |
- Returns:
- True if send succeedded.
bool sendUnavailable |
( |
JBStream * |
stream |
) |
|
Send unavailable to remote peer. This method is thread safe.
- Parameters:
-
| stream | Optional stream to use to send the data. |
- Returns:
- True if send succeedded.
Get the subscription state of this user
- Returns:
- The subscription state of this user
bool timeout |
( |
u_int64_t |
time |
) |
|
Check if this user sent us any presence data for a given interval. This method is thread safe.
- Parameters:
-
- Returns:
- True if the user timed out.
void updateSubscription |
( |
bool |
from, |
|
|
bool |
value, |
|
|
JBStream * |
stream | |
|
) |
| | [protected] |
Update subscription state.
- Parameters:
-
| from | True for subscription from remote user. False for subscription to the remote user. |
| value | True if subscribed. False is unsubscribed. |
| stream | Optional stream to use to send presence if subscription from remote user changed to true. |
void updateTimeout |
( |
bool |
from, |
|
|
u_int64_t |
time = Time::msecNow() | |
|
) |
| | [protected] |
Update user timeout data.
- Parameters:
-
| from | True if the update is made on incoming data. False if timeout is made on outgoing probe. |
| time | Current time. |
The documentation for this class was generated from the following file: