comparison mod_pastebin/mod_pastebin.lua @ 445:66ca5e4d9f7b

mod_pastebin: Update to use module:get_option()
author Matthew Wild <mwild1@gmail.com>
date Fri, 23 Sep 2011 20:08:30 +0100
parents 82ccfba5ac2f
children 56f1c29ee7f1
comparison
equal deleted inserted replaced
444:82ccfba5ac2f 445:66ca5e4d9f7b
19 return seq; 19 return seq;
20 end 20 end
21 21
22 local pastebin_private_messages = module:get_option_boolean("pastebin_private_messages", hosts[module.host].type ~= "component"); 22 local pastebin_private_messages = module:get_option_boolean("pastebin_private_messages", hosts[module.host].type ~= "component");
23 local max_summary_length = module:get_option_number("pastebin_summary_length", 150); 23 local max_summary_length = module:get_option_number("pastebin_summary_length", 150);
24 local length_threshold = config.get(module.host, "core", "pastebin_threshold") or 500; 24 local length_threshold = module:get_option_number("pastebin_threshold", 500);
25 local line_threshold = config.get(module.host, "core", "pastebin_line_threshold") or 4; 25 local line_threshold = module:get_option_number("pastebin_line_threshold", 4);
26 26
27 local base_url = config.get(module.host, "core", "pastebin_url"); 27 local base_url = module:get_option_string("pastebin_url");
28 28
29 -- Seconds a paste should live for in seconds (config is in hours), default 24 hours 29 -- Seconds a paste should live for in seconds (config is in hours), default 24 hours
30 local expire_after = math.floor((config.get(module.host, "core", "pastebin_expire_after") or 24) * 3600); 30 local expire_after = math.floor(module:get_option_number("pastebin_expire_after", 24) * 3600);
31 31
32 local trigger_string = config.get(module.host, "core", "pastebin_trigger"); 32 local trigger_string = module:get_option_string("pastebin_trigger");
33 trigger_string = (trigger_string and trigger_string .. " "); 33 trigger_string = (trigger_string and trigger_string .. " ");
34 34
35 local pastes = {}; 35 local pastes = {};
36 local default_headers = { ["Content-Type"] = "text/plain; charset=utf-8" }; 36 local default_headers = { ["Content-Type"] = "text/plain; charset=utf-8" };
37 37
111 end 111 end
112 end 112 end
113 end 113 end
114 114
115 115
116 local ports = config.get(module.host, "core", "pastebin_ports") or { 5280 }; 116 local ports = module:get_option("pastebin_ports", { 5280 });
117 for _, options in ipairs(ports) do 117 for _, options in ipairs(ports) do
118 local port, base, ssl, interface = 5280, "pastebin", false, nil; 118 local port, base, ssl, interface = 5280, "pastebin", false, nil;
119 if type(options) == "number" then 119 if type(options) == "number" then
120 port = options; 120 port = options;
121 elseif type(options) == "table" then 121 elseif type(options) == "table" then