Comparison

mod_pubsub_feeds/mod_pubsub_feeds.lua @ 794:5a8fa70faa13

mod_pubsub_feeds: Remove config-reloaded hook, do setup in module.load() instead
author Kim Alvefur <zash@zash.se>
date Wed, 15 Aug 2012 16:47:06 +0200
parent 793:9fd30261b0e1
child 795:c7f507a190a0
comparison
equal deleted inserted replaced
793:9fd30261b0e1 794:5a8fa70faa13
39 local urlencode = http.urlencode; 39 local urlencode = http.urlencode;
40 40
41 local feed_list = module:shared("feed_list"); 41 local feed_list = module:shared("feed_list");
42 local refresh_interval; 42 local refresh_interval;
43 43
44 -- Dynamically reloadable config. 44 function module.load()
45 local function update_config()
46 local config = module:get_option("feeds") or { 45 local config = module:get_option("feeds") or {
47 planet_jabber = "http://planet.jabber.org/atom.xml"; 46 planet_jabber = "http://planet.jabber.org/atom.xml";
48 prosody_blog = "http://blog.prosody.im/feed/atom.xml"; 47 prosody_blog = "http://blog.prosody.im/feed/atom.xml";
49 }; 48 };
50 refresh_interval = module:get_option_number("feed_pull_interval", 15) * 60; 49 refresh_interval = module:get_option_number("feed_pull_interval", 15) * 60;
64 if not new_feed_list[node] then 63 if not new_feed_list[node] then
65 feed_list[node] = nil; 64 feed_list[node] = nil;
66 end 65 end
67 end 66 end
68 end 67 end
69 update_config();
70 module:hook_global("config-reloaded", update_config);
71 68
72 function update_entry(item) 69 function update_entry(item)
73 local node = item.node; 70 local node = item.node;
74 module:log("debug", "parsing %d bytes of data in node %s", #item.data or 0, node) 71 module:log("debug", "parsing %d bytes of data in node %s", #item.data or 0, node)
75 local feed = parse_feed(item.data); 72 local feed = parse_feed(item.data);