Comparison

plugins/muc/muc.lib.lua @ 6116:9147e566fde0

plugins/muc/muc.lib: Tidy up `get_filtered_presence`
author daurnimator <quae@daurnimator.com>
date Wed, 19 Mar 2014 14:06:04 -0400
parent 6115:b8b68d09c9d8
child 6117:d7ade0b00ec5
comparison
equal deleted inserted replaced
6115:b8b68d09c9d8 6116:9147e566fde0
25 local base64 = require "util.encodings".base64; 25 local base64 = require "util.encodings".base64;
26 local md5 = require "util.hashes".md5; 26 local md5 = require "util.hashes".md5;
27 27
28 local default_history_length, max_history_length = 20, math.huge; 28 local default_history_length, max_history_length = 20, math.huge;
29 29
30 local presence_filters = {["http://jabber.org/protocol/muc"]=true;["http://jabber.org/protocol/muc#user"]=true}; 30 local get_filtered_presence do
31 local function presence_filter(tag) 31 local presence_filters = {
32 if presence_filters[tag.attr.xmlns] then 32 ["http://jabber.org/protocol/muc"] = true;
33 return nil; 33 ["http://jabber.org/protocol/muc#user"] = true;
34 end 34 }
35 return tag; 35 local function presence_filter(tag)
36 end 36 if presence_filters[tag.attr.xmlns] then
37 local function get_filtered_presence(stanza) 37 return nil;
38 return st.clone(stanza):maptags(presence_filter); 38 end
39 return tag;
40 end
41 function get_filtered_presence(stanza)
42 return st.clone(stanza):maptags(presence_filter);
43 end
39 end 44 end
40 45
41 local is_kickable_error do 46 local is_kickable_error do
42 local kickable_error_conditions = { 47 local kickable_error_conditions = {
43 ["gone"] = true; 48 ["gone"] = true;