Parcourir la source

[2932] Interface to subscribe and unsubscribe notifications

Not documented as of yet, and no implementation.
Michal 'vorner' Vaner il y a 11 ans
Parent
commit
ccb473862e
1 fichiers modifiés avec 13 ajouts et 0 suppressions
  1. 13 0
      src/lib/config/ccsession.h

+ 13 - 0
src/lib/config/ccsession.h

@@ -575,6 +575,19 @@ public:
     /// \param id The id of request as returned by groupRecvMsgAsync.
     void cancelAsyncRecv(const AsyncRecvRequestID& id);
 
+    typedef boost::function<void (const std::string& event_name,
+                                  const data::ConstElementPtr& params)>
+        NotificationCallback;
+    typedef std::list<NotificationCallback> NotificationCallbacks;
+    typedef std::map<std::string, NotificationCallbacks>
+        SubscribedNotifications;
+    typedef std::pair<SubscribedNotifications::iterator,
+                      NotificationCallbacks::iterator>
+        NotificationID;
+    NotificationID subscribeNotification(const std::string& notification_group,
+                                         const NotificationCallback& callback);
+    void unsubscribeNotification(const NotificationID& notification);
+
     /// \brief Subscribe to a group
     ///
     /// Wrapper around the CCSession::subscribe.