From bd65d4b2a15b57bd65f1167261825325d0917708 Mon Sep 17 00:00:00 2001 From: daurnimator Date: Wed, 19 Mar 2014 14:06:04 -0400 Subject: plugins/muc/muc.lib: Tidy up `get_filtered_presence` --- plugins/muc/muc.lib.lua | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/plugins/muc/muc.lib.lua b/plugins/muc/muc.lib.lua index 2d45f17e..2fb1a34e 100644 --- a/plugins/muc/muc.lib.lua +++ b/plugins/muc/muc.lib.lua @@ -27,15 +27,20 @@ local md5 = require "util.hashes".md5; local default_history_length, max_history_length = 20, math.huge; -local presence_filters = {["http://jabber.org/protocol/muc"]=true;["http://jabber.org/protocol/muc#user"]=true}; -local function presence_filter(tag) - if presence_filters[tag.attr.xmlns] then - return nil; +local get_filtered_presence do + local presence_filters = { + ["http://jabber.org/protocol/muc"] = true; + ["http://jabber.org/protocol/muc#user"] = true; + } + local function presence_filter(tag) + if presence_filters[tag.attr.xmlns] then + return nil; + end + return tag; + end + function get_filtered_presence(stanza) + return st.clone(stanza):maptags(presence_filter); end - return tag; -end -local function get_filtered_presence(stanza) - return st.clone(stanza):maptags(presence_filter); end local is_kickable_error do -- cgit v1.2.3