Home | History | Annotate | Download | only in xmpp
      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 WEBRTC_LIBJINGLE_XMPP_XMPPTHREAD_H_
     12 #define WEBRTC_LIBJINGLE_XMPP_XMPPTHREAD_H_
     13 
     14 #include "webrtc/libjingle/xmpp/xmppclientsettings.h"
     15 #include "webrtc/libjingle/xmpp/xmppengine.h"
     16 #include "webrtc/libjingle/xmpp/xmpppump.h"
     17 #include "webrtc/libjingle/xmpp/xmppsocket.h"
     18 #include "webrtc/base/thread.h"
     19 
     20 namespace buzz {
     21 
     22 class XmppThread:
     23     public rtc::Thread, buzz::XmppPumpNotify, rtc::MessageHandler {
     24 public:
     25   XmppThread();
     26   ~XmppThread();
     27 
     28   buzz::XmppClient* client() { return pump_->client(); }
     29 
     30   void ProcessMessages(int cms);
     31 
     32   void Login(const buzz::XmppClientSettings & xcs);
     33   void Disconnect();
     34 
     35 private:
     36   buzz::XmppPump* pump_;
     37 
     38   void OnStateChange(buzz::XmppEngine::State state);
     39   void OnMessage(rtc::Message* pmsg);
     40 };
     41 
     42 }  // namespace buzz
     43 
     44 #endif  // WEBRTC_LIBJINGLE_XMPP_XMPPTHREAD_H_
     45 
     46