diff mod_archive/mod_archive.lua @ 632:dcb8e7d2c711

mod_archive: applied patch from stephen.weber@gswot.org to fix issue 6 and 7; need fully test.
author shinysky<shinysky1986(AT)gmail.com>
date Thu, 29 Mar 2012 10:32:40 +0800
parents 6202ce4d12d6
children c1b0f0c33c6a 9bbd99f2057a
line wrap: on
line diff
--- a/mod_archive/mod_archive.lua	Tue Mar 27 17:11:26 2012 +0000
+++ b/mod_archive/mod_archive.lua	Thu Mar 29 10:32:40 2012 +0800
@@ -760,10 +760,10 @@
     if body then
         local from_node, from_host = jid.split(stanza.attr.from);
         local to_node, to_host = jid.split(stanza.attr.to);
-        if um.user_exists(from_node, from_host) and apply_pref(from_node, from_host, stanza.attr.to, thread) then
+        if hosts[from_host] and um.user_exists(from_node, from_host) and apply_pref(from_node, from_host, stanza.attr.to, thread) then
             store_msg(stanza, from_node, from_host, true);
         end
-        if um.user_exists(to_node, to_host) and apply_pref(to_node, to_host, stanza.attr.from, thread) then
+        if hosts[to_host] and um.user_exists(to_node, to_host) and apply_pref(to_node, to_host, stanza.attr.from, thread) then
             store_msg(stanza, to_node, to_host, false);
         end
     end
@@ -787,6 +787,8 @@
 
 module:hook("message/full", msg_handler, 10);
 module:hook("message/bare", msg_handler, 10);
+module:hook("pre-message/full", msg_handler, 10);
+module:hook("pre-message/bare", msg_handler, 10);
 
 -- TODO exactmatch
 -- TODO <item/> JID match