X-Git-Url: https://git.enpas.org/?a=blobdiff_plain;f=plugins%2Fmod_welcome.lua;h=d74643de174ca4ff46fec5fe1ec51977f3148b28;hb=a90f9bdc907fa6fc61e6ad066b370e03790bfbf3;hp=8f92010a013d7279bac927f178f4651ce0901820;hpb=416b600dd4475c7862070514895eb9314789d5e2;p=prosody.git diff --git a/plugins/mod_welcome.lua b/plugins/mod_welcome.lua index 8f92010a..d74643de 100644 --- a/plugins/mod_welcome.lua +++ b/plugins/mod_welcome.lua @@ -1,21 +1,21 @@ -- Prosody IM -- Copyright (C) 2008-2010 Matthew Wild -- Copyright (C) 2008-2010 Waqas Hussain --- +-- -- This project is MIT/X11 licensed. Please see the -- COPYING file in the source package for more information. -- local host = module:get_host(); -local welcome_text = module:get_option("welcome_message") or "Hello $username, welcome to the $host IM server!"; +local welcome_text = module:get_option_string("welcome_message", "Hello $username, welcome to the $host IM server!"); local st = require "util.stanza"; -module:hook("user-registered", +module:hook("user-registered", function (user) - local welcome_stanza = + local welcome_stanza = st.message({ to = user.username.."@"..user.host, from = host }) :tag("body"):text(welcome_text:gsub("$(%w+)", user)); - core_route_stanza(hosts[host], welcome_stanza); + module:send(welcome_stanza); module:log("debug", "Welcomed user %s@%s", user.username, user.host); end);