Comparison

plugins/muc/occupant.lib.lua @ 6271:006b0e0f0de2

plugins/muc: Move 'x' filtering from occupant to util
author daurnimator <quae@daurnimator.com>
date Thu, 05 Jun 2014 17:07:14 -0400
parent 6251:41a5e5205fd9
child 7086:6cc7c9da29ed
comparison
equal deleted inserted replaced
6270:ee2d5b2a263d 6271:006b0e0f0de2
1 local next = next; 1 local next = next;
2 local pairs = pairs; 2 local pairs = pairs;
3 local setmetatable = setmetatable; 3 local setmetatable = setmetatable;
4 local st = require "util.stanza"; 4 local st = require "util.stanza";
5 local util = module:require "muc/util";
5 6
6 local get_filtered_presence do 7 local function get_filtered_presence(stanza)
7 local presence_filters = { 8 return util.filter_muc_x(st.clone(stanza));
8 ["http://jabber.org/protocol/muc"] = true;
9 ["http://jabber.org/protocol/muc#user"] = true;
10 }
11 local function presence_filter(tag)
12 if presence_filters[tag.attr.xmlns] then
13 return nil;
14 end
15 return tag;
16 end
17 function get_filtered_presence(stanza)
18 return st.clone(stanza):maptags(presence_filter);
19 end
20 end 9 end
21 10
22 local occupant_mt = {}; 11 local occupant_mt = {};
23 occupant_mt.__index = occupant_mt; 12 occupant_mt.__index = occupant_mt;
24 13