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 WEBRTC_LIBJINGLE_XMPP_XMPPPUMP_H_ |
| 6 #define WEBRTC_LIBJINGLE_XMPP_XMPPPUMP_H_ |
| 7 |
| 8 #include "third_party/libjingle_xmpp/xmpp/xmppclient.h" |
| 9 #include "third_party/libjingle_xmpp/xmpp/xmppengine.h" |
| 10 #include "third_party/libjingle_xmpp/xmpp/xmpptask.h" |
| 11 #include "webrtc/base/messagequeue.h" |
| 12 #include "webrtc/base/taskrunner.h" |
| 13 #include "webrtc/base/thread.h" |
| 14 #include "webrtc/base/timeutils.h" |
| 15 |
| 16 namespace buzz { |
| 17 |
| 18 // Simple xmpp pump |
| 19 |
| 20 class XmppPumpNotify { |
| 21 public: |
| 22 virtual ~XmppPumpNotify() {} |
| 23 virtual void OnStateChange(buzz::XmppEngine::State state) = 0; |
| 24 }; |
| 25 |
| 26 class XmppPump : public rtc::MessageHandler, public rtc::TaskRunner { |
| 27 public: |
| 28 XmppPump(buzz::XmppPumpNotify * notify = NULL); |
| 29 |
| 30 buzz::XmppClient *client() { return client_; } |
| 31 |
| 32 void DoLogin(const buzz::XmppClientSettings & xcs, |
| 33 buzz::AsyncSocket* socket, |
| 34 buzz::PreXmppAuth* auth); |
| 35 void DoDisconnect(); |
| 36 |
| 37 void OnStateChange(buzz::XmppEngine::State state); |
| 38 |
| 39 void WakeTasks(); |
| 40 |
| 41 int64_t CurrentTime(); |
| 42 |
| 43 void OnMessage(rtc::Message *pmsg); |
| 44 |
| 45 buzz::XmppReturnStatus SendStanza(const buzz::XmlElement *stanza); |
| 46 |
| 47 private: |
| 48 buzz::XmppClient *client_; |
| 49 buzz::XmppEngine::State state_; |
| 50 buzz::XmppPumpNotify *notify_; |
| 51 }; |
| 52 |
| 53 } // namespace buzz |
| 54 |
| 55 #endif // WEBRTC_LIBJINGLE_XMPP_XMPPPUMP_H_ |
| 56 |
OLD | NEW |