Merge 0.7->0.8
[prosody.git] / plugins / mod_welcome.lua
index 491acb8f932970616d670c07987872280dd59526..8f9cca2ab2ce4a4315413e5203ca0a7b19ea1378 100644 (file)
@@ -1,21 +1,19 @@
--- 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);