Comparison

mod_push2/mod_push2.lua @ 6218:277db84b0c95

mod_push2: guard against no rooms tracked on this session
author Stephen Paul Weber <singpolyma@singpolyma.net>
date Tue, 25 Mar 2025 20:43:51 -0500
parent 6217:8ecd53452af8
child 6219:06621ab30be0
comparison
equal deleted inserted replaced
6217:8ecd53452af8 6218:277db84b0c95
391 391
392 local chat = match.chats and (match.chats[stanza.attr.from] or match.chats[jid.bare(stanza.attr.from)] or match.chats[jid.host(stanza.attr.from)]) 392 local chat = match.chats and (match.chats[stanza.attr.from] or match.chats[jid.bare(stanza.attr.from)] or match.chats[jid.host(stanza.attr.from)])
393 if does_match and chat then 393 if does_match and chat then
394 does_match = false 394 does_match = false
395 395
396 local nick = session.rooms_joined[jid.bare(stanza.attr.from)] or to_user 396 local nick = (session.rooms_joined and session.rooms_joined[jid.bare(stanza.attr.from)]) or to_user
397 397
398 if not does_match and chat.mention then 398 if not does_match and chat.mention then
399 local body = stanza:get_child_text("body") 399 local body = stanza:get_child_text("body")
400 if body and body:find(nick, 1, true) then 400 if body and body:find(nick, 1, true) then
401 does_match = true 401 does_match = true