From bbbb88fe46813f61218786c9776c89444a67ab16 Mon Sep 17 00:00:00 2001
From: Jason Volk <jason@zemos.net>
Date: Sun, 11 Feb 2018 13:51:39 -0800
Subject: [PATCH] modules/client/user: Reactivate the get filter endpoint.

---
 ircd/m/filter.cc       |  1 +
 modules/client/user.cc | 35 +++++++++++------------------------
 2 files changed, 12 insertions(+), 24 deletions(-)

diff --git a/ircd/m/filter.cc b/ircd/m/filter.cc
index 656506e09..39dabebb0 100644
--- a/ircd/m/filter.cc
+++ b/ircd/m/filter.cc
@@ -26,6 +26,7 @@ ircd::m::filter::filter(const string_view &filter_id,
                         const mutable_buffer &buf)
 {
 	size_t len{0};
+	//TODO: really has to become event in user's room
 	filters.get("ircd.filter"_sv, filter_id, [&buf, &len]
 	(const m::event &event)
 	{
diff --git a/modules/client/user.cc b/modules/client/user.cc
index 17ba3f4bb..93d2ad651 100644
--- a/modules/client/user.cc
+++ b/modules/client/user.cc
@@ -32,35 +32,22 @@ get_filter(client &client, const resource::request &request)
 		request.parv[2]
 	};
 
-	const m::vm::query<m::vm::where::equal> query
+	//TODO: ??
+	const unique_buffer<mutable_buffer> buffer
 	{
-		{ "room_id",      m::filter::filters.room_id  },
-		{ "type",        "ircd.filter"                },
-		{ "state_key",    filter_id                   },
-		{ "sender",       user_id                     },
+		m::filter::size(filter_id)
 	};
 
-	const auto result{[&client]
-	(const m::event &event)
+	//TODO: get direct
+	const m::filter filter
 	{
-		const json::object &filter
-		{
-			json::at<"content"_>(event)
-		};
+		filter_id, buffer
+	};
 
-		resource::response
-		{
-			client, filter
-		};
-
-		return true;
-	}};
-
-	if(!m::vm::test(query, result))
-		throw m::NOT_FOUND("No matching filter with that ID");
-
-	// Response already made
-	return {};
+	return resource::response
+	{
+		client, json::object{buffer}
+	};
 }
 
 resource::method get_method