gloox  1.0
pubsub.h
1 /*
2  Copyright (c) 2007-2009 by Jakob Schroeter <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  {
43  };
44 
49  {
55  };
56 
61  {
76  };
77 
81  enum EventType
82  {
91  };
92 
97  {
100  };
101 
106  {
128  };
129 
134  {
146  FeatureItemIDs = 1<<8,
149  FeatureMetaData = 1<<11,
159  FeaturePublish = 1<<18,
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__