# HG changeset patch # User Matthew Wild # Date 1335039413 -3600 # Node ID e07ce18c503e9b88566c63bb6167250633321d7a # Parent 561ca78e0dec5c3e6d4216e251b08359fe1b0c08 mod_motd: Send only to resource coming online, not the user's bare JID (fixes #282) diff -r 561ca78e0dec -r e07ce18c503e plugins/mod_motd.lua --- a/plugins/mod_motd.lua Sat Apr 21 21:03:57 2012 +0100 +++ b/plugins/mod_motd.lua Sat Apr 21 21:16:53 2012 +0100 @@ -13,15 +13,15 @@ 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);