00001
00002
00003
00004
00005
00006
00007 #pragma once
00008
00009 #include <Swiften/Base/boost_bsignals.h>
00010 #include <Swiften/Queries/Request.h>
00011
00012 namespace Swift {
00022 template<typename PAYLOAD_TYPE>
00023 class GenericRequest : public Request {
00024 public:
00032 GenericRequest(
00033 IQ::Type type,
00034 const JID& receiver,
00035 boost::shared_ptr<Payload> payload,
00036 IQRouter* router) :
00037 Request(type, receiver, payload, router) {
00038 }
00039
00048 GenericRequest(
00049 IQ::Type type,
00050 const JID& sender,
00051 const JID& receiver,
00052 boost::shared_ptr<Payload> payload,
00053 IQRouter* router) :
00054 Request(type, sender, receiver, payload, router) {
00055 }
00056
00060 virtual void handleResponse(boost::shared_ptr<Payload> payload, ErrorPayload::ref error) {
00061 onResponse(boost::dynamic_pointer_cast<PAYLOAD_TYPE>(payload), error);
00062 }
00063
00064 protected:
00065 boost::shared_ptr<PAYLOAD_TYPE> getPayloadGeneric() const {
00066 return boost::dynamic_pointer_cast<PAYLOAD_TYPE>(getPayload());
00067 }
00068
00069 public:
00073 boost::signal<void (boost::shared_ptr<PAYLOAD_TYPE>, ErrorPayload::ref)> onResponse;
00074 };
00075 }