Software /
code /
prosody
Changeset
8780:4cab4ee5dfcc
MUC: Introduce an event to allow plugins to influence which messages are added to history
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 07 May 2018 22:10:29 +0200 |
parents | 8779:11b4ae162db7 |
children | 8781:53178b6ba589 |
files | plugins/muc/history.lib.lua |
diffstat | 1 files changed, 5 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/plugins/muc/history.lib.lua Mon May 07 22:12:22 2018 +0200 +++ b/plugins/muc/history.lib.lua Mon May 07 22:10:29 2018 +0200 @@ -156,12 +156,15 @@ -- Have a single muc-add-history event, so that plugins can mark it -- as handled without stopping other muc-broadcast-message handlers module:hook("muc-broadcast-message", function(event) - local historic = event.stanza:get_child("body"); - if historic then + if module:fire_event("muc-message-is-historic", event) then module:fire_event("muc-add-history", event); end end); +module:hook("muc-message-is-historic", function (event) + return event.stanza:get_child("body"); +end, -1); + return { set_max_length = set_max_history_length; parse_history = parse_history;