/usr/include/gloox/privacyitem.h is in libgloox-dev 1.0.11-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 | /*
Copyright (c) 2005-2014 by Jakob Schroeter <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 PRIVACYITEM_H__
#define PRIVACYITEM_H__
#include "macros.h"
#include "gloox.h"
#include <string>
namespace gloox
{
/**
* @brief This is an abstraction of a single item of a privacy list, describing an allowed or
* forbidden action.
*
* @author Jakob Schroeter <js@camaya.net>
* @since 0.3
*/
class GLOOX_API PrivacyItem
{
public:
/**
* Three possible types of an item. Only one is allowed at a time.
*/
enum ItemType
{
TypeUndefined, /**< None of the types below is explicitely selected,
* "fall-through" case. */
TypeJid, /**< The item affects the JID which is given in the value attribute. */
TypeGroup, /**< The item affects the group which is given in the value attribute and
* which must exist at least once in the users roster. */
TypeSubscription /**< The item affects the subscription type which is given in the value
* attribute. */
};
/**
* Two possible actions. Only one is allowed at a time.
*/
enum ItemAction
{
ActionAllow, /**< The item explicitely allows the described packets. */
ActionDeny /**< The item forbids the described packets. */
};
/**
* The packet type a privacy item affects (blocks). Combinations are allowed.
*/
enum ItemPacketType
{
PacketMessage = 1, /**< The item blocks message stanzas. */
PacketPresenceIn = 2, /**< The item blocks incoming presence stanzas. */
PacketPresenceOut = 4, /**< The item blocks outgoing presence stanzas. */
PacketIq = 8, /**< The item blocks IQ stanzas. */
PacketAll = 15 /**< The item blocks all of these stanza types. */
};
/**
* Constructs a new privacy item.
* @param type Action is based on matching JID, Group or Subscription.
* @param action The action to carry out. (Deny or allow.)
* @param packetType Affected packet types. Bit-wise OR'ed ItemPacketType.
* @param value The value to check for and match.
*/
PrivacyItem( const ItemType type = TypeUndefined, const ItemAction action = ActionAllow,
const int packetType = 0, const std::string& value = EmptyString );
/**
* Virtual destructor.
*/
virtual ~PrivacyItem();
/**
* Returns the item type.
* @return The type of the item.
*/
ItemType type() const { return m_type; }
/**
* Returns the item's action.
* @return The action of the item.
*/
ItemAction action() const { return m_action; }
/**
* Returns the packet type the item affects.
* @return An OR'ed list of affected packet types.
*/
int packetType() const { return m_packetType; }
/**
* Returns the value of the item's 'value' attribute.
* @return value The 'value' attribute's value.
*/
const std::string value() const { return m_value; }
/**
* Compares the current PrivacyItem with another one.
* @param item The item which shall be compared.
* @return @b True if both items are equal, @b false otherwise.
*/
bool operator==( const PrivacyItem& item ) const;
private:
ItemType m_type;
ItemAction m_action;
int m_packetType;
std::string m_value;
};
}
#endif // PRIVACYITEM_H__
|