henrike@webrtc.org | 269fb4b | 2014-10-28 22:20:11 +0000 | [diff] [blame] | 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 | // Fires a disco items query, such as the following example: |
| 12 | // |
| 13 | // <iq type='get' |
| 14 | // from='foo@gmail.com/asdf' |
| 15 | // to='bar@google.com' |
| 16 | // id='1234'> |
| 17 | // <query xmlns=' http://jabber.org/protocol/disco#items' |
| 18 | // node='blah '/> |
| 19 | // </iq> |
| 20 | // |
| 21 | // Sample response: |
| 22 | // |
| 23 | // <iq type='result' |
| 24 | // from=' hendriks@google.com' |
| 25 | // to='rsturgell@google.com/asdf' |
| 26 | // id='1234'> |
| 27 | // <query xmlns=' http://jabber.org/protocol/disco#items ' |
| 28 | // node='blah'> |
| 29 | // <item something='somethingelse'/> |
| 30 | // </query> |
| 31 | // </iq> |
| 32 | |
| 33 | |
| 34 | #ifndef WEBRTC_LIBJINGLE_XMPP_DISCOITEMSQUERYTASK_H_ |
| 35 | #define WEBRTC_LIBJINGLE_XMPP_DISCOITEMSQUERYTASK_H_ |
| 36 | |
| 37 | #include <string> |
| 38 | #include <vector> |
| 39 | |
| 40 | #include "webrtc/libjingle/xmpp/iqtask.h" |
| 41 | |
| 42 | namespace buzz { |
| 43 | |
| 44 | struct DiscoItem { |
| 45 | std::string jid; |
| 46 | std::string node; |
| 47 | std::string name; |
| 48 | }; |
| 49 | |
| 50 | class DiscoItemsQueryTask : public IqTask { |
| 51 | public: |
| 52 | DiscoItemsQueryTask(XmppTaskParentInterface* parent, |
| 53 | const Jid& to, const std::string& node); |
| 54 | |
| 55 | sigslot::signal1<std::vector<DiscoItem> > SignalResult; |
| 56 | |
| 57 | private: |
| 58 | static XmlElement* MakeRequest(const std::string& node); |
| 59 | virtual void HandleResult(const XmlElement* result); |
| 60 | static bool ParseItem(const XmlElement* element, DiscoItem* item); |
| 61 | }; |
| 62 | |
| 63 | } // namespace buzz |
| 64 | |
| 65 | #endif // WEBRTC_LIBJINGLE_XMPP_DISCOITEMSQUERYTASK_H_ |