aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--core/stanza_router.lua4
-rw-r--r--plugins/mod_privacy.lua23
2 files changed, 27 insertions, 0 deletions
diff --git a/core/stanza_router.lua b/core/stanza_router.lua
index 8b98939b..f3d385c7 100644
--- a/core/stanza_router.lua
+++ b/core/stanza_router.lua
@@ -134,6 +134,7 @@ function core_process_stanza(origin, stanza)
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 @@ function core_post_stanza(origin, stanza)
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 --git a/plugins/mod_privacy.lua b/plugins/mod_privacy.lua
new file mode 100644
index 00000000..9f8a149b
--- /dev/null
+++ b/plugins/mod_privacy.lua
@@ -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);