# HG changeset patch # User Waqas Hussain # Date 1244075863 -18000 # Node ID ead6d78d2217956d91ce38716fd99cda0404635a # Parent 39197fe5ae948c9ef44f96b650e85c8082927562# Parent 22dcd5f06bc440d54c53b5dd4469ef1ac628c27e My merge!!!! diff -r 22dcd5f06bc4 -r ead6d78d2217 core/stanza_router.lua --- a/core/stanza_router.lua Tue Jun 02 19:56:12 2009 +0100 +++ b/core/stanza_router.lua Thu Jun 04 05:37:43 2009 +0500 @@ -134,6 +134,7 @@ end if h.events.fire_event(event, {origin = origin, stanza = stanza}) then return; end end + if host and not hosts[host] then host = nil; end -- workaround for a Pidgin bug which sets 'to' to the SRV result modules_handle_stanza(host or origin.host or origin.to_host, origin, stanza); end end @@ -149,6 +150,9 @@ to_type = '/full'; else to_type = '/bare'; + if node == origin.username and host == origin.host then + stanza.attr.to = nil; + end end else if host then diff -r 22dcd5f06bc4 -r ead6d78d2217 plugins/mod_privacy.lua --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/plugins/mod_privacy.lua Thu Jun 04 05:37:43 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);