|
1 -- Prosody IM v0.4 |
|
2 -- Copyright (C) 2008-2009 Matthew Wild |
|
3 -- Copyright (C) 2008-2009 Waqas Hussain |
|
4 -- |
|
5 -- This project is MIT/X11 licensed. Please see the |
|
6 -- COPYING file in the source package for more information. |
|
7 -- |
|
8 |
|
9 local config = require "core.configmanager"; |
|
10 |
|
11 local host = module:get_host(); |
|
12 local welcome_text = config.get("*", "core", "welcome_message") or "Hello $user, welcome to the $host IM server!"; |
|
13 |
|
14 local st = require "util.stanza"; |
|
15 |
|
16 module:add_event_hook("user-registered", |
|
17 function (user) |
|
18 local welcome_stanza = |
|
19 st.message({ to = user.username.."@"..user.host, from = host }) |
|
20 :tag("body"):text(welcome_text:gsub("$(%w+)", user)); |
|
21 core_route_stanza(hosts[host], welcome_stanza); |
|
22 module:log("debug", "Welcomed user %s@%s", user.username, user.host); |
|
23 end); |