diff options
author | Remko Tronçon <git@el-tramo.be> | 2011-09-30 20:58:49 (GMT) |
---|---|---|
committer | Remko Tronçon <git@el-tramo.be> | 2011-09-30 21:04:33 (GMT) |
commit | a1b590f2e469191381b5eb8613b5618ffbcafcc4 (patch) | |
tree | 3aa0843c76524d817f0713d6d061cdc380c13a59 /Swift/Controllers/DiscoServiceWalker.h | |
parent | d0081aeea512cc367a1aa9939693d8247b0571af (diff) | |
download | swift-contrib-a1b590f2e469191381b5eb8613b5618ffbcafcc4.zip swift-contrib-a1b590f2e469191381b5eb8613b5618ffbcafcc4.tar.bz2 |
Moved DiscoServiceWalker to Swiften.
Diffstat (limited to 'Swift/Controllers/DiscoServiceWalker.h')
-rw-r--r-- | Swift/Controllers/DiscoServiceWalker.h | 72 |
1 files changed, 0 insertions, 72 deletions
diff --git a/Swift/Controllers/DiscoServiceWalker.h b/Swift/Controllers/DiscoServiceWalker.h deleted file mode 100644 index 7982bbc..0000000 --- a/Swift/Controllers/DiscoServiceWalker.h +++ /dev/null @@ -1,72 +0,0 @@ -/* - * 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 <set> - -#include <boost/shared_ptr.hpp> -#include <Swiften/Base/boost_bsignals.h> -#include <string> -#include <Swiften/JID/JID.h> -#include <Swiften/Elements/DiscoInfo.h> -#include <Swiften/Elements/DiscoItems.h> -#include <Swiften/Elements/ErrorPayload.h> -#include <Swiften/Disco/GetDiscoInfoRequest.h> -#include <Swiften/Disco/GetDiscoItemsRequest.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: - DiscoServiceWalker(const JID& service, IQRouter* iqRouter, size_t maxSteps = 200); - - /** - * Start the walk. - * - * Call this exactly once. - */ - void beginWalk(); - - /** - * End the walk. - */ - void endWalk(); - - bool isActive() const { - return active_; - } - - /** 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, GetDiscoInfoRequest::ref request); - void handleDiscoItemsResponse(boost::shared_ptr<DiscoItems> items, ErrorPayload::ref error, GetDiscoItemsRequest::ref request); - void handleDiscoError(const JID& jid, ErrorPayload::ref error); - - private: - JID service_; - IQRouter* iqRouter_; - size_t maxSteps_; - bool active_; - std::set<JID> servicesBeingSearched_; - std::set<JID> searchedServices_; - std::set<GetDiscoInfoRequest::ref> pendingDiscoInfoRequests_; - std::set<GetDiscoItemsRequest::ref> pendingDiscoItemsRequests_; - }; -} |