diff options
Diffstat (limited to 'Swiften/Queries/Request.h')
-rw-r--r-- | Swiften/Queries/Request.h | 46 |
1 files changed, 33 insertions, 13 deletions
diff --git a/Swiften/Queries/Request.h b/Swiften/Queries/Request.h index c710548..668ed04 100644 --- a/Swiften/Queries/Request.h +++ b/Swiften/Queries/Request.h @@ -4,19 +4,18 @@ * See Documentation/Licenses/GPLv3.txt for more information. */ -#ifndef SWIFTEN_Request_H -#define SWIFTEN_Request_H +#pragma once #include <boost/shared_ptr.hpp> #include <boost/optional.hpp> #include <boost/enable_shared_from_this.hpp> #include <string> -#include "Swiften/Queries/IQHandler.h" -#include "Swiften/Elements/IQ.h" -#include "Swiften/Elements/Payload.h" -#include "Swiften/Elements/ErrorPayload.h" -#include "Swiften/JID/JID.h" +#include <Swiften/Queries/IQHandler.h> +#include <Swiften/Elements/IQ.h> +#include <Swiften/Elements/Payload.h> +#include <Swiften/Elements/ErrorPayload.h> +#include <Swiften/JID/JID.h> namespace Swift { /** @@ -40,6 +39,19 @@ namespace Swift { const JID& receiver, boost::shared_ptr<Payload> payload, IQRouter* router); + + /** + * Constructs a request of a certain type to a specific receiver from a specific sender, and attaches the given + * payload. + */ + Request( + IQ::Type type, + const JID& sender, + const JID& receiver, + boost::shared_ptr<Payload> payload, + IQRouter* router); + + /** * Constructs a request of a certain type to a specific receiver. */ @@ -48,29 +60,37 @@ namespace Swift { const JID& receiver, IQRouter* router); - virtual void setPayload(Payload::ref payload) { + /** + * Constructs a request of a certain type to a specific receiver from a specific sender. + */ + Request( + IQ::Type type, + const JID& sender, + const JID& receiver, + IQRouter* router); + + + virtual void setPayload(boost::shared_ptr<Payload> payload) { payload_ = payload; } - Payload::ref getPayload() const { + boost::shared_ptr<Payload> getPayload() const { return payload_; } - virtual void handleResponse(Payload::ref, ErrorPayload::ref) = 0; + virtual void handleResponse(boost::shared_ptr<Payload>, boost::shared_ptr<ErrorPayload>) = 0; private: bool handleIQ(boost::shared_ptr<IQ>); bool isCorrectSender(const JID& jid); - bool isAccountJID(const JID& jid); private: IQRouter* router_; IQ::Type type_; + JID sender_; JID receiver_; boost::shared_ptr<Payload> payload_; std::string id_; bool sent_; }; } - -#endif |