Mercurial > prosody-modules
comparison mod_mamsub/mod_mamsub.lua @ 1748:0697fbef9134
mod_mamsub: Prevent nil indexing if message is added to archive of an offline user
author | Kim Alvefur <zash@zash.se> |
---|---|
date | Mon, 18 May 2015 03:31:53 +0200 |
parents | 985e05ac833b |
children |
comparison
equal
deleted
inserted
replaced
1747:985e05ac833b | 1748:0697fbef9134 |
---|---|
45 origin.send(st.reply(stanza)); | 45 origin.send(st.reply(stanza)); |
46 return true; | 46 return true; |
47 end); | 47 end); |
48 | 48 |
49 module:hook("archive-message-added", function (event) | 49 module:hook("archive-message-added", function (event) |
50 local mamsub_sessions = host_sessions[event.for_user].mamsub_sessions; | 50 local user_session = host_sessions[event.for_user]; |
51 local mamsub_sessions = user_session and user_session.mamsub_sessions; | |
51 if not mamsub_sessions then return end; | 52 if not mamsub_sessions then return end; |
52 | 53 |
53 local for_broadcast = st.message():tag("mamsub", { xmlns = xmlns_mamsub }) | 54 local for_broadcast = st.message():tag("mamsub", { xmlns = xmlns_mamsub }) |
54 :tag("forwarded", { xmlns = "urn:xmpp:forward:0" }) | 55 :tag("forwarded", { xmlns = "urn:xmpp:forward:0" }) |
55 :add_child(event.stanza); | 56 :add_child(event.stanza); |