Comparison

plugins/mod_welcome.lua @ 8160:5566f82ffea4

mod_welcome: Return the pointer to the root of the stanza, fixes a bug similar to #922.
author Emmanuel Gil Peyrot <linkmauve@linkmauve.fr>
date Tue, 30 May 2017 20:52:22 +0100
parent 5014:b2006c1cfa85
child 8161:31938a0c398f
comparison
equal deleted inserted replaced
8155:f0d847316723 8160:5566f82ffea4
12 local st = require "util.stanza"; 12 local st = require "util.stanza";
13 13
14 module:hook("user-registered", 14 module:hook("user-registered",
15 function (user) 15 function (user)
16 local welcome_stanza = 16 local welcome_stanza =
17 st.message({ to = user.username.."@"..user.host, from = host }) 17 st.message({ to = user.username.."@"..user.host, from = host },
18 :tag("body"):text(welcome_text:gsub("$(%w+)", user)); 18 welcome_text:gsub("$(%w+)", user));
19 module:send(welcome_stanza); 19 module:send(welcome_stanza);
20 module:log("debug", "Welcomed user %s@%s", user.username, user.host); 20 module:log("debug", "Welcomed user %s@%s", user.username, user.host);
21 end); 21 end);