OLD | NEW |
(Empty) | |
| 1 // Copyright 2004 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef THIRD_PARTY_LIBJINGLE_FILES_WEBRTC_LIBJINGLE_XMPP_PRESENCERECEIVETASK_H_ |
| 6 #define THIRD_PARTY_LIBJINGLE_FILES_WEBRTC_LIBJINGLE_XMPP_PRESENCERECEIVETASK_H_ |
| 7 |
| 8 #include "webrtc/base/sigslot.h" |
| 9 |
| 10 #include "third_party/libjingle_xmpp/xmpp/presencestatus.h" |
| 11 #include "third_party/libjingle_xmpp/xmpp/xmpptask.h" |
| 12 |
| 13 namespace buzz { |
| 14 |
| 15 // A task to receive presence status callbacks from the XMPP server. |
| 16 class PresenceReceiveTask : public XmppTask { |
| 17 public: |
| 18 // Arguments: |
| 19 // parent a reference to task interface associated withe the XMPP client. |
| 20 explicit PresenceReceiveTask(XmppTaskParentInterface* parent); |
| 21 |
| 22 // Shuts down the thread associated with this task. |
| 23 virtual ~PresenceReceiveTask(); |
| 24 |
| 25 // Starts pulling queued status messages and dispatching them to the |
| 26 // PresenceUpdate() callback. |
| 27 virtual int ProcessStart(); |
| 28 |
| 29 // Slot for presence message callbacks |
| 30 sigslot::signal1<const PresenceStatus&> PresenceUpdate; |
| 31 |
| 32 protected: |
| 33 // Called by the XMPP engine when presence stanzas are received from the |
| 34 // server. |
| 35 virtual bool HandleStanza(const XmlElement * stanza); |
| 36 |
| 37 private: |
| 38 // Handles presence stanzas by converting the data to PresenceStatus |
| 39 // objects and passing those along to the SignalStatusUpadate() callback. |
| 40 void HandlePresence(const Jid& from, const XmlElement * stanza); |
| 41 |
| 42 // Extracts presence information for the presence stanza sent form the |
| 43 // server. |
| 44 static void DecodeStatus(const Jid& from, const XmlElement * stanza, |
| 45 PresenceStatus* status); |
| 46 }; |
| 47 |
| 48 } // namespace buzz |
| 49 |
| 50 #endif // THIRD_PARTY_LIBJINGLE_FILES_WEBRTC_LIBJINGLE_XMPP_PRESENCERECEIVETASK_
H_ |
OLD | NEW |