comparison mod_pubsub_feeds/mod_pubsub_feeds.lua @ 2134:bd7744df0b4a

mod_pubsub_feeds: Remove unused imports [luacheck]
author Kim Alvefur <zash@zash.se>
date Sun, 20 Mar 2016 12:38:22 +0100
parents b149ea428b81
children 0fe725b50f77
comparison
equal deleted inserted replaced
2133:85762420a2c0 2134:bd7744df0b4a
42 end 42 end
43 43
44 local http = require "net.http"; 44 local http = require "net.http";
45 local formdecode = http.formdecode; 45 local formdecode = http.formdecode;
46 local formencode = http.formencode; 46 local formencode = http.formencode;
47 local urldecode = http.urldecode;
48 local urlencode = http.urlencode;
49 47
50 local feed_list = module:shared("feed_list"); 48 local feed_list = module:shared("feed_list");
51 local refresh_interval; 49 local refresh_interval;
52 50
53 function module.load() 51 function module.load()
154 end); 152 end);
155 end 153 end
156 154
157 function refresh_feeds(now) 155 function refresh_feeds(now)
158 --module:log("debug", "Refreshing feeds"); 156 --module:log("debug", "Refreshing feeds");
159 for node, item in pairs(feed_list) do 157 for _, item in pairs(feed_list) do
160 if item.subscription ~= "subscribe" and item.last_update + refresh_interval < now then 158 if item.subscription ~= "subscribe" and item.last_update + refresh_interval < now then
161 --module:log("debug", "checking %s", item.node); 159 --module:log("debug", "checking %s", item.node);
162 fetch(item, update_entry); 160 fetch(item, update_entry);
163 end 161 end
164 end 162 end
165 return refresh_interval; 163 return refresh_interval;
166 end 164 end
167 165
168 local function format_url(node) 166 local function format_url(node)
169 return module:http_url(nil, "/callback") .. "?node=" .. urlencode(node); 167 return module:http_url(nil, "/callback") .. "?" .. formencode({ node = node });
170 end 168 end
171 169
172 function subscribe(feed, want) 170 function subscribe(feed, want)
173 want = want or "subscribe"; 171 want = want or "subscribe";
174 feed.secret = feed.secret or uuid(); 172 feed.secret = feed.secret or uuid();