Software /
code /
prosody
Comparison
plugins/mod_blocklist.lua @ 6494:5979eaed12c0
mod_blocklist: Only log message about migrating from mod_privacy when there is data to migrate
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 25 Oct 2014 14:45:11 +0200 |
parent | 6460:6d3187f24608 |
child | 6495:44df423f8290 |
comparison
equal
deleted
inserted
replaced
6493:4e51b5e81bdd | 6494:5979eaed12c0 |
---|---|
41 end | 41 end |
42 | 42 |
43 -- Migrates from the old mod_privacy storage | 43 -- Migrates from the old mod_privacy storage |
44 local function migrate_privacy_list(username) | 44 local function migrate_privacy_list(username) |
45 local migrated_data = { [false] = "not empty" }; | 45 local migrated_data = { [false] = "not empty" }; |
46 module:log("info", "Migrating blocklist from mod_privacy storage for user '%s'", username); | |
47 local legacy_data = module:open_store("privacy"):get(username); | 46 local legacy_data = module:open_store("privacy"):get(username); |
48 if legacy_data and legacy_data.lists and legacy_data.default then | 47 if legacy_data and legacy_data.lists and legacy_data.default then |
49 legacy_data = legacy_data.lists[legacy_data.default]; | 48 legacy_data = legacy_data.lists[legacy_data.default]; |
50 legacy_data = legacy_data and legacy_data.items; | 49 legacy_data = legacy_data and legacy_data.items; |
51 else | 50 else |
52 return migrated_data; | 51 return migrated_data; |
53 end | 52 end |
54 if legacy_data then | 53 if legacy_data then |
54 module:log("info", "Migrating blocklist from mod_privacy storage for user '%s'", username); | |
55 local item, jid; | 55 local item, jid; |
56 for i = 1, #legacy_data do | 56 for i = 1, #legacy_data do |
57 item = legacy_data[i]; | 57 item = legacy_data[i]; |
58 if item.type == "jid" and item.action == "deny" then | 58 if item.type == "jid" and item.action == "deny" then |
59 jid = jid_prep(item.value); | 59 jid = jid_prep(item.value); |