aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/mod_mam/mod_mam.lua
diff options
context:
space:
mode:
authorKim Alvefur <zash@zash.se>2016-11-19 18:28:28 +0100
committerKim Alvefur <zash@zash.se>2016-11-19 18:28:28 +0100
commitdbd0d9fea7c5ca61e2acceb91ef774ade00d6a42 (patch)
tree174d31107f000855955c098a24b81f06e8f46796 /plugins/mod_mam/mod_mam.lua
parent913534e983095746a2f459fa884f465a20c33548 (diff)
downloadprosody-dbd0d9fea7c5ca61e2acceb91ef774ade00d6a42.tar.gz
prosody-dbd0d9fea7c5ca61e2acceb91ef774ade00d6a42.zip
mod_mam: Find out which party is the user and which is the 'with' earlier
Diffstat (limited to 'plugins/mod_mam/mod_mam.lua')
-rw-r--r--plugins/mod_mam/mod_mam.lua10
1 files changed, 5 insertions, 5 deletions
diff --git a/plugins/mod_mam/mod_mam.lua b/plugins/mod_mam/mod_mam.lua
index 3e14c022..2606f861 100644
--- a/plugins/mod_mam/mod_mam.lua
+++ b/plugins/mod_mam/mod_mam.lua
@@ -233,6 +233,11 @@ local function message_handler(event, c2s)
local orig_to = stanza.attr.to or orig_from;
-- Stanza without 'to' are treated as if it was to their own bare jid
+ -- Whos storage do we put it in?
+ local store_user = c2s and origin.username or jid_split(orig_to);
+ -- And who are they chatting with?
+ local with = jid_bare(c2s and orig_to or orig_from);
+
-- We store chat messages or normal messages that have a body
if not(orig_type == "chat" or (orig_type == "normal" and stanza:get_child("body")) ) then
log("debug", "Not archiving stanza: %s (type)", stanza:top_tag());
@@ -248,11 +253,6 @@ local function message_handler(event, c2s)
end
end
- -- Whos storage do we put it in?
- local store_user = c2s and origin.username or jid_split(orig_to);
- -- And who are they chatting with?
- local with = jid_bare(c2s and orig_to or orig_from);
-
-- Check with the users preferences
if shall_store(store_user, with) then
log("debug", "Archiving stanza: %s", stanza:top_tag());