301 local origin, stanza = data.origin, data.stanza; |
301 local origin, stanza = data.origin, data.stanza; |
302 |
302 |
303 if stanza.attr.to == nil then -- only service requests to own bare JID |
303 if stanza.attr.to == nil then -- only service requests to own bare JID |
304 local query = stanza.tags[1]; -- the query element |
304 local query = stanza.tags[1]; -- the query element |
305 local valid = false; |
305 local valid = false; |
306 local privacy_lists = datamanager.load(origin.username, origin.host, "privacy") or {}; |
306 local privacy_lists = datamanager.load(origin.username, origin.host, "privacy") or { lists = {} }; |
|
307 |
|
308 if privacy_lists.lists[1] then -- Code to migrate from old privacy lists format, remove in 0.8 |
|
309 module:log("info", "Upgrading format of stored privacy lists for %s@%s", origin.username, origin.host); |
|
310 local lists = privacy_lists.lists; |
|
311 for idx, list in ipairs(lists) do |
|
312 lists[list.name] = list; |
|
313 lists[idx] = nil; |
|
314 end |
|
315 end |
307 |
316 |
308 if stanza.attr.type == "set" then |
317 if stanza.attr.type == "set" then |
309 if #query.tags == 1 then -- the <query/> element MUST NOT include more than one child element |
318 if #query.tags == 1 then -- the <query/> element MUST NOT include more than one child element |
310 for _,tag in ipairs(query.tags) do |
319 for _,tag in ipairs(query.tags) do |
311 if tag.name == "active" or tag.name == "default" then |
320 if tag.name == "active" or tag.name == "default" then |