Changeset

737:e4ea03b060ed

mod_archive: switch from/to The XEP-0136 is not very explicit about the meening of <from> and <to> elements, but the examples are clear: <from> means it comes from the user in the 'with' attribute of the collection. That is the opposite of what is currently implemented in that module. So for better compatibility with complient clients, this switch the 'from' and 'to' fields
author Olivier Goffart <ogoffart@woboq.com>
date Wed, 04 Jul 2012 14:08:43 +0200
parents 736:b031831b2ac0
children 738:92db76641b3f
files mod_archive/mod_archive.lua
diffstat 1 files changed, 3 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/mod_archive/mod_archive.lua	Wed Jul 04 13:58:31 2012 +0200
+++ b/mod_archive/mod_archive.lua	Wed Jul 04 14:08:43 2012 +0200
@@ -87,7 +87,7 @@
     local thread = msg:child_with_name("thread");
 	local data = dm.list_load(node, host, ARCHIVE_DIR);
     local tag = isfrom and "from" or "to";
-    local with = isfrom and msg.attr.to or msg.attr.from;
+    local with = isfrom and msg.attr.from or msg.attr.to;
     local utc_datetime = date_time();
     local utc_secs = date_parse(utc_datetime);
     if data then
@@ -759,11 +759,11 @@
 end
 
 local function message_handler(data)
-    msg_handler(data, data.stanza.attr.to,  data.stanza.attr.from, false)
+    msg_handler(data, data.stanza.attr.to,  data.stanza.attr.from, true)
 end
 
 local function premessage_handler(data)
-    msg_handler(data, data.stanza.attr.from,  data.stanza.attr.to, true)
+    msg_handler(data, data.stanza.attr.from,  data.stanza.attr.to, false)
 end
 
 -- Preferences