2 -- Copyright (C) 2008-2010 Matthew Wild
3 -- Copyright (C) 2008-2010 Waqas Hussain
5 -- This project is MIT/X11 licensed. Please see the
6 -- COPYING file in the source package for more information.
10 local st = require "util.stanza";
11 local datamanager = require "util.datamanager";
13 module:hook("iq/bare/jabber:iq:privacy:query", function(data)
14 local origin, stanza = data.origin, data.stanza;
16 if not stanza.attr.to then -- only service requests to own bare JID
17 local query = stanza.tags[1]; -- the query element
18 local privacy_lists = datamanager.load(origin.username, origin.host, "privacy") or {};
19 if stanza.attr.type == "set" then
21 elseif stanza.attr.type == "get" then
22 if #query.tags == 0 then -- Client requests names of privacy lists from server
24 elseif #query.tags == 1 and query.tags[1].name == "list" then -- Client requests a privacy list from server
27 origin.send(st.error_reply(stanza, "modify", "bad-request"));