Software /
code /
prosody
Changeset
4649:e07ce18c503e
mod_motd: Send only to resource coming online, not the user's bare JID (fixes #282)
author | Matthew Wild <mwild1@gmail.com> |
---|---|
date | Sat, 21 Apr 2012 21:16:53 +0100 |
parents | 4648:561ca78e0dec |
children | 4650:464ca74ddf6a 4656:43469a2d124d |
files | plugins/mod_motd.lua |
diffstat | 1 files changed, 3 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- 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);