gloox  1.0.28
pubsub.h
1 /*
2  Copyright (c) 2007-2023 by Jakob Schröter <js@camaya.net>
3  This file is part of the gloox library. http://camaya.net/gloox
4 
5  This software is distributed under a license. The full license
6  agreement can be found in the file LICENSE in this distribution.
7  This software may not be copied, modified, sold or distributed
8  other than expressed in the named license agreement.
9 
10  This software is distributed without any warranty.
11 */
12 
13 #ifndef PUBSUB_H__
14 #define PUBSUB_H__
15 
16 #include <map>
17 #include <string>
18 
19 #include "gloox.h"
20 #include "jid.h"
21 
22 namespace gloox
23 {
27  namespace PubSub
28  {
29 
30  class Item;
31 
35  enum NodeType
36  {
37  NodeLeaf,
43  };
44 
49  {
55  };
56 
61  {
76  };
77 
81  enum EventType
82  {
91  };
92 
97  {
100  };
101 
106  {
107  AccessOpen,
114  AccessRoster,
128  };
129 
134  {
137  FeatureCreateAndConfig = 1<<2,
140  FeatureDeleteAny = 1<<4,
143  FeatureGetPending = 1<<6,
146  FeatureItemIDs = 1<<8,
149  FeatureMetaData = 1<<11,
151  FeatureMultiCollection = 1<<13,
153  FeatureMultiSubscribe = 1<<14,
159  FeaturePublish = 1<<18,
166  FeatureRetrieveDefault = 1<<23,
175  FeatureUnknown = 1<<29
176  };
177 
178 // [Persistent - Notification]
179 /* Publisher MUST include an &lt;item/&gt; element, which MAY be empty or contain a payload; if item ID is not provided by publisher, it MUST be generated by pubsub service */
180 
181 // [Persistent - Payload]
182 /* Publisher MUST include an &lt;item/&gt; element that contains the payload; if item ID is not provided by publisher, it MUST be generated by pubsub service */
183 
184 // [Transient - Notification]
185 /* Publisher MUST NOT include an &lt;item/&gt; element (therefore item ID is neither provided nor generated) but the notification will include an empty &lt;items/&gt; element */
186 
187 // [Transient - Payload]
188 /* Publisher MUST include an &lt;item/&gt; element that contains the payload, but the item ID is OPTIONAL */
189 
193  struct Subscriber
194  {
195  Subscriber( const JID& _jid,
196  SubscriptionType _type,
197  const std::string& _subid = EmptyString)
198  : jid( _jid ), type( _type ), subid( _subid ) {}
199  JID jid;
200  SubscriptionType type;
201  std::string subid;
202  };
203 
207  struct Affiliate
208  {
209  Affiliate( const JID& _jid, AffiliationType _type )
210  : jid( _jid ), type( _type ) {}
211  JID jid;
212  AffiliationType type;
213  };
214 
215  typedef std::list<Subscriber> SubscriberList;
216  typedef std::list<Affiliate> AffiliateList;
217 
222  struct TrackedInfo
223  {
224  JID service;
225  std::string node;
226  std::string item;
227  std::string sid;
228  };
229 
234  {
235  SubscriptionType type;
236  JID jid;
237  std::string subid;
238  };
239 
240  typedef std::list<SubscriptionInfo> SubscriptionList;
241  typedef std::map<std::string, SubscriptionList> SubscriptionMap;
242  typedef std::map<std::string, AffiliationType> AffiliationMap;
243  typedef std::list<Item*> ItemList;
244 
245  }
246 
247 }
248 
249 #endif // PUBSUB_H__
An abstraction of a JID.
Definition: jid.h:31
Abstracts a PubSub Item (XEP-0060).
Definition: pubsubitem.h:38
SubscriptionObject
Definition: pubsub.h:97
@ SubscriptionItems
Definition: pubsub.h:99
@ SubscriptionNodes
Definition: pubsub.h:98
@ EventItems
Definition: pubsub.h:86
@ EventCollection
Definition: pubsub.h:83
@ EventPurge
Definition: pubsub.h:88
@ EventDelete
Definition: pubsub.h:85
@ EventItemsRetract
Definition: pubsub.h:87
@ EventUnknown
Definition: pubsub.h:90
@ EventSubscription
Definition: pubsub.h:89
@ EventConfigure
Definition: pubsub.h:84
@ AccessPresence
Definition: pubsub.h:111
@ AccessDefault
Definition: pubsub.h:126
@ AccessRoster
Definition: pubsub.h:114
@ AccessWhitelist
Definition: pubsub.h:119
@ AccessAuthorize
Definition: pubsub.h:117
SubscriptionType
Definition: pubsub.h:61
@ SubscriptionPending
Definition: pubsub.h:67
@ SubscriptionInvalid
Definition: pubsub.h:75
@ SubscriptionNone
Definition: pubsub.h:62
@ SubscriptionSubscribed
Definition: pubsub.h:64
@ SubscriptionUnconfigured
Definition: pubsub.h:71
@ AffiliationInvalid
Definition: pubsub.h:54
@ AffiliationOwner
Definition: pubsub.h:52
@ AffiliationPublisher
Definition: pubsub.h:51
@ AffiliationNone
Definition: pubsub.h:50
@ AffiliationOutcast
Definition: pubsub.h:53
@ NodeInvalid
Definition: pubsub.h:42
@ NodeCollection
Definition: pubsub.h:39
@ FeatureRetrieveAffiliations
Definition: pubsub.h:164
@ FeatureModifyAffiliations
Definition: pubsub.h:150
@ FeaturePublisherAffiliation
Definition: pubsub.h:161
@ FeatureGetPending
Definition: pubsub.h:143
@ FeatureConfigNode
Definition: pubsub.h:136
@ FeatureMultiSubscribe
Definition: pubsub.h:153
@ FeatureRetrieveDefault
Definition: pubsub.h:166
@ FeatureUnknown
Definition: pubsub.h:175
@ FeatureCreateAndConfig
Definition: pubsub.h:137
@ FeatureMultiCollection
Definition: pubsub.h:151
@ FeatureCollections
Definition: pubsub.h:135
@ FeatureItemIDs
Definition: pubsub.h:146
@ FeatureSubscriptionOptions
Definition: pubsub.h:172
@ FeatureRetrieveSubscriptions
Definition: pubsub.h:169
@ FeaturePresenceNotifications
Definition: pubsub.h:157
@ FeaturePublish
Definition: pubsub.h:159
@ FeatureLeasedSubscription
Definition: pubsub.h:147
@ FeatureDeleteNodes
Definition: pubsub.h:142
@ FeaturePersistentItems
Definition: pubsub.h:156
@ FeatureManageSubscriptions
Definition: pubsub.h:148
@ FeatureCreateNodes
Definition: pubsub.h:139
@ FeaturePurgeNodes
Definition: pubsub.h:162
@ FeatureSubscriptionNotifs
Definition: pubsub.h:174
@ FeatureMetaData
Definition: pubsub.h:149
@ FeaturePutcastAffiliation
Definition: pubsub.h:155
@ FeatureRetrieveItems
Definition: pubsub.h:168
@ FeatureDeleteAny
Definition: pubsub.h:140
@ FeatureSubscribe
Definition: pubsub.h:171
@ FeatureInstantNodes
Definition: pubsub.h:145
@ FeatureRetractItems
Definition: pubsub.h:163
The namespace for the gloox library.
Definition: adhoc.cpp:28
const std::string EmptyString
Definition: gloox.cpp:124