2 local st = require "util.stanza";
3 local datamanager = require "util.datamanager";
5 module:hook("iq/bare/jabber:iq:privacy:query", function(data)
6 local origin, stanza = data.origin, data.stanza;
8 if not stanza.attr.to then -- only service requests to own bare JID
9 local query = stanza.tags[1]; -- the query element
10 local privacy_lists = datamanager.load(origin.username, origin.host, "privacy") or {};
11 if stanza.attr.type == "set" then
13 elseif stanza.attr.type == "get" then
14 if #query.tags == 0 then -- Client requests names of privacy lists from server
16 elseif #query.tags == 1 and query.tags[1].name == "list" then -- Client requests a privacy list from server
19 origin.send(st.error_reply(stanza, "modify", "bad-request"));