comparison mod_mam_muc/mod_mam_muc.lua @ 1385:da9469e68dee

mod_mam_muc: Place stanza type in 'with' column; when sending history, only send messages with type=groupchat
author daurnimator <quae@daurnimator.com>
date Tue, 15 Apr 2014 14:22:18 -0400
parents ba17268490b7
children 18f5f1b13353
comparison
equal deleted inserted replaced
1384:f67eacb1ac9f 1385:da9469e68dee
220 -- Load all the data! 220 -- Load all the data!
221 local data, err = archive:find(jid_split(self.jid), { 221 local data, err = archive:find(jid_split(self.jid), {
222 limit = m_min(maxstanzas or 20, max_history_length); 222 limit = m_min(maxstanzas or 20, max_history_length);
223 after = since; 223 after = since;
224 reverse = true; 224 reverse = true;
225 with = "message<groupchat";
225 }); 226 });
226 227
227 if not data then 228 if not data then
228 module:log("error", "Could not fetch history: %s", tostring(err)); 229 module:log("error", "Could not fetch history: %s", tostring(err));
229 return 230 return
257 or (self._data.logging == nil and log_by_default == true) 258 or (self._data.logging == nil and log_by_default == true)
258 or self._data.logging ) then return end -- Don't log 259 or self._data.logging ) then return end -- Don't log
259 260
260 module:log("debug", "We're logging this") 261 module:log("debug", "We're logging this")
261 -- And stash it 262 -- And stash it
262 local ok, id = archive:append(room, time_now(), "", stanza); 263 local with = stanza.name
264 if stanza.attr.type then
265 with = with .. "<" .. stanza.attr.type
266 end
267 local ok, id = archive:append(room, nil, time_now(), with, stanza);
263 if ok and advertise_archive then 268 if ok and advertise_archive then
264 stanza:tag("archived", { xmlns = xmlns_mam, by = jid_bare(orig_to), id = id }):up(); 269 stanza:tag("archived", { xmlns = xmlns_mam, by = jid_bare(orig_to), id = id }):up();
265 end 270 end
266 end 271 end
267 272