changeset 12:316e8437f233

mod_pastebin: Allow configurable message length threshold
author Matthew Wild <mwild1@gmail.com>
date Fri, 25 Sep 2009 21:54:16 +0100
parents 7d70faba234c
children 135855b685d6
files mod_pastebin/mod_pastebin.lua
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
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]));