# HG changeset patch
# User Kim Alvefur <zash@zash.se>
# Date 1545967410 -3600
# Node ID aed47ebd26d3af62902987f8ed39c6ee7ecf8216
# Parent  9be9dd434813013b0426fda005a80c2f001b6e99
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.

diff -r 9be9dd434813 -r aed47ebd26d3 mod_ignore_host_chatstates/mod_ignore_host_chatstates.lua
--- /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);