diff options
author | Waqas Hussain <waqas20@gmail.com> | 2009-06-03 08:02:24 +0500 |
---|---|---|
committer | Waqas Hussain <waqas20@gmail.com> | 2009-06-03 08:02:24 +0500 |
commit | 558903ff51558421c3c989e014da3fa643944580 (patch) | |
tree | 84b25ef66a0395e5bdb085cc51c08458574d19af /plugins/mod_privacy.lua | |
parent | b17e2aad5ba92853a26a6478a1a90cfc512c7ac1 (diff) | |
download | prosody-558903ff51558421c3c989e014da3fa643944580.tar.gz prosody-558903ff51558421c3c989e014da3fa643944580.zip |
mod_privacy: Initial commit
Diffstat (limited to 'plugins/mod_privacy.lua')
-rw-r--r-- | plugins/mod_privacy.lua | 23 |
1 files changed, 23 insertions, 0 deletions
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); |