Software /
code /
prosody
Comparison
plugins/mod_muc_mam.lua @ 9845:774b2ce62318
Merge 0.11->trunk
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 04 Mar 2019 13:46:09 +0100 |
parent | 9844:3de80fc511ab |
parent | 9843:17060708d0eb |
child | 9872:e1d68f32ce29 |
comparison
equal
deleted
inserted
replaced
9844:3de80fc511ab | 9845:774b2ce62318 |
---|---|
211 end); | 211 end); |
212 end | 212 end |
213 if not is_stanza(item) then | 213 if not is_stanza(item) then |
214 item = st.deserialize(item); | 214 item = st.deserialize(item); |
215 end | 215 end |
216 item.attr.to = nil; | |
216 item.attr.xmlns = "jabber:client"; | 217 item.attr.xmlns = "jabber:client"; |
217 fwd_st:add_child(item); | 218 fwd_st:add_child(item); |
218 | 219 |
219 if not first then first = id; end | 220 if not first then first = id; end |
220 last = id; | 221 last = id; |
332 | 333 |
333 local stored_stanza = stanza; | 334 local stored_stanza = stanza; |
334 | 335 |
335 if stanza.name == "message" and self:get_whois() == "anyone" then | 336 if stanza.name == "message" and self:get_whois() == "anyone" then |
336 stored_stanza = st.clone(stanza); | 337 stored_stanza = st.clone(stanza); |
338 stored_stanza.attr.to = nil; | |
337 local actor = jid_bare(self._occupants[stanza.attr.from].jid); | 339 local actor = jid_bare(self._occupants[stanza.attr.from].jid); |
338 local affiliation = self:get_affiliation(actor) or "none"; | 340 local affiliation = self:get_affiliation(actor) or "none"; |
339 local role = self:get_role(actor) or self:get_default_role(affiliation); | 341 local role = self:get_role(actor) or self:get_default_role(affiliation); |
340 stored_stanza:add_direct_child(st.stanza("x", { xmlns = xmlns_muc_user }) | 342 stored_stanza:add_direct_child(st.stanza("x", { xmlns = xmlns_muc_user }) |
341 :tag("item", { affiliation = affiliation; role = role; jid = actor })); | 343 :tag("item", { affiliation = affiliation; role = role; jid = actor })); |
342 end | 344 end |
343 | 345 |
344 -- Policy check | 346 -- Policy check |
345 if not archiving_enabled(self) then return end -- Don't log | 347 if not archiving_enabled(self) then return end -- Don't log |
346 | 348 |
347 -- And stash it | 349 -- Save the type in the 'with' field, allows storing presence without conflicts |
348 local with = stanza.name | 350 local with = stanza.name |
349 if stanza.attr.type then | 351 if stanza.attr.type then |
350 with = with .. "<" .. stanza.attr.type | 352 with = with .. "<" .. stanza.attr.type |
351 end | 353 end |
352 | 354 |
355 -- And stash it | |
353 local id = archive:append(room_node, nil, stored_stanza, time_now(), with); | 356 local id = archive:append(room_node, nil, stored_stanza, time_now(), with); |
354 | 357 |
355 if id then | 358 if id then |
356 stanza:add_direct_child(st.stanza("stanza-id", { xmlns = xmlns_st_id, by = self.jid, id = id })); | 359 stanza:add_direct_child(st.stanza("stanza-id", { xmlns = xmlns_st_id, by = self.jid, id = id })); |
357 end | 360 end |