gloox  0.9.9.12
Public Types | Public Member Functions | Protected Member Functions | List of all members
RosterItem Class Reference

#include <rosteritem.h>

Public Types

enum  SubscriptionEnum {
  S10nNone, S10nNoneOut, S10nNoneIn, S10nNoneOutIn,
  S10nTo, S10nToIn, S10nFrom, S10nFromOut,
  S10nBoth
}
typedef std::map< std::string,
Resource * > 
ResourceMap

Public Member Functions

 RosterItem (const JID &jid, const std::string &name="")
virtual ~RosterItem ()
virtual void setName (const std::string &name)
virtual const std::string & name () const
virtual const std::string & jid () const
virtual SubscriptionEnum subscription () const
virtual void setGroups (const StringList &groups)
virtual const StringListgroups () const
virtual bool changed () const
virtual bool online () const
virtual const ResourceMapresources () const
virtual const Resourceresource (const std::string &res) const

Protected Member Functions

virtual void setPresence (const std::string &resource, Presence presence)
virtual void setStatus (const std::string &resource, const std::string &msg)
virtual void setPriority (const std::string &resource, int priority)
virtual void setSubscription (const std::string &subscription, bool ask)
virtual void setSynchronized ()
virtual void removeResource (const std::string &resource)

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 Schroeter js@ca.nosp@m.maya.nosp@m..net
Since
0.3

Definition at line 37 of file rosteritem.h.

Member Typedef Documentation

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

A list of resources for the given JID.

Definition at line 45 of file rosteritem.h.

Member Enumeration Documentation

Describes possible subscribtion types according to RFC 3921, Section 9.

Enumerator:
S10nNone 

Contact and user are not subscribed to each other, and neither has requested a subscription from the other.

S10nNoneOut 

Contact and user are not subscribed to each other, and user has sent contact a subscription request but contact has not replied yet.

S10nNoneIn 

Contact and user are not subscribed to each other, and contact has sent user a subscription request but user has not replied yet (note: contact's server SHOULD NOT push or deliver roster items in this state, but instead SHOULD wait until contact has approved subscription request from user).

S10nNoneOutIn 

Contact and user are not subscribed to each other, contact has sent user a subscription request but user has not replied yet, and user has sent contact a subscription request but contact has not replied yet.

S10nTo 

User is subscribed to contact (one-way).

S10nToIn 

User is subscribed to contact, and contact has sent user a subscription request but user has not replied yet.

S10nFrom 

Contact is subscribed to user (one-way).

S10nFromOut 

Contact is subscribed to user, and user has sent contact a subscription request but contact has not replied yet.

S10nBoth 

User and contact are subscribed to each other (two-way).

Definition at line 50 of file rosteritem.h.

Constructor & Destructor Documentation

RosterItem ( const JID jid,
const std::string &  name = "" 
)

Constructs a new item of the roster.

Parameters
jidThe JID of the contact.
nameThe displayed name of the contact.

Definition at line 20 of file rosteritem.cpp.

~RosterItem ( )
virtual

Virtual destructor.

Definition at line 25 of file rosteritem.cpp.

Member Function Documentation

virtual bool changed ( ) const
inlinevirtual

Whether the item has unsynchronized changes.

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

Definition at line 127 of file rosteritem.h.

virtual const StringList& groups ( ) const
inlinevirtual

Returns the groups this RosterItem belongs to.

Returns
The groups this item belongs to.

Definition at line 121 of file rosteritem.h.

virtual const std::string& jid ( ) const
inlinevirtual

Returns the contact's bare JID.

Returns
The contact's bare JID.

Definition at line 103 of file rosteritem.h.

virtual const std::string& name ( ) const
inlinevirtual

Retrieves the displayed name of a contact/roster item.

Returns
The contact's name.

Definition at line 97 of file rosteritem.h.

bool online ( ) const
virtual

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 105 of file rosteritem.cpp.

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

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

Parameters
resourceThe resource to remove.

Definition at line 95 of file rosteritem.cpp.

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

Returns the Resource for a specific resource string.

Parameters
resThe resource string.
Returns
The Resource if found, 0 otherwise.

Definition at line 110 of file rosteritem.cpp.

virtual const ResourceMap& resources ( ) const
inlinevirtual

Returns the contact's resources.

Returns
The contact's resources.

Definition at line 139 of file rosteritem.h.

void setGroups ( const StringList groups)
virtual

Sets the groups this RosterItem belongs to.

Parameters
groupsThe groups to set for this item.

Definition at line 89 of file rosteritem.cpp.

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

Sets the displayed name of a contact/roster item.

Parameters
nameThe contact's new name.

Definition at line 35 of file rosteritem.cpp.

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

Sets the current presence of the resource.

Parameters
resourceThe resource to set the presence for.
presenceThe current presence.

Definition at line 41 of file rosteritem.cpp.

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

Sets the current priority of the resource.

Parameters
resourceThe resource to set the status message for.
priorityThe resource's priority, i.e. from the presence info.

Definition at line 61 of file rosteritem.cpp.

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

Sets the current status message of the resource.

Parameters
resourceThe resource to set the status message for.
msgThe current status message, i.e. from the presence info.

Definition at line 51 of file rosteritem.cpp.

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

Sets the current subscription status of the contact.

Parameters
subscriptionThe current subscription.
askWhether a subscription request is pending.

Definition at line 71 of file rosteritem.cpp.

virtual void setSynchronized ( )
inlineprotectedvirtual

Removes the 'changed' flag from the item.

Definition at line 180 of file rosteritem.h.

virtual SubscriptionEnum subscription ( ) const
inlinevirtual

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

Returns
The subscription type.

Definition at line 109 of file rosteritem.h.


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