plugins/mod_privacy.lua

Sun, 05 Jul 2009 12:25:15 +0500

author
Waqas Hussain <waqas20@gmail.com>
date
Sun, 05 Jul 2009 12:25:15 +0500
changeset 1475
16c8b1a8f6a7
parent 1293
13dde33d5b87
child 1522
569d58d21612
permissions
-rw-r--r--

mod_presence: Changed handle_normal_presence to use a local roster rather than origin's roster


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);

mercurial