# HG changeset patch # User Florian Zeitz # Date 1254859205 -7200 # Node ID 1fb5b8c2000401a97b4bcc03434512b13ec7f97c # Parent ea59a8d98b034998e01d366a8e1210a6ee30acf1 mod_swedishchef: Added configurable trigger diff -r ea59a8d98b03 -r 1fb5b8c20004 mod_swedishchef/mod_swedishchef.lua --- a/mod_swedishchef/mod_swedishchef.lua Fri Oct 02 22:16:19 2009 +0100 +++ b/mod_swedishchef/mod_swedishchef.lua Tue Oct 06 22:00:05 2009 +0200 @@ -6,6 +6,9 @@ -- local st = require "util.stanza"; +local trigger_string = config.get(module.host, "core", "swedishchef_trigger"); +trigger_string = (trigger_string and trigger_string .. " ") or ""; + local chef = { { th = "t" }, @@ -61,8 +64,9 @@ if not body then return; end body = body:get_text(); - if body then - stanza[bodyindex][1] = swedish(body); + if body and (body:find(trigger_string, 1, true) == 1) then + module:log("debug", body:find(trigger_string, 1, true)); + stanza[bodyindex][1] = swedish(body:gsub("^" .. trigger_string, "", 1)); end end