Software /
code /
prosody-modules
Comparison
mod_pubsub_feeds/mod_pubsub_feeds.lua @ 2401:7a1625a84624
mod_pubsub_feeds: Ask for leases that expire after one day (Years after testing this module, I was still subscribed to a GNU Social instance)
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 28 Nov 2016 08:48:23 +0100 |
parent | 2384:feba6439b6fb |
child | 2421:a9add2d1adf5 |
comparison
equal
deleted
inserted
replaced
2400:bd3a1df128a4 | 2401:7a1625a84624 |
---|---|
45 local formdecode = http.formdecode; | 45 local formdecode = http.formdecode; |
46 local formencode = http.formencode; | 46 local formencode = http.formencode; |
47 | 47 |
48 local feed_list = module:shared("feed_list"); | 48 local feed_list = module:shared("feed_list"); |
49 local refresh_interval; | 49 local refresh_interval; |
50 local lease_length = tostring(math.floor(module:get_option_number("feed_lease_length", 86400))); | |
50 | 51 |
51 function module.load() | 52 function module.load() |
52 local config = module:get_option("feeds", { }); | 53 local config = module:get_option("feeds", { }); |
53 refresh_interval = module:get_option_number("feed_pull_interval", 15) * 60; | 54 refresh_interval = module:get_option_number("feed_pull_interval", 15) * 60; |
54 local ok, nodes = pubsub.service:get_nodes(true); | 55 local ok, nodes = pubsub.service:get_nodes(true); |
183 ["hub.callback"] = format_url(feed.node); | 184 ["hub.callback"] = format_url(feed.node); |
184 ["hub.mode"] = want; | 185 ["hub.mode"] = want; |
185 ["hub.topic"] = feed.url; | 186 ["hub.topic"] = feed.url; |
186 ["hub.verify"] = "async"; -- COMPAT this is REQUIRED in the 0.3 draft but removed in 0.4 | 187 ["hub.verify"] = "async"; -- COMPAT this is REQUIRED in the 0.3 draft but removed in 0.4 |
187 ["hub.secret"] = feed.secret; | 188 ["hub.secret"] = feed.secret; |
188 --["hub.lease_seconds"] = ""; | 189 ["hub.lease_seconds"] = lease_length; |
189 }; | 190 }; |
190 | 191 |
191 --module:log("debug", "subscription request, body: %s", body); | 192 --module:log("debug", "subscription request, body: %s", body); |
192 | 193 |
193 --FIXME The subscription states and related stuff | 194 --FIXME The subscription states and related stuff |