Changeset

1293:13dde33d5b87

mod_privacy: Initial commit
author Waqas Hussain <waqas20@gmail.com>
date Wed, 03 Jun 2009 08:02:24 +0500
parents 1292:b18c1ad7fcb6
children 1294:39197fe5ae94
files plugins/mod_privacy.lua
diffstat 1 files changed, 23 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/plugins/mod_privacy.lua	Wed Jun 03 08:02:24 2009 +0500
@@ -0,0 +1,23 @@
+
+local st = require "util.stanza";
+local datamanager = require "util.datamanager";
+
+module:hook("iq/bare/jabber:iq:privacy:query", function(data)
+	local origin, stanza = data.origin, data.stanza;
+	
+	if not stanza.attr.to then -- only service requests to own bare JID
+		local query = stanza.tags[1]; -- the query element
+		local privacy_lists = datamanager.load(origin.username, origin.host, "privacy") or {};
+		if stanza.attr.type == "set" then
+			-- TODO
+		elseif stanza.attr.type == "get" then
+			if #query.tags == 0 then -- Client requests names of privacy lists from server
+				-- TODO
+			elseif #query.tags == 1 and query.tags[1].name == "list" then -- Client requests a privacy list from server
+				-- TODO
+			else
+				origin.send(st.error_reply(stanza, "modify", "bad-request"));
+			end
+		end
+	end
+end);