Software /
code /
prosody-modules
Changeset
26:1fb5b8c20004
mod_swedishchef: Added configurable trigger
author | Florian Zeitz <florob@babelmonkeys.de> |
---|---|
date | Tue, 06 Oct 2009 22:00:05 +0200 |
parents | 25:ea59a8d98b03 |
children | 27:d91cb13ef0ee 28:b9d063dd16d5 |
files | mod_swedishchef/mod_swedishchef.lua |
diffstat | 1 files changed, 6 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- 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