Mercurial > prosody-modules
comparison mod_blocking/mod_blocking.lua @ 1215:1b55d8f86644
mod_blocking: Make sure that there is a lists item in the privacy store
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 28 Oct 2013 11:10:02 +0100 |
parents | 80ede103d7a3 |
children | 1e9a06caa866 |
comparison
equal
deleted
inserted
replaced
1214:a234ad611633 | 1215:1b55d8f86644 |
---|---|
7 | 7 |
8 -- Add JID to default privacy list | 8 -- Add JID to default privacy list |
9 function add_blocked_jid(username, host, jid) | 9 function add_blocked_jid(username, host, jid) |
10 local privacy_lists = datamanager.load(username, host, "privacy") or {lists = {}}; | 10 local privacy_lists = datamanager.load(username, host, "privacy") or {lists = {}}; |
11 local default_list_name = privacy_lists.default; | 11 local default_list_name = privacy_lists.default; |
12 if not privacy_lists.lists then | |
13 privacy_lists.lists = {} | |
14 end | |
12 if not default_list_name then | 15 if not default_list_name then |
13 default_list_name = "blocklist"; | 16 default_list_name = "blocklist"; |
14 privacy_lists.default = default_list_name; | 17 privacy_lists.default = default_list_name; |
15 end | 18 end |
16 local default_list = privacy_lists.lists[default_list_name]; | 19 local default_list = privacy_lists.lists[default_list_name]; |