Software /
code /
prosody
Comparison
plugins/mod_motd.lua @ 5169:ed2d64fb7301
mod_motd: Don't trigger on directed presence or stanzas from s2s.
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Sat, 13 Oct 2012 15:21:59 +0200 |
parent | 5014:b2006c1cfa85 |
child | 5371:706206e191e8 |
comparison
equal
deleted
inserted
replaced
5168:46fc0eff10b4 | 5169:ed2d64fb7301 |
---|---|
18 | 18 |
19 motd_text = motd_text:gsub("^%s*(.-)%s*$", "%1"):gsub("\n%s+", "\n"); -- Strip indentation from the config | 19 motd_text = motd_text:gsub("^%s*(.-)%s*$", "%1"):gsub("\n%s+", "\n"); -- Strip indentation from the config |
20 | 20 |
21 module:hook("presence/bare", function (event) | 21 module:hook("presence/bare", function (event) |
22 local session, stanza = event.origin, event.stanza; | 22 local session, stanza = event.origin, event.stanza; |
23 if not session.presence and not stanza.attr.type then | 23 if session.username and not session.presence |
24 and not stanza.attr.type and not stanza.attr.to then | |
24 local motd_stanza = | 25 local motd_stanza = |
25 st.message({ to = session.full_jid, from = motd_jid }) | 26 st.message({ to = session.full_jid, from = motd_jid }) |
26 :tag("body"):text(motd_text); | 27 :tag("body"):text(motd_text); |
27 module:send(motd_stanza); | 28 module:send(motd_stanza); |
28 module:log("debug", "MOTD send to user %s", session.full_jid); | 29 module:log("debug", "MOTD send to user %s", session.full_jid); |