Mercurial > prosody-modules
diff mod_filter_chatstates/mod_filter_chatstates.lua @ 1866:58d96960ba8b
mod_filter_chatstates: Break out maptags filter into a stateless function
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 21 Sep 2015 23:44:55 +0200 |
parents | 23b3c8e294d2 |
children | d6e673f98572 |
line wrap: on
line diff
--- a/mod_filter_chatstates/mod_filter_chatstates.lua Mon Sep 21 20:03:08 2015 +0200 +++ b/mod_filter_chatstates/mod_filter_chatstates.lua Mon Sep 21 23:44:55 2015 +0200 @@ -3,14 +3,16 @@ module:depends("csi"); +local function chatstate_tag_filter(tag) + if tag.attr.xmlns ~= "http://jabber.org/protocol/chatstates" then + return tag; + end +end + 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); + stanza:maptags(chatstate_tag_filter); if #stanza.tags == 0 then return ""; end