Software /
code /
prosody-modules
Comparison
mod_muc_cloud_notify/mod_muc_cloud_notify.lua @ 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 |
parent | 3883:571249f69577 |
comparison
equal
deleted
inserted
replaced
4663:6e5572fc6840 | 4664:524a9103fb45 |
---|---|
461 local room = event.room; | 461 local room = event.room; |
462 local stanza = event.stanza; | 462 local stanza = event.stanza; |
463 local body = stanza:get_child_text('body'); | 463 local body = stanza:get_child_text('body'); |
464 | 464 |
465 for reference in stanza:childtags("reference", "urn:xmpp:reference:0") do | 465 for reference in stanza:childtags("reference", "urn:xmpp:reference:0") do |
466 if reference.attr['type'] == 'mention' and reference.attr['begin'] and reference.attr['end'] then | 466 local ref_begin, ref_end = tonumber(reference.attr['begin']), tonumber(reference.attr['end']); |
467 local nick = extract_reference(body, reference.attr['begin'], reference.attr['end']); | 467 if reference.attr['type'] == 'mention' and ref_begin and ref_end then |
468 local nick = extract_reference(body, ref_begin, ref_end); | |
468 local jid = room:get_registered_jid(nick); | 469 local jid = room:get_registered_jid(nick); |
469 | 470 |
470 if room._occupants[room.jid..'/'..nick] then | 471 if room._occupants[room.jid..'/'..nick] then |
471 -- We only notify for members not currently in the room | 472 -- We only notify for members not currently in the room |
472 module:log("debug", "Not notifying %s, because he's currently in the room", jid); | 473 module:log("debug", "Not notifying %s, because he's currently in the room", jid); |