• Main Page
  • Classes
  • Files
  • File List

Swiften/Disco/CapsManager.h

00001 /*
00002  * Copyright (c) 2010 Remko Tronçon
00003  * Licensed under the GNU General Public License v3.
00004  * See Documentation/Licenses/GPLv3.txt for more information.
00005  */
00006 
00007 #pragma once
00008 
00009 #include <set>
00010 #include <map>
00011 
00012 #include <Swiften/Base/API.h>
00013 #include <Swiften/Base/boost_bsignals.h>
00014 #include <Swiften/Elements/Presence.h>
00015 #include <Swiften/Elements/DiscoInfo.h>
00016 #include <Swiften/Elements/CapsInfo.h>
00017 #include <Swiften/Elements/ErrorPayload.h>
00018 #include <Swiften/Disco/CapsProvider.h>
00019 
00020 namespace Swift {
00021   class StanzaChannel;
00022   class IQRouter;
00023   class JID;
00024   class CapsStorage;
00025 
00026   class SWIFTEN_API CapsManager : public CapsProvider, public boost::bsignals::trackable { 
00027     public:
00028       CapsManager(CapsStorage*, StanzaChannel*, IQRouter*);
00029 
00030       DiscoInfo::ref getCaps(const std::string&) const;
00031 
00032       // Mainly for testing purposes
00033       void setWarnOnInvalidHash(bool b) {
00034         warnOnInvalidHash = b;
00035       }
00036 
00037     private:
00038       void handlePresenceReceived(boost::shared_ptr<Presence>);
00039       void handleStanzaChannelAvailableChanged(bool);
00040       void handleDiscoInfoReceived(const JID&, const std::string& hash, DiscoInfo::ref, ErrorPayload::ref);
00041       void requestDiscoInfo(const JID& jid, const std::string& node, const std::string& hash);
00042 
00043     private:
00044       IQRouter* iqRouter;
00045       CapsStorage* capsStorage;
00046       bool warnOnInvalidHash;
00047       std::set<std::string> requestedDiscoInfos;
00048       std::set< std::pair<JID, std::string> > failingCaps;
00049       std::map<std::string, std::set< std::pair<JID, std::string> > > fallbacks;
00050   };
00051 }

Generated on Fri Oct 12 2012 21:00:19 for Swiften by  doxygen 1.7.1