Software /
code /
prosody
Comparison
plugins/mod_pep.lua @ 12085:1d213c6f781b 0.11
mod_pep: Don't pass pubsub services across reloads
Ensures configuration is refreshed, releases some memory.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 04 Nov 2021 00:33:58 +0100 |
parent | 11566:6e67872bcba4 |
child | 12086:1dc00ca6ee9d |
comparison
equal
deleted
inserted
replaced
12084:59557bc3c4b8 | 12085:1d213c6f781b |
---|---|
34 | 34 |
35 local max_max_items = module:get_option_number("pep_max_items", 256); | 35 local max_max_items = module:get_option_number("pep_max_items", 256); |
36 | 36 |
37 function module.save() | 37 function module.save() |
38 return { | 38 return { |
39 services = services; | |
40 recipients = recipients; | 39 recipients = recipients; |
41 }; | 40 }; |
42 end | 41 end |
43 | 42 |
44 function module.restore(data) | 43 function module.restore(data) |
45 services = data.services; | |
46 recipients = data.recipients; | 44 recipients = data.recipients; |
47 for username, service in pairs(services) do | |
48 local user_bare = jid_join(username, host); | |
49 module:add_item("pep-service", { service = service, jid = user_bare }); | |
50 end | |
51 end | 45 end |
52 | 46 |
53 function is_item_stanza(item) | 47 function is_item_stanza(item) |
54 return st.is_stanza(item) and item.attr.xmlns == xmlns_pubsub and item.name == "item" and #item.tags == 1; | 48 return st.is_stanza(item) and item.attr.xmlns == xmlns_pubsub and item.name == "item" and #item.tags == 1; |
55 end | 49 end |