/usr/include/gloox/rosteritem.h is in libgloox-dev 1.0.18-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 | /*
Copyright (c) 2004-2016 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;
/**
* @brief 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@camaya.net>
* @since 0.3
*/
class GLOOX_API RosterItem
{
friend class RosterManager;
public:
/**
* A list of resources for the given JID.
*/
typedef std::map<std::string, Resource*> ResourceMap;
/**
* An empty string.
*/
const JID EmptyJID;
/**
* Constructs a new item of the roster.
* @param jid The JID of the contact.
* @param name The displayed name of the contact.
*/
RosterItem( const std::string& jid, const std::string& name = EmptyString );
/**
* Constructs a new RosterItem using the data holding class.
* @param data The RosterItemData to construct the item from. The new
* item will own the data object.
*/
RosterItem( const RosterItemData& data );
/**
* Virtual destructor.
*/
virtual ~RosterItem();
/**
* Sets the displayed name of a contact/roster item.
* @param name The contact's new name.
*/
void setName( const std::string& name );
/**
* Retrieves the displayed name of a contact/roster item.
* @return The contact's name.
*/
const std::string& name() const;
/**
* Returns the contact's bare JID.
* @return The contact's bare JID.
* @deprecated Use jidJID() for now. In 1.1, jidJID() will be renamed back to jid().
*/
GLOOX_DEPRECATED const std::string& jid() const;
/**
* Returns the contact's bare JID.
* @return The contact's bare JID.
* @todo Rename to jid() for 1.1.
*/
const JID& jidJID() const;
/**
* Sets the current subscription status of the contact.
* @param subscription The current subscription.
* @param ask Whether a subscription request is pending.
*/
void setSubscription( const std::string& subscription, const std::string& ask );
/**
* Returns the current subscription type between the remote and the local entity.
* @return The subscription type.
*/
SubscriptionType subscription() const;
/**
* Sets the groups this RosterItem belongs to.
* @param groups The groups to set for this item.
*/
void setGroups( const StringList& groups );
/**
* Returns the groups this RosterItem belongs to.
* @return The groups this item belongs to.
*/
const StringList groups() const;
/**
* Whether the item has unsynchronized changes.
* @return @b True if the item has unsynchronized changes, @b false otherwise.
*/
bool changed() const;
/**
* Indicates whether this item has at least one resource online (in any state).
* @return @b True if at least one resource is online, @b false otherwise.
*/
bool online() const;
/**
* Returns the contact's resources.
* @return The contact's resources.
*/
const ResourceMap& resources() const { return m_resources; }
/**
* Returns the Resource for a specific resource string.
* @param res The resource string.
* @return The Resource if found, 0 otherwise.
*/
const Resource* resource( const std::string& res ) const;
/**
* Returns the Resource with the highest priority.
* @return The Resource with the highest priority.
*/
const Resource* highestResource() const;
protected:
/**
* Sets the current presence of the resource.
* @param resource The resource to set the presence for.
* @param presence The current presence.
*/
void setPresence( const std::string& resource, Presence::PresenceType presence );
/**
* Sets the current status message of the resource.
* @param resource The resource to set the status message for.
* @param msg The current status message, i.e. from the presence info.
*/
void setStatus( const std::string& resource, const std::string& msg );
/**
* Sets the current priority of the resource.
* @param resource The resource to set the status message for.
* @param priority The resource's priority, i.e. from the presence info.
*/
void setPriority( const std::string& resource, int priority );
/**
* Sets the resource's presence extensions.
* @param resource The resource to set the extensions for.
* @param exts The extensions to set.
*/
void setExtensions( const std::string& resource, const StanzaExtensionList& exts );
/**
* Removes the 'changed' flag from the item.
*/
void setSynchronized();
/**
* This function is called to remove subsequent resources from a RosterItem.
* @param resource The resource to remove.
*/
void removeResource( const std::string& resource );
/**
* This function deletes the internal RosterItemData and replaces it with the provided
* one. The RosterItem will own the RosterItemData instance.
*/
void setData( const RosterItemData& rid );
private:
RosterItemData* m_data;
ResourceMap m_resources;
};
}
#endif // ROSTERITEM_H__
|