Comparison

plugins/mod_muc_mam.lua @ 8724:cfcc78c50905

mod_muc_mam: Let muc/history.lib decide which messages to store
author Kim Alvefur <zash@zash.se>
date Sat, 24 Mar 2018 18:16:08 +0100
parent 8723:f3bdb20214ab
child 8725:ced09d7d7c96
comparison
equal deleted inserted replaced
8723:f3bdb20214ab 8724:cfcc78c50905
332 if id then 332 if id then
333 stanza:add_direct_child(st.stanza("stanza-id", { xmlns = xmlns_st_id, by = self.jid, id = id })); 333 stanza:add_direct_child(st.stanza("stanza-id", { xmlns = xmlns_st_id, by = self.jid, id = id }));
334 end 334 end
335 end 335 end
336 336
337 module:hook("muc-broadcast-message", function (event) 337 module:hook("muc-add-history", function (event)
338 local room, stanza = event.room, event.stanza; 338 local room, stanza = event.room, event.stanza;
339 if stanza:get_child("body") then 339 save_to_history(room, stanza);
340 save_to_history(room, stanza);
341 end
342 end); 340 end);
343 341
344 if module:get_option_boolean("muc_log_presences", true) then 342 if module:get_option_boolean("muc_log_presences", true) then
345 module:hook("muc-occupant-joined", function (event) 343 module:hook("muc-occupant-joined", function (event)
346 save_to_history(event.room, st.stanza("presence", { from = event.nick })); 344 save_to_history(event.room, st.stanza("presence", { from = event.nick }));