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