/usr/include/gloox/pubsubevent.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 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 | /*
Copyright (c) 2004-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 PUBSUBEVENT_H__
#define PUBSUBEVENT_H__
#include "stanzaextension.h"
#include "pubsub.h"
#include "gloox.h"
namespace gloox
{
class Tag;
namespace PubSub
{
/**
* @brief This is an implementation of a PubSub Notification as a StanzaExtension.
*
* @author Vincent Thomasset <vthomasset@gmail.com>
* @since 1.0
*/
class GLOOX_API Event : public StanzaExtension
{
public:
/**
* Stores a retract or item notification.
*/
struct ItemOperation
{
/**
* Constructor.
*
* @param remove Whether this is a retract operation or not (ie item).
* @param itemid Item ID of this item.
* @param pld Payload for this object (in the case of a non transient
* item notification).
*/
ItemOperation( bool remove, const std::string& itemid, const Tag* pld = 0 )
: retract( remove ), item( itemid ), payload( pld )
{}
/**
* Copy constructor.
* @param right The ItemOperation to copy from.
*/
ItemOperation( const ItemOperation& right );
bool retract;
std::string item;
const Tag* payload;
};
/**
* A list of ItemOperations.
*/
typedef std::list<ItemOperation*> ItemOperationList;
/**
* PubSub event notification Stanza Extension.
* @param event A tag to parse.
*/
Event( const Tag* event );
/**
* PubSub event notification Stanza Extension.
* @param node The node's ID for which the notification is sent.
* @param type The event's type.
*/
Event( const std::string& node, PubSub::EventType type );
/**
* Virtual destructor.
*/
virtual ~Event();
/**
* Returns the event's type.
* @return The event's type.
*/
PubSub::EventType type() const { return m_type; }
/**
* Returns the list of subscription IDs for which this notification
* is valid.
* @return The list of subscription IDs.
*/
const StringList& subscriptions() const
{ return m_subscriptionIDs ? *m_subscriptionIDs : m_emptyStringList; }
/**
* Returns the list of ItemOperations for EventItems(Retract) notification.
* @return The list of ItemOperations.
*/
const ItemOperationList& items() const
{ return m_itemOperations ? *m_itemOperations : m_emptyOperationList; }
/**
* Add an item to the list of ItemOperations for EventItems(Retract) notification.
* After calling, the PubSub::Event object owns the ItemOperation and will free it.
* @param op An ItemOperation to add.
*/
void addItem( ItemOperation* op );
/**
* Returns the node's ID for which the notification is sent.
* @return The node's ID.
*/
const std::string& node() const { return m_node; }
/**
* Returns the subscribe/unsubscribed JID. Only set for subscription notifications
* (type() == EventSubscription).
* @return The affected JID.
*/
const JID& jid() { return m_jid; }
/**
* Returns the subscription state. Only set for subscription notifications
* (type() == EventSubscription).
* @return @b True if the subscription request was approved, @b false otherwise.
*/
bool subscription() { return m_subscription; }
// reimplemented from StanzaExtension
const std::string& filterString() const;
// reimplemented from StanzaExtension
StanzaExtension* newInstance( const Tag* tag ) const
{
return new Event( tag );
}
// reimplemented from StanzaExtension
Tag* tag() const;
// reimplemented from StanzaExtension
virtual StanzaExtension* clone() const;
private:
Event& operator=( const Event& );
PubSub::EventType m_type;
std::string m_node;
StringList* m_subscriptionIDs;
JID m_jid;
Tag* m_config;
ItemOperationList* m_itemOperations;
std::string m_collection;
bool m_subscription;
const ItemOperationList m_emptyOperationList;
const StringList m_emptyStringList;
};
}
}
#endif // PUBSUBEVENT_H__
|