Merge 0.10->trunk
[prosody.git] / plugins / mod_welcome.lua
index 8f9cca2ab2ce4a4315413e5203ca0a7b19ea1378..d74643de174ca4ff46fec5fe1ec51977f3148b28 100644 (file)
@@ -1,13 +1,13 @@
 -- 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";
 
@@ -16,6 +16,6 @@ module:hook("user-registered",
                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);