From c12c34c5487c2efdd5b6a91ec7f17d5911c20206 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Remko=20Tron=C3=A7on?= <git@el-tramo.be>
Date: Fri, 12 Jun 2009 10:01:09 +0200
Subject: Split up responder into GetResponder and SetResponder.


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; }
+	};
+}
-- 
cgit v0.10.2-6-g49f6