plugins/xeps.lua

changeset 32
7e79b03f10e1
parent 27
2c137706d42c
child 34
23e17e64ca25
equal deleted inserted replaced
31:0cafbe17c0aa 32:7e79b03f10e1
1 local parse_xeps, xeps_updated_at; 1 local parse_xeps, xeps_updated_at;
2 local xeps = {}; 2 local xeps = {};
3 3
4 function riddim.plugins.xeps(bot) 4 function riddim.plugins.xeps(bot)
5 bot.stream:add_plugin("http"); 5 require "net.httpclient_listener";
6 local http = verse.http; 6 local http = require("net.http");
7 bot:hook("commands/xep", function(command) 7 bot:hook("commands/xep", function(command)
8 -- Cache XEP list for an hour 8 -- Cache XEP list for an hour
9 if os.difftime(os.time(), xeps_updated_at) > (60 * 60) then -- Not refreshed within 1 hour 9 if os.difftime(os.time(), xeps_updated_at) > (60 * 60) then -- Not refreshed within 1 hour
10 http.request('http://xmpp.org/extensions/xeps.xml', nil, function (data, code) 10 http.request('http://xmpp.org/extensions/xeps.xml', nil, function (data, code)
11 if code ~= 200 then 11 if code ~= 200 then

mercurial