gloox
1.0
|
#include <rosteritem.h>
Public Types | |
typedef std::map< std::string, Resource * > | ResourceMap |
Public Member Functions | |
RosterItem (const std::string &jid, const std::string &name=EmptyString) | |
RosterItem (const RosterItemData &data) | |
virtual | ~RosterItem () |
void | setName (const std::string &name) |
const std::string & | name () const |
const std::string & | jid () const |
void | setSubscription (const std::string &subscription, const std::string &ask) |
SubscriptionType | subscription () const |
void | setGroups (const StringList &groups) |
const StringList | groups () const |
bool | changed () const |
bool | online () const |
const ResourceMap & | resources () const |
const Resource * | resource (const std::string &res) const |
const Resource * | highestResource () const |
Protected Member Functions | |
void | setPresence (const std::string &resource, Presence::PresenceType presence) |
void | setStatus (const std::string &resource, const std::string &msg) |
void | setPriority (const std::string &resource, int priority) |
void | setExtensions (const std::string &resource, const StanzaExtensionList &exts) |
void | setSynchronized () |
void | removeResource (const std::string &resource) |
void | setData (const RosterItemData &rid) |
An abstraction of a roster item.
For each RosterItem all resources that are available (online in some way) are stored in a ResourceMap. This map is accessible using the resources() function.
Definition at line 39 of file rosteritem.h.
typedef std::map<std::string, Resource*> ResourceMap |
A list of resources for the given JID.
Definition at line 47 of file rosteritem.h.
RosterItem | ( | const std::string & | jid, |
const std::string & | name = EmptyString |
||
) |
Constructs a new item of the roster.
jid | The JID of the contact. |
name | The displayed name of the contact. |
Definition at line 22 of file rosteritem.cpp.
RosterItem | ( | const RosterItemData & | data | ) |
Constructs a new RosterItem using the data holding class.
data | The RosterItemData to construct the item from. The new item will own the data object. |
Definition at line 27 of file rosteritem.cpp.
|
virtual |
Virtual destructor.
Definition at line 32 of file rosteritem.cpp.
bool changed | ( | ) | const |
Whether the item has unsynchronized changes.
Definition at line 88 of file rosteritem.cpp.
const StringList groups | ( | ) | const |
Returns the groups this RosterItem belongs to.
Definition at line 80 of file rosteritem.cpp.
const Resource * highestResource | ( | ) | const |
Returns the Resource with the highest priority.
Definition at line 126 of file rosteritem.cpp.
const std::string & jid | ( | ) | const |
Returns the contact's bare JID.
Definition at line 52 of file rosteritem.cpp.
const std::string & name | ( | ) | const |
Retrieves the displayed name of a contact/roster item.
Definition at line 44 of file rosteritem.cpp.
bool online | ( | ) | const |
Indicates whether this item has at least one resource online (in any state).
Definition at line 160 of file rosteritem.cpp.
|
protected |
This function is called to remove subsequent resources from a RosterItem.
resource | The resource to remove. |
Definition at line 150 of file rosteritem.cpp.
const Resource * resource | ( | const std::string & | res | ) | const |
Returns the Resource for a specific resource string.
res | The resource string. |
Definition at line 165 of file rosteritem.cpp.
|
inline |
Returns the contact's resources.
Definition at line 127 of file rosteritem.h.
|
protected |
This function deletes the internal RosterItemData and replaces it with the provided one. The RosterItem will own the RosterItemData instance.
Definition at line 171 of file rosteritem.cpp.
|
protected |
Sets the resource's presence extensions.
resource | The resource to set the extensions for. |
exts | The extensions to set. |
Definition at line 142 of file rosteritem.cpp.
void setGroups | ( | const StringList & | groups | ) |
Sets the groups this RosterItem belongs to.
groups | The groups to set for this item. |
Definition at line 74 of file rosteritem.cpp.
void setName | ( | const std::string & | name | ) |
Sets the displayed name of a contact/roster item.
name | The contact's new name. |
Definition at line 38 of file rosteritem.cpp.
|
protected |
Sets the current presence of the resource.
resource | The resource to set the presence for. |
presence | The current presence. |
Definition at line 102 of file rosteritem.cpp.
|
protected |
Sets the current priority of the resource.
resource | The resource to set the status message for. |
priority | The resource's priority, i.e. from the presence info. |
Definition at line 118 of file rosteritem.cpp.
|
protected |
Sets the current status message of the resource.
resource | The resource to set the status message for. |
msg | The current status message, i.e. from the presence info. |
Definition at line 110 of file rosteritem.cpp.
void setSubscription | ( | const std::string & | subscription, |
const std::string & | ask | ||
) |
Sets the current subscription status of the contact.
subscription | The current subscription. |
ask | Whether a subscription request is pending. |
Definition at line 60 of file rosteritem.cpp.
|
protected |
Removes the 'changed' flag from the item.
Definition at line 96 of file rosteritem.cpp.
SubscriptionType subscription | ( | ) | const |
Returns the current subscription type between the remote and the local entity.
Definition at line 66 of file rosteritem.cpp.