comparison mod_pastebin/mod_pastebin.lua @ 3008:26fe44c68791

mod_pastebin: Fix loading on normal hosts (thanks ppmathis)
author Kim Alvefur <zash@zash.se>
date Tue, 01 May 2018 01:59:14 +0200
parents 314cebb3071e
children ce34cbc10b5b
comparison
equal deleted inserted replaced
3007:af1b3cef52e1 3008:26fe44c68791
4 local uuid_new = require "util.uuid".generate; 4 local uuid_new = require "util.uuid".generate;
5 local os_time = os.time; 5 local os_time = os.time;
6 local t_insert, t_remove = table.insert, table.remove; 6 local t_insert, t_remove = table.insert, table.remove;
7 local add_task = require "util.timer".add_task; 7 local add_task = require "util.timer".add_task;
8 local jid_bare = require "util.jid".bare; 8 local jid_bare = require "util.jid".bare;
9 local muc_rooms = module:depends "muc".rooms; 9 local muc_rooms;
10 if module:get_host_type() == "component" then
11 muc_rooms = module:depends "muc".rooms;
12 end
10 13
11 local utf8_pattern = "[\194-\244][\128-\191]*$"; 14 local utf8_pattern = "[\194-\244][\128-\191]*$";
12 local function drop_invalid_utf8(seq) 15 local function drop_invalid_utf8(seq)
13 local start = seq:byte(); 16 local start = seq:byte();
14 module:log("debug", "utf8: %d, %d", start, #seq); 17 module:log("debug", "utf8: %d, %d", start, #seq);