Mercurial > prosody-modules
view mod_filter_chatstates/mod_filter_chatstates.lua @ 1770:2c43e81236a3
mod_mam: Fix message hints, it's no-permanent-*storage*, not ..-store
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Thu, 02 Jul 2015 20:20:31 +0200 |
parents | ca48eea4785c |
children | 23b3c8e294d2 |
line wrap: on
line source
local filters = require "util.filters"; local st = require "util.stanza"; module:depends("csi"); local function filter_chatstates(stanza) if stanza.name == "message" then stanza = st.clone(stanza); stanza:maptags(function (tag) if tag.attr.xmlns ~= "http://jabber.org/protocol/chatstates" then return tag end end); if #stanza.tags == 0 then return nil; end end return stanza; end module:hook("csi-client-inactive", function (event) local session = event.origin; filters.add_filter(session, "stanzas/out", filter_chatstates); end); module:hook("csi-client-active", function (event) local session = event.origin; filters.remove_filter(session, "stanzas/out", filter_chatstates); end);