/* * Copyright (c) 2010 Remko Tronçon * Licensed under the GNU General Public License v3. * See Documentation/Licenses/GPLv3.txt for more information. */ #pragma once #include #include #include #include #include namespace Swift { template class GetPrivateStorageRequest : public Request { public: typedef boost::shared_ptr > ref; static ref create(IQRouter* router) { return ref(new GetPrivateStorageRequest(router)); } private: GetPrivateStorageRequest(IQRouter* router) : Request(IQ::Get, JID(), boost::shared_ptr(new PrivateStorage(boost::shared_ptr(new PAYLOAD_TYPE()))), router) { } virtual void handleResponse(boost::shared_ptr payload, ErrorPayload::ref error) { boost::shared_ptr storage = boost::dynamic_pointer_cast(payload); if (storage) { onResponse(boost::dynamic_pointer_cast(storage->getPayload()), error); } else { onResponse(boost::shared_ptr(), error); } } public: boost::signal, ErrorPayload::ref)> onResponse; }; }