Changeset

8135:e20c27e04ecc

mod_motd: Use initial presence event (saves some checking)
author Kim Alvefur <zash@zash.se>
date Thu, 27 Apr 2017 10:17:54 +0200
parents 8134:b87e281a7d59
children 8136:aba6d148e674
files plugins/mod_motd.lua
diffstat 1 files changed, 2 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/plugins/mod_motd.lua	Wed Apr 26 16:54:58 2017 +0200
+++ b/plugins/mod_motd.lua	Thu Apr 27 10:17:54 2017 +0200
@@ -17,10 +17,9 @@
 
 motd_text = motd_text:gsub("^%s*(.-)%s*$", "%1"):gsub("\n[ \t]+", "\n"); -- Strip indentation from the config
 
-module:hook("presence/bare", function (event)
+module:hook("presence/initial", function (event)
 		local session, stanza = event.origin, event.stanza;
-		if session.username and not session.presence
-		and not stanza.attr.type and not stanza.attr.to then
+		if 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);