Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(155)

Unified Diff: webrtc/libjingle/xmpp/pubsubtasks.h

Issue 2618633003: Revert of Remove webrtc/libjingle/{xmllite,xmpp} (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « webrtc/libjingle/xmpp/pubsubstateclient.cc ('k') | webrtc/libjingle/xmpp/pubsubtasks.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: webrtc/libjingle/xmpp/pubsubtasks.h
diff --git a/webrtc/libjingle/xmpp/pubsubtasks.h b/webrtc/libjingle/xmpp/pubsubtasks.h
new file mode 100644
index 0000000000000000000000000000000000000000..2f56fa87cc4bd4a10520ab6fa6736bc9eafe9471
--- /dev/null
+++ b/webrtc/libjingle/xmpp/pubsubtasks.h
@@ -0,0 +1,114 @@
+/*
+ * Copyright 2011 The WebRTC Project Authors. All rights reserved.
+ *
+ * Use of this source code is governed by a BSD-style license
+ * that can be found in the LICENSE file in the root of the source
+ * tree. An additional intellectual property rights grant can be found
+ * in the file PATENTS. All contributing project authors may
+ * be found in the AUTHORS file in the root of the source tree.
+ */
+
+#ifndef WEBRTC_LIBJINGLE_XMPP_PUBSUBTASKS_H_
+#define WEBRTC_LIBJINGLE_XMPP_PUBSUBTASKS_H_
+
+#include <vector>
+
+#include "webrtc/libjingle/xmpp/iqtask.h"
+#include "webrtc/libjingle/xmpp/receivetask.h"
+#include "webrtc/base/sigslot.h"
+
+namespace buzz {
+
+// A PubSub itemid + payload. Useful for signaling items.
+struct PubSubItem {
+ std::string itemid;
+ // The entire <item>, owned by the stanza handler. To keep a
+ // reference after handling, make a copy.
+ const XmlElement* elem;
+};
+
+// An IqTask which gets a <pubsub><items> for a particular jid and
+// node, parses the items in the response and signals the items.
+class PubSubRequestTask : public IqTask {
+ public:
+ PubSubRequestTask(XmppTaskParentInterface* parent,
+ const Jid& pubsubjid,
+ const std::string& node);
+
+ sigslot::signal2<PubSubRequestTask*,
+ const std::vector<PubSubItem>&> SignalResult;
+ // SignalError inherited by IqTask.
+ private:
+ virtual void HandleResult(const XmlElement* stanza);
+};
+
+// A ReceiveTask which listens for <event><items> of a particular
+// pubsub JID and node and then signals them items.
+class PubSubReceiveTask : public ReceiveTask {
+ public:
+ PubSubReceiveTask(XmppTaskParentInterface* parent,
+ const Jid& pubsubjid,
+ const std::string& node)
+ : ReceiveTask(parent),
+ pubsubjid_(pubsubjid),
+ node_(node) {
+ }
+
+ virtual int ProcessStart();
+ sigslot::signal2<PubSubReceiveTask*,
+ const std::vector<PubSubItem>&> SignalUpdate;
+
+ protected:
+ virtual bool WantsStanza(const XmlElement* stanza);
+ virtual void ReceiveStanza(const XmlElement* stanza);
+
+ private:
+ Jid pubsubjid_;
+ std::string node_;
+};
+
+// An IqTask which publishes a <pubsub><publish><item> to a particular
+// pubsub jid and node.
+class PubSubPublishTask : public IqTask {
+ public:
+ // Takes ownership of children
+ PubSubPublishTask(XmppTaskParentInterface* parent,
+ const Jid& pubsubjid,
+ const std::string& node,
+ const std::string& itemid,
+ const std::vector<XmlElement*>& children);
+
+ const std::string& itemid() const { return itemid_; }
+
+ sigslot::signal1<PubSubPublishTask*> SignalResult;
+
+ private:
+ // SignalError inherited by IqTask.
+ virtual void HandleResult(const XmlElement* stanza);
+
+ std::string itemid_;
+};
+
+// An IqTask which publishes a <pubsub><publish><retract> to a particular
+// pubsub jid and node.
+class PubSubRetractTask : public IqTask {
+ public:
+ PubSubRetractTask(XmppTaskParentInterface* parent,
+ const Jid& pubsubjid,
+ const std::string& node,
+ const std::string& itemid);
+
+ const std::string& itemid() const { return itemid_; }
+
+ sigslot::signal1<PubSubRetractTask*> SignalResult;
+
+ private:
+ // SignalError inherited by IqTask.
+ virtual void HandleResult(const XmlElement* stanza);
+
+ std::string itemid_;
+};
+
+} // namespace buzz
+
+#endif // WEBRTC_LIBJINGLE_XMPP_PUBSUBTASKS_H_
« no previous file with comments | « webrtc/libjingle/xmpp/pubsubstateclient.cc ('k') | webrtc/libjingle/xmpp/pubsubtasks.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698