Software /
code /
prosody-modules
Changeset
3945:cf682a02b6d8
mod_muc_occupant_id: Handle MUC-PMs
author | Maxime “pep” Buquet <pep@bouah.net> |
---|---|
date | Sun, 15 Mar 2020 17:18:49 +0100 |
parents | 3944:7630d4ade7cd |
children | 3946:2a5b42e4db07 |
files | mod_muc_occupant_id/README.markdown mod_muc_occupant_id/mod_muc_occupant_id.lua |
diffstat | 2 files changed, 13 insertions(+), 3 deletions(-) [+] |
line wrap: on
line diff
--- a/mod_muc_occupant_id/README.markdown Wed Mar 11 20:09:17 2020 +0100 +++ b/mod_muc_occupant_id/README.markdown Sun Mar 15 17:18:49 2020 +0100 @@ -14,12 +14,11 @@ ==== - Subject messages -- MUC-PM support Compatibility ============= ------- ------------------ trunk Works - 0.11 Works + 0.11 Works; except in MUC-PMs ------- ------------------
--- a/mod_muc_occupant_id/mod_muc_occupant_id.lua Wed Mar 11 20:09:17 2020 +0100 +++ b/mod_muc_occupant_id/mod_muc_occupant_id.lua Sun Mar 15 17:18:49 2020 +0100 @@ -44,13 +44,24 @@ stanza:tag("occupant-id", { xmlns = xmlns_occupant_id, id = unique_id }):up(); end +local function muc_private(event) + local stanza, room = event.stanza, event.room; + local occupant = room._occupants[stanza.attr.from]; + + update_occupant({ + stanza = stanza, + room = room, + occupant = occupant, + }); +end + module:add_feature(xmlns_occupant_id); module:hook("muc-disco#info", function (event) event.reply:tag("feature", { var = xmlns_occupant_id }):up(); end); --- TODO: Handle MUC-PMs module:hook("muc-broadcast-presence", update_occupant); module:hook("muc-occupant-pre-join", update_occupant); module:hook("muc-occupant-pre-change", update_occupant); module:hook("muc-occupant-groupchat", update_occupant); +module:hook("muc-private-message", muc_private);