Mercurial > prosody-modules
diff mod_swedishchef/mod_swedishchef.lua @ 1343:7dbde05b48a9
all the things: Remove trailing whitespace
author | Florian Zeitz <florob@babelmonkeys.de> |
---|---|
date | Tue, 11 Mar 2014 18:44:01 +0100 |
parents | 93ef813dfd06 |
children | 2615facc461b |
line wrap: on
line diff
--- a/mod_swedishchef/mod_swedishchef.lua Mon Mar 10 08:22:58 2014 +0000 +++ b/mod_swedishchef/mod_swedishchef.lua Tue Mar 11 18:44:01 2014 +0100 @@ -1,6 +1,6 @@ -- Copyright (C) 2009 Florian Zeitz -- Copyright (C) 2009 Matthew Wild --- +-- -- This project is MIT/X11 licensed. Please see the -- COPYING file in the source package for more information. -- @@ -8,8 +8,8 @@ local trigger_string = module:get_option_string("swedishchef_trigger"); trigger_string = (trigger_string and trigger_string .. " ") or ""; -local chef = { - { th = "t" }, +local chef = { + { th = "t" }, { ow = "o"}, {["([^%w])o"] = "%1oo", @@ -29,11 +29,11 @@ {a = "e", A = "E"}, {["e([^%w])"] = "e-a%1"}, - {f = "ff"}, + {f = "ff"}, {v = "f", V = "F"}, {w = "v", W = "V"} }; - + function swedish(english) local eng, url = english:match("(.*)(http://.*)$"); if eng then english = eng; end @@ -52,17 +52,17 @@ function check_message(data) local origin, stanza = data.origin, data.stanza; - + local body, bodyindex; for k,v in ipairs(stanza) do if v.name == "body" then body, bodyindex = v, k; end end - + if not body then return; end body = body:get_text(); - + 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));