Software /
code /
prosody
Annotate
plugins/mod_privacy.lua @ 2769:826f6fb7036d
prosody: Less strict matching for the magic 'interrupted' error
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Mon, 07 Dec 2009 18:32:06 +0000 |
parent | 1522:569d58d21612 |
child | 2496:f18b882af1d1 |
child | 2923:b7049746bd29 |
rev | line source |
---|---|
1522
569d58d21612
Add copyright header to those files missing one
Matthew Wild <mwild1@gmail.com>
parents:
1293
diff
changeset
|
1 -- Prosody IM |
569d58d21612
Add copyright header to those files missing one
Matthew Wild <mwild1@gmail.com>
parents:
1293
diff
changeset
|
2 -- Copyright (C) 2008-2009 Matthew Wild |
569d58d21612
Add copyright header to those files missing one
Matthew Wild <mwild1@gmail.com>
parents:
1293
diff
changeset
|
3 -- Copyright (C) 2008-2009 Waqas Hussain |
569d58d21612
Add copyright header to those files missing one
Matthew Wild <mwild1@gmail.com>
parents:
1293
diff
changeset
|
4 -- |
569d58d21612
Add copyright header to those files missing one
Matthew Wild <mwild1@gmail.com>
parents:
1293
diff
changeset
|
5 -- This project is MIT/X11 licensed. Please see the |
569d58d21612
Add copyright header to those files missing one
Matthew Wild <mwild1@gmail.com>
parents:
1293
diff
changeset
|
6 -- COPYING file in the source package for more information. |
569d58d21612
Add copyright header to those files missing one
Matthew Wild <mwild1@gmail.com>
parents:
1293
diff
changeset
|
7 -- |
569d58d21612
Add copyright header to those files missing one
Matthew Wild <mwild1@gmail.com>
parents:
1293
diff
changeset
|
8 |
1293 | 9 |
10 local st = require "util.stanza"; | |
11 local datamanager = require "util.datamanager"; | |
12 | |
13 module:hook("iq/bare/jabber:iq:privacy:query", function(data) | |
14 local origin, stanza = data.origin, data.stanza; | |
15 | |
16 if not stanza.attr.to then -- only service requests to own bare JID | |
17 local query = stanza.tags[1]; -- the query element | |
18 local privacy_lists = datamanager.load(origin.username, origin.host, "privacy") or {}; | |
19 if stanza.attr.type == "set" then | |
20 -- TODO | |
21 elseif stanza.attr.type == "get" then | |
22 if #query.tags == 0 then -- Client requests names of privacy lists from server | |
23 -- TODO | |
24 elseif #query.tags == 1 and query.tags[1].name == "list" then -- Client requests a privacy list from server | |
25 -- TODO | |
26 else | |
27 origin.send(st.error_reply(stanza, "modify", "bad-request")); | |
28 end | |
29 end | |
30 end | |
31 end); |