1 /*
2  *  Copyright 2011 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_IQTASK_H_
12 #define WEBRTC_LIBJINGLE_XMPP_IQTASK_H_
13 
14 #include <string>
15 
16 #include "webrtc/libjingle/xmpp/xmppengine.h"
17 #include "webrtc/libjingle/xmpp/xmpptask.h"
18 
19 namespace buzz {
20 
21 class IqTask : public XmppTask {
22  public:
23   IqTask(XmppTaskParentInterface* parent,
24          const std::string& verb, const Jid& to,
25          XmlElement* el);
~IqTask()26   virtual ~IqTask() {}
27 
stanza()28   const XmlElement* stanza() const { return stanza_.get(); }
29 
30   sigslot::signal2<IqTask*,
31                    const XmlElement*> SignalError;
32 
33  protected:
34   virtual void HandleResult(const XmlElement* element) = 0;
35 
36  private:
37   virtual int ProcessStart();
38   virtual bool HandleStanza(const XmlElement* stanza);
39   virtual int ProcessResponse();
40   virtual int OnTimeout();
41 
42   Jid to_;
43   rtc::scoped_ptr<XmlElement> stanza_;
44 };
45 
46 }  // namespace buzz
47 
48 #endif  // WEBRTC_LIBJINGLE_XMPP_IQTASK_H_
49