/* * Copyright (c) 2010 Kevin Smith * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ #pragma once #include #include #include #include #include #include #include #include #include #include namespace Swift { class UIEventStream; class UIEvent; class UserSearchWindow; class UserSearchWindowFactory; class IQRouter; class DiscoServiceWalker; class UserSearchResult { public: UserSearchResult(const JID& jid, const std::map& fields) : jid_(jid), fields_(fields) {} const JID& getJID() const {return jid_;} const std::map& getFields() const {return fields_;} private: JID jid_; std::map fields_; }; class UserSearchController { public: enum Type {AddContact, StartChat}; UserSearchController(Type type, const JID& jid, UIEventStream* uiEventStream, UserSearchWindowFactory* userSearchWindowFactory, IQRouter* iqRouter); ~UserSearchController(); private: void handleUIEvent(boost::shared_ptr event); void handleFormRequested(const JID& service); void handleDiscoServiceFound(const JID& jid, boost::shared_ptr info, DiscoServiceWalker* walker); void handleDiscoWalkFinished(DiscoServiceWalker* walker); void handleFormResponse(boost::shared_ptr items, ErrorPayload::ref error, const JID& jid); void handleSearch(boost::shared_ptr fields, const JID& jid); void handleSearchResponse(boost::shared_ptr results, ErrorPayload::ref error, const JID& jid); Type type_; UIEventStream* uiEventStream_; UserSearchWindow* window_; UserSearchWindowFactory* factory_; boost::bsignals::scoped_connection uiEventConnection_; IQRouter* iqRouter_; JID jid_; DiscoServiceWalker* discoWalker_; }; }