# HG changeset patch # User Matthew Wild # Date 1590075307 -3600 # Node ID 7b6bcb91493ed777f21b380a9e5b59a7f6dbb730 # Parent 787fc3030087c654a3ea980b13ed4133f3e38ae7 mod_muc_markers: Allow tracking multiple markers diff -r 787fc3030087 -r 7b6bcb91493e mod_muc_markers/mod_muc_markers.lua --- a/mod_muc_markers/mod_muc_markers.lua Thu May 21 16:34:46 2020 +0100 +++ b/mod_muc_markers/mod_muc_markers.lua Thu May 21 16:35:07 2020 +0100 @@ -13,6 +13,7 @@ local xmlns_markers = "urn:xmpp:chat-markers:0"; local marker_element_name = module:get_option_string("muc_marker_type", "displayed"); +local marker_element_names = module:get_option_set("muc_marker_types", { marker_element_name }); local muc_marker_map_store = module:open_store("muc_markers", "map"); @@ -39,8 +40,10 @@ end, -1); module:hook("muc-occupant-groupchat", function (event) - local marker = event.stanza:get_child(marker_element_name, xmlns_markers); - if not marker then return; end + local marker = event.stanza:child_with_ns(xmlns_markers); + if not marker or not marker_element_names:contains(marker.name) then + return; -- No marker, or not one we are interested in + end -- Store the id that the user has received to module:log("warn", "New marker for %s: %s", event.occupant.bare_jid, marker.attr.id);