mod_pastebin/mod_pastebin.lua
changeset 3036 0f2dd6397569
parent 3035 040eaa3844f4
child 3037 b2b129f699ed
equal deleted inserted replaced
3035:040eaa3844f4 3036:0f2dd6397569
     1 
     1 
     2 local st = require "util.stanza";
     2 local st = require "util.stanza";
     3 module:depends("http");
     3 module:depends("http");
     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_remove = 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;
     9 local muc_rooms;
    10 local is_component = module:get_host_type() == "component";
    10 local is_component = module:get_host_type() == "component";
    11 if is_component then
    11 if is_component then
    90 end
    90 end
    91 
    91 
    92 local line_count_pattern = string.rep("[^\n]\n", line_threshold):sub(1, -2);
    92 local line_count_pattern = string.rep("[^\n]\n", line_threshold):sub(1, -2);
    93 
    93 
    94 function check_message(data)
    94 function check_message(data)
    95 	local origin, stanza = data.origin, data.stanza;
    95 	local stanza = data.stanza;
    96 
    96 
    97 	-- Only check for MUC presence when loaded on a component.
    97 	-- Only check for MUC presence when loaded on a component.
    98 	if is_component then
    98 	if is_component then
    99 		local room = muc_rooms[jid_bare(stanza.attr.to)];
    99 		local room = muc_rooms[jid_bare(stanza.attr.to)];
   100 		if not room then return; end
   100 		if not room then return; end