RosterItem Class Reference

`#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
GLOOX_DEPRECATED const std::string & | jid () const
const JID & | jidJID () 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

## Public Attributes

const JID | EmptyJID

## 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)

## Detailed Description

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.

Author
  Jakob Schröter js@ca.nosp@m.maya.nosp@m..net

Since
  0.3

Definition at line 40 of file rosteritem.h.

## Member Typedef Documentation

## ResourceMap

typedef std::map<std::string, Resource*> ResourceMap

A list of resources for the given JID.

Definition at line 48 of file rosteritem.h.

## Constructor & Destructor Documentation

## RosterItem() [1/2]

RosterItem | ( | const std::string & | jid,
|  | const std::string & | name = EmptyString )

Constructs a new item of the roster.

Parameters

  jid | The JID of the contact.
  name | The displayed name of the contact.

Definition at line 24 of file rosteritem.cpp.

## RosterItem() [2/2]

RosterItem | ( | const RosterItemData & | data | ) |

Constructs a new RosterItem using the data holding class.

Parameters

  data | The RosterItemData to construct the item from. The new item will own the data object.

Definition at line 29 of file rosteritem.cpp.

## ~RosterItem()

~RosterItem | ( |  | ) |

virtual

Virtual destructor.

Definition at line 34 of file rosteritem.cpp.

## Member Function Documentation

## changed()

bool changed | ( |  | ) | const

Whether the item has unsynchronized changes.

Returns
  True if the item has unsynchronized changes, false otherwise.

Definition at line 98 of file rosteritem.cpp.

## groups()

const StringList groups | ( |  | ) | const

Returns the groups this RosterItem belongs to.

Returns
  The groups this item belongs to.

Definition at line 90 of file rosteritem.cpp.

## highestResource()

const Resource * highestResource | ( |  | ) | const

Returns the Resource with the highest priority.

Returns
  The Resource with the highest priority.

Definition at line 136 of file rosteritem.cpp.

## jid()

const std::string & jid | ( |  | ) | const

Returns the contact's bare JID.

Returns
  The contact's bare JID.

Deprecated
  Use jidJID() for now. In 1.1, jidJID() will be renamed back to jid().

Definition at line 62 of file rosteritem.cpp.

## jidJID()

const JID & jidJID | ( |  | ) | const

Returns the contact's bare JID.

Returns
  The contact's bare JID.

Todo
  Rename to jid() for 1.1.

Definition at line 54 of file rosteritem.cpp.

## name()

const std::string & name | ( |  | ) | const

Retrieves the displayed name of a contact/roster item.

Returns
  The contact's name.

Definition at line 46 of file rosteritem.cpp.

## online()

bool online | ( |  | ) | const

Indicates whether this item has at least one resource online (in any state).

Returns
  True if at least one resource is online, false otherwise.

Definition at line 170 of file rosteritem.cpp.

## removeResource()

void removeResource | ( | const std::string & | resource | ) |

protected

This function is called to remove subsequent resources from a RosterItem.

Parameters

  resource | The resource to remove.

Definition at line 160 of file rosteritem.cpp.

## resource()

const Resource * resource | ( | const std::string & | res | ) | const

Returns the Resource for a specific resource string.

Parameters

  res | The resource string.

Returns
  The Resource if found, 0 otherwise.

Definition at line 175 of file rosteritem.cpp.

## resources()

const ResourceMap & resources | ( |  | ) | const

inline

Returns the contact's resources.

Returns
  The contact's resources.

Definition at line 141 of file rosteritem.h.

## setData()

void setData | ( | const RosterItemData & | rid | ) |

protected

This function deletes the internal RosterItemData and replaces it with the provided one. The RosterItem will own the RosterItemData instance.

Definition at line 181 of file rosteritem.cpp.

## setExtensions()

void setExtensions | ( | const std::string & | resource,
|  | const StanzaExtensionList & | exts )

protected

Sets the resource's presence extensions.

Parameters

  resource | The resource to set the extensions for.
  exts | The extensions to set.

Definition at line 152 of file rosteritem.cpp.

## setGroups()

void setGroups | ( | const StringList & | groups | ) |

Sets the groups this RosterItem belongs to.

Parameters

  groups | The groups to set for this item.

Definition at line 84 of file rosteritem.cpp.

## setName()

void setName | ( | const std::string & | name | ) |

Sets the displayed name of a contact/roster item.

Parameters

  name | The contact's new name.

Definition at line 40 of file rosteritem.cpp.

## setPresence()

void setPresence | ( | const std::string & | resource,
|  | Presence::PresenceType | presence )

protected

Sets the current presence of the resource.

Parameters

  resource | The resource to set the presence for.
  presence | The current presence.

Definition at line 112 of file rosteritem.cpp.

## setPriority()

void setPriority | ( | const std::string & | resource,
|  | int | priority )

protected

Sets the current priority of the resource.

Parameters

  resource | The resource to set the status message for.
  priority | The resource's priority, i.e. from the presence info.

Definition at line 128 of file rosteritem.cpp.

## setStatus()

void setStatus | ( | const std::string & | resource,
|  | const std::string & | msg )

protected

Sets the current status message of the resource.

Parameters

  resource | The resource to set the status message for.
  msg | The current status message, i.e. from the presence info.

Definition at line 120 of file rosteritem.cpp.

## setSubscription()

void setSubscription | ( | const std::string & | subscription,
|  | const std::string & | ask )

Sets the current subscription status of the contact.

Parameters

  subscription | The current subscription.
  ask | Whether a subscription request is pending.

Definition at line 70 of file rosteritem.cpp.

## setSynchronized()

void setSynchronized | ( |  | ) |

protected

Removes the 'changed' flag from the item.

Definition at line 106 of file rosteritem.cpp.

## subscription()

SubscriptionType subscription | ( |  | ) | const

Returns the current subscription type between the remote and the local entity.

Returns
  The subscription type.

Definition at line 76 of file rosteritem.cpp.

## Member Data Documentation

## EmptyJID

const JID EmptyJID

An empty string.

Definition at line 53 of file rosteritem.h.

The documentation for this class was generated from the following files:

- rosteritem.h
- rosteritem.cpp