From 615325cf153e6ebb5f07bb92545bfcedf1c2266b Mon Sep 17 00:00:00 2001 From: Matthew Wild Date: Sat, 21 Apr 2012 21:16:53 +0100 Subject: mod_motd: Send only to resource coming online, not the user's bare JID (fixes #282) --- plugins/mod_motd.lua | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'plugins') diff --git a/plugins/mod_motd.lua b/plugins/mod_motd.lua index d567288b..646bf8cd 100644 --- a/plugins/mod_motd.lua +++ b/plugins/mod_motd.lua @@ -13,15 +13,15 @@ local motd_jid = module:get_option_string("motd_jid", host); if not motd_text then return; end +local jid_join = require "util.jid".join; local st = require "util.stanza"; motd_text = motd_text:gsub("^%s*(.-)%s*$", "%1"):gsub("\n%s+", "\n"); -- Strip indentation from the config -module:hook("resource-bind", - function (event) +module:hook("resource-bind", function (event) local session = event.session; local motd_stanza = - st.message({ to = session.username..'@'..session.host, from = motd_jid }) + st.message({ to = jid_join(session.username, session.host, session.resource), from = motd_jid }) :tag("body"):text(motd_text); core_route_stanza(hosts[host], motd_stanza); module:log("debug", "MOTD send to user %s@%s", session.username, session.host); -- cgit v1.2.3