rosteritem.h
/*
Copyright (c) 2004-2023 by Jakob Schröter <js@camaya.net>
This file is part of the gloox library. http://camaya.net/gloox
This software is distributed under a license. The full license
agreement can be found in the file LICENSE in this distribution.
This software may not be copied, modified, sold or distributed
other than expressed in the named license agreement.
This software is distributed without any warranty.
*/
#ifndef ROSTERITEM_H__
#define ROSTERITEM_H__
#include "jid.h"
#include "gloox.h"
#include "resource.h"
#include "presence.h"
#include <string>
#include <list>
namespace gloox
{
class RosterItemData;
class GLOOX_API RosterItem
{
friend class RosterManager;
public:
typedef std::map<std::string, Resource*> ResourceMap;
const JID EmptyJID;
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 { return m_resources; }
const Resource* resource( const std::string& res ) const;
const Resource* highestResource() const;
protected:
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 );
private:
RosterItemData* m_data;
ResourceMap m_resources;
};
}
#endif // ROSTERITEM_H__
gloox::JID
An abstraction of a JID.
Definition jid.h:31
gloox::Presence::PresenceType
PresenceType
Definition presence.h:43
gloox::Resource
Holds resource attributes.
Definition resource.h:36
gloox::RosterItemData
A class holding roster item data.
Definition rosteritemdata.h:37
gloox::RosterItem::EmptyJID
const JID EmptyJID
Definition rosteritem.h:53
gloox::RosterItem::RosterItem
RosterItem(const std::string &jid, const std::string &name=EmptyString)
Definition rosteritem.cpp:24
gloox::RosterItem::changed
bool changed() const
Definition rosteritem.cpp:98
gloox::RosterItem::setGroups
void setGroups(const StringList &groups)
Definition rosteritem.cpp:84
gloox::RosterItem::name
const std::string & name() const
Definition rosteritem.cpp:46
gloox::RosterItem::ResourceMap
std::map< std::string, Resource * > ResourceMap
Definition rosteritem.h:48
gloox::RosterItem::subscription
SubscriptionType subscription() const
Definition rosteritem.cpp:76
gloox::RosterItem::setSubscription
void setSubscription(const std::string &subscription, const std::string &ask)
Definition rosteritem.cpp:70
gloox::RosterItem::jidJID
const JID & jidJID() const
Definition rosteritem.cpp:54
gloox::RosterItem::resources
const ResourceMap & resources() const
Definition rosteritem.h:141
gloox::RosterItem::setName
void setName(const std::string &name)
Definition rosteritem.cpp:40
gloox::RosterItem::online
bool online() const
Definition rosteritem.cpp:170
gloox::RosterItem::groups
const StringList groups() const
Definition rosteritem.cpp:90
gloox::RosterItem::jid
GLOOX_DEPRECATED const std::string & jid() const
Definition rosteritem.cpp:62
gloox
The namespace for the gloox library.
Definition adhoc.cpp:28
gloox::StanzaExtensionList
std::list< const StanzaExtension * > StanzaExtensionList
Definition gloox.h:1272
gloox::StringList
std::list< std::string > StringList
Definition gloox.h:1251
gloox::EmptyString
const std::string EmptyString
Definition gloox.cpp:124
gloox::SubscriptionType
SubscriptionType
Definition gloox.h:1224