changeset 3419:aed47ebd26d3

mod_ignore_host_chatstates: Discard chat state messages sent to a bare host Prevents annoying error replies to be sent in reply to such empty chat state messages. Useful in combination with modules that handle messages to a host.
author Kim Alvefur <zash@zash.se>
date Fri, 28 Dec 2018 04:23:30 +0100
parents 9be9dd434813
children 74239c09a467
files mod_ignore_host_chatstates/mod_ignore_host_chatstates.lua
diffstat 1 files changed, 6 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/mod_ignore_host_chatstates/mod_ignore_host_chatstates.lua	Fri Dec 28 04:23:30 2018 +0100
@@ -0,0 +1,6 @@
+module:hook("message/host", function (event)
+	local stanza = event.stanza;
+	if #stanza.tags == 1 and stanza.tags[1].attr.xmlns == "http://jabber.org/protocol/chatstates" then
+		return true;
+	end
+end, -10);