Comparison

plugins/muc/muc.lib.lua @ 6114:055efbb6d10c

plugins/muc/muc.lib: Use module.host where `muc_domain` was previously
author daurnimator <quae@daurnimator.com>
date Wed, 19 Mar 2014 13:57:02 -0400
parent 6113:f535f7de44b6
child 6115:b8b68d09c9d8
comparison
equal deleted inserted replaced
6113:f535f7de44b6 6114:055efbb6d10c
23 local t_insert, t_remove = table.insert, table.remove; 23 local t_insert, t_remove = table.insert, table.remove;
24 local setmetatable = setmetatable; 24 local setmetatable = setmetatable;
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 muc_domain = nil; --module:get_host();
29 local default_history_length, max_history_length = 20, math.huge; 28 local default_history_length, max_history_length = 20, math.huge;
30 29
31 ------------ 30 ------------
32 local presence_filters = {["http://jabber.org/protocol/muc"]=true;["http://jabber.org/protocol/muc#user"]=true}; 31 local presence_filters = {["http://jabber.org/protocol/muc"]=true;["http://jabber.org/protocol/muc#user"]=true};
33 local function presence_filter(tag) 32 local function presence_filter(tag)
116 local history = self._data['history']; 115 local history = self._data['history'];
117 if not history then history = {}; self._data['history'] = history; end 116 if not history then history = {}; self._data['history'] = history; end
118 stanza = st.clone(stanza); 117 stanza = st.clone(stanza);
119 stanza.attr.to = ""; 118 stanza.attr.to = "";
120 local stamp = datetime.datetime(); 119 local stamp = datetime.datetime();
121 stanza:tag("delay", {xmlns = "urn:xmpp:delay", from = muc_domain, stamp = stamp}):up(); -- XEP-0203 120 stanza:tag("delay", {xmlns = "urn:xmpp:delay", from = module.host, stamp = stamp}):up(); -- XEP-0203
122 stanza:tag("x", {xmlns = "jabber:x:delay", from = muc_domain, stamp = datetime.legacy()}):up(); -- XEP-0091 (deprecated) 121 stanza:tag("x", {xmlns = "jabber:x:delay", from = module.host, stamp = datetime.legacy()}):up(); -- XEP-0091 (deprecated)
123 local entry = { stanza = stanza, stamp = stamp }; 122 local entry = { stanza = stanza, stamp = stamp };
124 t_insert(history, entry); 123 t_insert(history, entry);
125 while #history > (self._data.history_length or default_history_length) do t_remove(history, 1) end 124 while #history > (self._data.history_length or default_history_length) do t_remove(history, 1) end
126 end 125 end
127 function room_mt:broadcast_except_nick(stanza, nick) 126 function room_mt:broadcast_except_nick(stanza, nick)