#903 mod_mam_muc: Send real jid alongside message

Reporter Daniel Gultsch
Owner Zash
Created
Updated
Stars ★★ (2)  
Tags
  • Type-Enhancement
  • Status-Fixed
  • Priority-Medium
  1. Daniel Gultsch on

    Description of feature: The business rules of XEP-0313 specify a way for the MAM archive to communicate the real jid of the original sender in non-anonymous MUCs. (See last paragraph of section 5.1.2 and example 17) Also note the last sentence in there 'The archiving entity MUST strip any pre-existing <x> element from MUC messages (as MUC rooms are not required to do this).'

  2. Michel Le Bihan on

    I patched Prosody to log real JIDs for non anon rooms. It works fine with Prosody diff -r 102e1ec8bee1 plugins/muc/muc.lib.lua --- a/plugins/muc/muc.lib.lua Wed Apr 26 11:55:27 2017 +0200 +++ b/plugins/muc/muc.lib.lua Thu Jun 01 19:27:13 2017 +0200 @@ -964,6 +964,7 @@ end function room_mt:handle_groupchat_to_room(origin, stanza) + local whois = self:get_whois(); local from = stanza.attr.from; local occupant = self:get_occupant_by_real_jid(from); if module:fire_event("muc-occupant-groupchat", { @@ -971,6 +972,10 @@ }) then return true; end stanza.attr.from = occupant.nick; self:broadcast_message(stanza); + if whois == "anyone" then + stanza:tag("x", { xmlns = "http://jabber.org/protocol/muc#user" }):tag("item", {affiliation = self:get_affiliation(from), jid = from, role = self:get_role(occupant.nick)}):up(); + end + module:fire_event("muc-archive-message", {room = self, stanza = stanza}); stanza.attr.from = from; return true; end You also need to replace `module:hook("muc-broadcast-message", function (event)` `module:hook("muc-archive-message", function (event)` by in mod_mam_muc.lua

  3. Zash on

    Done in https://hg.prosody.im/prosody-modules/rev/391c508e0b75 without any patch needed to core MUC

    Changes
    • owner Zash
    • tags Status-Fixed

New comment