diff options
author | Kevin Smith <git@kismith.co.uk> | 2010-11-18 12:09:08 (GMT) |
---|---|---|
committer | Kevin Smith <git@kismith.co.uk> | 2010-12-22 20:19:07 (GMT) |
commit | 9f04a7ec3429303118f12607703b877d8ba43888 (patch) | |
tree | 3e868395fa3c4f9cbbf84614094bb0251b425c15 /Swift/Controllers/DiscoServiceWalker.h | |
parent | 04b99ce8430109d0467c29c85cb6bacb85c54c44 (diff) | |
download | swift-9f04a7ec3429303118f12607703b877d8ba43888.zip swift-9f04a7ec3429303118f12607703b877d8ba43888.tar.bz2 |
Basic User Search support, and Find Rooms cleanup.
Adds a throbber to the MUC search, turns the Add Contact dialog into something searchy, adds the option to open chats to arbitrary JIDs.
Resolves: #614
Resolves: #695
Resolves: #436
Release-Notes: On servers that support it, users can now perform searches for contacts to add or chat to.
Diffstat (limited to 'Swift/Controllers/DiscoServiceWalker.h')
-rw-r--r-- | Swift/Controllers/DiscoServiceWalker.h | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/Swift/Controllers/DiscoServiceWalker.h b/Swift/Controllers/DiscoServiceWalker.h new file mode 100644 index 0000000..5b2a47e --- /dev/null +++ b/Swift/Controllers/DiscoServiceWalker.h @@ -0,0 +1,47 @@ +/* + * Copyright (c) 2010 Kevin Smith + * Licensed under the GNU General Public License v3. + * See Documentation/Licenses/GPLv3.txt for more information. + */ + +#pragma once + +#include <vector> + +#include <boost/shared_ptr.hpp> +#include <Swiften/Base/boost_bsignals.h> +#include <Swiften/Base/String.h> +#include <Swiften/JID/JID.h> +#include <Swiften/Elements/DiscoInfo.h> +#include <Swiften/Elements/DiscoItems.h> +#include <Swiften/Elements/ErrorPayload.h> + +namespace Swift { + class IQRouter; + /** + * Recursively walk service discovery trees to find all services offered. + * This stops on any disco item that's not reporting itself as a server. + */ + class DiscoServiceWalker : public boost::signals::trackable { + public: + DiscoServiceWalker(const JID& service, IQRouter* iqRouter, size_t maxSteps = 200); + /** Start the walk. Call this exactly once.*/ + void beginWalk(); + /** Emitted for each service found. */ + boost::signal<void(const JID&, boost::shared_ptr<DiscoInfo>)> onServiceFound; + /** Emitted when walking is complete.*/ + boost::signal<void()> onWalkComplete; + private: + void handleReceivedDiscoItem(const JID& item); + void walkNode(const JID& jid); + void markNodeCompleted(const JID& jid); + void handleDiscoInfoResponse(boost::shared_ptr<DiscoInfo> info, ErrorPayload::ref error, const JID& jid); + void handleDiscoItemsResponse(boost::shared_ptr<DiscoItems> items, ErrorPayload::ref error, const JID& jid); + void handleDiscoError(const JID& jid, ErrorPayload::ref error); + JID service_; + IQRouter* iqRouter_; + size_t maxSteps_; + std::vector<JID> servicesBeingSearched_; + std::vector<JID> searchedServices_; + }; +} |