Software / code / prosody-modules
Comparison
mod_muc_markers/mod_muc_markers.lua @ 4025:57b4cdeba318
mod_muc_markers: Prevent storage instead of broadcast
Restores the ability to see how far others have read.
Maybe this should be a setting?
| author | Kim Alvefur <zash@zash.se> |
|---|---|
| date | Tue, 05 May 2020 21:50:35 +0200 |
| parent | 4024:95882b487ed2 |
| child | 4026:e3964f876b5d |
comparison
equal
deleted
inserted
replaced
| 4024:95882b487ed2 | 4025:57b4cdeba318 |
|---|---|
| 42 | 42 |
| 43 -- Store the id that the user has received to | 43 -- Store the id that the user has received to |
| 44 module:log("warn", "New marker for %s: %s", event.occupant.bare_jid, marker.attr.id); | 44 module:log("warn", "New marker for %s: %s", event.occupant.bare_jid, marker.attr.id); |
| 45 muc_marker_map_store:set(event.occupant.bare_jid, event.room.jid, marker.attr.id); | 45 muc_marker_map_store:set(event.occupant.bare_jid, event.room.jid, marker.attr.id); |
| 46 | 46 |
| 47 -- Prevent stanza from reaching the room (it's just noise) | 47 end); |
| 48 return true; | 48 |
| 49 module:hook("muc-message-is-historic", function (event) | |
| 50 local marker = event.stanza:get_child("received", xmlns_markers); | |
| 51 | |
| 52 -- Prevent stanza from reaching the archive (it's just noise) | |
| 53 if marker then | |
| 54 return false | |
| 55 end | |
| 49 end); | 56 end); |
| 50 | 57 |
| 51 -- Public API | 58 -- Public API |
| 52 | 59 |
| 53 function get_user_read_marker(user_jid, room_jid) | 60 function get_user_read_marker(user_jid, room_jid) |