diff options
Diffstat (limited to 'Swiften')
-rw-r--r-- | Swiften/Queries/GetResponder.h | 14 | ||||
-rw-r--r-- | Swiften/Queries/Responders/DiscoInfoResponder.cpp | 6 | ||||
-rw-r--r-- | Swiften/Queries/Responders/DiscoInfoResponder.h | 5 | ||||
-rw-r--r-- | Swiften/Queries/Responders/SoftwareVersionResponder.cpp | 6 | ||||
-rw-r--r-- | Swiften/Queries/Responders/SoftwareVersionResponder.h | 5 | ||||
-rw-r--r-- | Swiften/Queries/SetResponder.h | 14 |
6 files changed, 34 insertions, 16 deletions
diff --git a/Swiften/Queries/GetResponder.h b/Swiften/Queries/GetResponder.h new file mode 100644 index 0000000..2bd2fe2 --- /dev/null +++ b/Swiften/Queries/GetResponder.h @@ -0,0 +1,14 @@ +#pragma once + +#include "Swiften/Queries/Responder.h" + +namespace Swift { + template<typename T> + class GetResponder : public Responder<T> { + public: + GetResponder(IQRouter* router) : Responder<T>(router) {} + + private: + virtual bool handleSetRequest(const JID&, const String&, boost::shared_ptr<T>) { return false; } + }; +} diff --git a/Swiften/Queries/Responders/DiscoInfoResponder.cpp b/Swiften/Queries/Responders/DiscoInfoResponder.cpp index e207133..a114fbc 100644 --- a/Swiften/Queries/Responders/DiscoInfoResponder.cpp +++ b/Swiften/Queries/Responders/DiscoInfoResponder.cpp @@ -4,7 +4,7 @@ namespace Swift { -DiscoInfoResponder::DiscoInfoResponder(IQRouter* router) : Responder<DiscoInfo>(router) { +DiscoInfoResponder::DiscoInfoResponder(IQRouter* router) : GetResponder<DiscoInfo>(router) { } void DiscoInfoResponder::setDiscoInfo(const DiscoInfo& info) { @@ -33,8 +33,4 @@ bool DiscoInfoResponder::handleGetRequest(const JID& from, const String& id, boo return true; } -bool DiscoInfoResponder::handleSetRequest(const JID&, const String&, boost::shared_ptr<DiscoInfo>) { - return false; -} - } diff --git a/Swiften/Queries/Responders/DiscoInfoResponder.h b/Swiften/Queries/Responders/DiscoInfoResponder.h index aa79163..3270d5d 100644 --- a/Swiften/Queries/Responders/DiscoInfoResponder.h +++ b/Swiften/Queries/Responders/DiscoInfoResponder.h @@ -3,13 +3,13 @@ #include <map> -#include "Swiften/Queries/Responder.h" +#include "Swiften/Queries/GetResponder.h" #include "Swiften/Elements/DiscoInfo.h" namespace Swift { class IQRouter; - class DiscoInfoResponder : public Responder<DiscoInfo> { + class DiscoInfoResponder : public GetResponder<DiscoInfo> { public: DiscoInfoResponder(IQRouter* router); @@ -18,7 +18,6 @@ namespace Swift { private: virtual bool handleGetRequest(const JID& from, const String& id, boost::shared_ptr<DiscoInfo> payload); - virtual bool handleSetRequest(const JID& from, const String& id, boost::shared_ptr<DiscoInfo> payload); private: DiscoInfo info_; diff --git a/Swiften/Queries/Responders/SoftwareVersionResponder.cpp b/Swiften/Queries/Responders/SoftwareVersionResponder.cpp index dad2442..e608f24 100644 --- a/Swiften/Queries/Responders/SoftwareVersionResponder.cpp +++ b/Swiften/Queries/Responders/SoftwareVersionResponder.cpp @@ -5,7 +5,7 @@ namespace Swift { SoftwareVersionResponder::SoftwareVersionResponder( const String& client, const String& version, IQRouter* router) : - Responder<SoftwareVersion>(router), client_(client), version_(version) { + GetResponder<SoftwareVersion>(router), client_(client), version_(version) { } bool SoftwareVersionResponder::handleGetRequest(const JID& from, const String& id, boost::shared_ptr<SoftwareVersion>) { @@ -13,8 +13,4 @@ bool SoftwareVersionResponder::handleGetRequest(const JID& from, const String& i return true; } -bool SoftwareVersionResponder::handleSetRequest(const JID&, const String&, boost::shared_ptr<SoftwareVersion>) { - return false; -} - } diff --git a/Swiften/Queries/Responders/SoftwareVersionResponder.h b/Swiften/Queries/Responders/SoftwareVersionResponder.h index d66e168..85d1089 100644 --- a/Swiften/Queries/Responders/SoftwareVersionResponder.h +++ b/Swiften/Queries/Responders/SoftwareVersionResponder.h @@ -1,19 +1,18 @@ #ifndef SWIFTEN_SoftwareVersionResponder_H #define SWIFTEN_SoftwareVersionResponder_H -#include "Swiften/Queries/Responder.h" +#include "Swiften/Queries/GetResponder.h" #include "Swiften/Elements/SoftwareVersion.h" namespace Swift { class IQRouter; - class SoftwareVersionResponder : public Responder<SoftwareVersion> { + class SoftwareVersionResponder : public GetResponder<SoftwareVersion> { public: SoftwareVersionResponder(const String& client, const String& version, IQRouter* router); private: virtual bool handleGetRequest(const JID& from, const String& id, boost::shared_ptr<SoftwareVersion> payload); - virtual bool handleSetRequest(const JID& from, const String& id, boost::shared_ptr<SoftwareVersion> payload); private: String client_; diff --git a/Swiften/Queries/SetResponder.h b/Swiften/Queries/SetResponder.h new file mode 100644 index 0000000..51fe39a --- /dev/null +++ b/Swiften/Queries/SetResponder.h @@ -0,0 +1,14 @@ +#pragma once + +#include "Swiften/Queries/Responder.h" + +namespace Swift { + template<typename T> + class SetResponder : public Responder<T> { + public: + SetResponder(IQRouter* router) : Responder<T>(router) {} + + private: + virtual bool handleGetRequest(const JID&, const String&, boost::shared_ptr<T>) { return false; } + }; +} |