X-Git-Url: https://git.enpas.org/?a=blobdiff_plain;f=plugins%2Fmod_welcome.lua;h=9c0c821b582b6b771c37f6a1672c8b17aad5f681;hb=0ee742019c5a7a86de6fbaf98db2c737c5ce41a9;hp=491acb8f932970616d670c07987872280dd59526;hpb=14b07e19c6db6eefe35fac05b1772e7ee9a74436;p=prosody.git diff --git a/plugins/mod_welcome.lua b/plugins/mod_welcome.lua index 491acb8f..9c0c821b 100644 --- a/plugins/mod_welcome.lua +++ b/plugins/mod_welcome.lua @@ -1,23 +1,21 @@ --- Prosody IM v0.4 --- Copyright (C) 2008-2009 Matthew Wild --- Copyright (C) 2008-2009 Waqas Hussain --- +-- 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 config = require "core.configmanager"; - local host = module:get_host(); -local welcome_text = config.get("*", "core", "welcome_message") or "Hello $user, welcome to the $host IM server!"; +local welcome_text = module:get_option("welcome_message") or "Hello $username, welcome to the $host IM server!"; local st = require "util.stanza"; -module:add_event_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);