Changeset

4664:524a9103fb45

mod_muc_cloud_notify: Fix comparison between string and number in reference extraction. Fixes #1681.
author Matthew Wild <mwild1@gmail.com>
date Wed, 01 Sep 2021 22:41:27 +0100
parents 4663:6e5572fc6840
children 4665:f0ffa8cf3ce6
files mod_muc_cloud_notify/mod_muc_cloud_notify.lua
diffstat 1 files changed, 3 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mod_muc_cloud_notify/mod_muc_cloud_notify.lua	Thu Aug 26 16:52:13 2021 +0100
+++ b/mod_muc_cloud_notify/mod_muc_cloud_notify.lua	Wed Sep 01 22:41:27 2021 +0100
@@ -463,8 +463,9 @@
 	local body = stanza:get_child_text('body');
 
 	for reference in stanza:childtags("reference", "urn:xmpp:reference:0") do
-		if reference.attr['type'] == 'mention' and reference.attr['begin'] and reference.attr['end'] then
-			local nick = extract_reference(body, reference.attr['begin'], reference.attr['end']);
+		local ref_begin, ref_end = tonumber(reference.attr['begin']), tonumber(reference.attr['end']);
+		if reference.attr['type'] == 'mention' and ref_begin and ref_end then
+			local nick = extract_reference(body, ref_begin, ref_end);
 			local jid = room:get_registered_jid(nick);
 
 			if room._occupants[room.jid..'/'..nick] then