Software /
code /
prosody
Comparison
plugins/mod_blocklist.lua @ 7773:7fd26815fcf6
mod_blocklist: Remove one indentation level
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 05 Dec 2016 17:25:02 +0100 |
parent | 7772:752697d68fda |
child | 7774:1f55edac1f72 |
comparison
equal
deleted
inserted
replaced
7772:752697d68fda | 7773:7fd26815fcf6 |
---|---|
59 local default_list = legacy_data.lists[legacy_data.default]; | 59 local default_list = legacy_data.lists[legacy_data.default]; |
60 if not default_list or not default_list.items then return; end | 60 if not default_list or not default_list.items then return; end |
61 | 61 |
62 local migrated_data = { [false] = { created = os.time(); migrated = "privacy" }}; | 62 local migrated_data = { [false] = { created = os.time(); migrated = "privacy" }}; |
63 | 63 |
64 if legacy_data then | 64 module:log("info", "Migrating blocklist from mod_privacy storage for user '%s'", username); |
65 module:log("info", "Migrating blocklist from mod_privacy storage for user '%s'", username); | 65 local item, jid; |
66 local item, jid; | 66 for i = 1, #legacy_data do |
67 for i = 1, #legacy_data do | 67 item = legacy_data[i]; |
68 item = legacy_data[i]; | 68 if item.type == "jid" and item.action == "deny" then |
69 if item.type == "jid" and item.action == "deny" then | 69 jid = jid_prep(item.value); |
70 jid = jid_prep(item.value); | 70 if not jid then |
71 if not jid then | 71 module:log("warn", "Invalid JID in privacy store for user '%s' not migrated: %s", username, tostring(item.value)); |
72 module:log("warn", "Invalid JID in privacy store for user '%s' not migrated: %s", username, tostring(item.value)); | 72 else |
73 else | 73 migrated_data[jid] = true; |
74 migrated_data[jid] = true; | |
75 end | |
76 end | 74 end |
77 end | 75 end |
78 end | 76 end |
79 set_blocklist(username, migrated_data); | 77 set_blocklist(username, migrated_data); |
80 return migrated_data; | 78 return migrated_data; |