From da0876f26f4ee0a706e5c5fcc45d469f23aeabc8 Mon Sep 17 00:00:00 2001
From: Kim Alvefur <zash@zash.se>
Date: Sat, 13 Oct 2012 15:21:59 +0200
Subject: mod_motd: Don't trigger on directed presence or stanzas from s2s.

---
 plugins/mod_motd.lua | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

(limited to 'plugins')

diff --git a/plugins/mod_motd.lua b/plugins/mod_motd.lua
index ddde9c78..fea2cb85 100644
--- a/plugins/mod_motd.lua
+++ b/plugins/mod_motd.lua
@@ -20,7 +20,8 @@ motd_text = motd_text:gsub("^%s*(.-)%s*$", "%1"):gsub("\n%s+", "\n"); -- Strip i
 
 module:hook("presence/bare", function (event)
 		local session, stanza = event.origin, event.stanza;
-		if not session.presence and not stanza.attr.type then
+		if session.username and not session.presence
+		and not stanza.attr.type and not stanza.attr.to then
 			local motd_stanza =
 				st.message({ to = session.full_jid, from = motd_jid })
 					:tag("body"):text(motd_text);
-- 
cgit v1.2.3