Diff

mod_pastebin/mod_pastebin.lua @ 12:316e8437f233

mod_pastebin: Allow configurable message length threshold
author Matthew Wild <mwild1@gmail.com>
date Fri, 25 Sep 2009 21:54:16 +0100
parent 5:9c1c6c5344dc
child 13:135855b685d6
line wrap: on
line diff
--- a/mod_pastebin/mod_pastebin.lua	Fri Sep 25 21:50:01 2009 +0200
+++ b/mod_pastebin/mod_pastebin.lua	Fri Sep 25 21:54:16 2009 +0100
@@ -2,8 +2,9 @@
 local st = require "util.stanza";
 local httpserver = require "net.httpserver";
 local uuid_new = require "util.uuid".generate;
+local os_time = os.time;
 
-local os_time = os.time;
+local length_threshold = config.get("*", "core", "pastebin_threshold");
 
 local base_url;
 
@@ -46,7 +47,7 @@
 	
 	module:log("debug", "Body(%s) length: %d", type(body), #(body or ""));
 	
-	if body and #body > 500 then
+	if body and #body > length_threshold then
 		local url = pastebin_message(body);
 		module:log("debug", "Pasted message as %s", url);		
 		--module:log("debug", " stanza[bodyindex] = %q", tostring( stanza[bodyindex]));