Software /
code /
prosody-modules
Comparison
mod_muc_occupant_id/mod_muc_occupant_id.lua @ 3904:d14fc974efbc
mod_muc_occupant_id: id is an attribute not a text node
author | Maxime “pep” Buquet <pep@bouah.net> |
---|---|
date | Tue, 25 Feb 2020 17:06:22 +0100 |
parent | 3837:7440cffe30e2 |
child | 3916:f1e28dcb3791 |
comparison
equal
deleted
inserted
replaced
3903:cfeb93b80621 | 3904:d14fc974efbc |
---|---|
34 | 34 |
35 -- strip any existing <occupant-id/> tags to avoid forgery | 35 -- strip any existing <occupant-id/> tags to avoid forgery |
36 stanza:remove_children("occupant-id", xmlns_occupant_id); | 36 stanza:remove_children("occupant-id", xmlns_occupant_id); |
37 | 37 |
38 local unique_id = generate_id(occupant, room); | 38 local unique_id = generate_id(occupant, room); |
39 stanza:tag("occupant-id", { xmlns = xmlns_occupant_id }) | 39 stanza:tag("occupant-id", { xmlns = xmlns_occupant_id, id = unique_id }):up(); |
40 :text(unique_id) | |
41 :up(); | |
42 end | 40 end |
43 | 41 |
44 module:add_feature(xmlns_occupant_id); | 42 module:add_feature(xmlns_occupant_id); |
45 module:hook("muc-disco#info", function (event) | 43 module:hook("muc-disco#info", function (event) |
46 event.reply:tag("feature", { var = xmlns_occupant_id }):up(); | 44 event.reply:tag("feature", { var = xmlns_occupant_id }):up(); |