Comparison

plugins/muc/history.lib.lua @ 10775:1641e33f1d36

MUC: Adapt rules for what should be stored from mod_mam This is the subset of mod_mam rules I believe makes sense in MUC. Note that mod_muc_mam does not have its own rules, but uses these.
author Kim Alvefur <zash@zash.se>
date Sun, 26 Apr 2020 19:38:38 +0200
parent 10355:cb9755d7a36e
child 11180:ab820b2ad199
comparison
equal deleted inserted replaced
10774:207691ad98fe 10775:1641e33f1d36
198 module:fire_event("muc-add-history", event); 198 module:fire_event("muc-add-history", event);
199 end 199 end
200 end); 200 end);
201 201
202 module:hook("muc-message-is-historic", function (event) 202 module:hook("muc-message-is-historic", function (event)
203 return event.stanza:get_child("body"); 203 local stanza = event.stanza;
204 if stanza:get_child("no-store", "urn:xmpp:hints")
205 or stanza:get_child("no-permanent-store", "urn:xmpp:hints") then
206 -- XXX Experimental XEP
207 return false, "hint";
208 end
209 if stanza:get_child("store", "urn:xmpp:hints") then
210 return true, "hint";
211 end
212 if stanza:get_child("body") then
213 return true;
214 end
215 if stanza:get_child("encryption", "urn:xmpp:eme:0") then
216 -- Since we can't know what an encrypted message contains, we assume it's important
217 -- XXX Experimental XEP
218 return true, "encrypted";
219 end
220 if stanza:get_child(nil, "urn:xmpp:chat-markers:0") then
221 -- XXX Experimental XEP
222 return true, "marker";
223 end
204 end, -1); 224 end, -1);
205 225
206 return { 226 return {
207 set_max_length = set_max_history_length; 227 set_max_length = set_max_history_length;
208 parse_history = parse_history; 228 parse_history = parse_history;