changeset 1377:92f3b4d81b52

mod_message_logging: Treat messages with no 'to' as directed to the sender
author Kim Alvefur <zash@zash.se>
date Thu, 03 Apr 2014 00:19:18 +0200
parents f4de4a35778d
children aa371405db34
files mod_message_logging/mod_message_logging.lua
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/mod_message_logging/mod_message_logging.lua	Wed Apr 02 13:32:00 2014 +0200
+++ b/mod_message_logging/mod_message_logging.lua	Thu Apr 03 00:19:18 2014 +0200
@@ -56,7 +56,7 @@
 
 	if message_type == "error" then return; end
 
-	local from, to = jid_bare(stanza.attr.from), jid_bare(stanza.attr.to);
+	local from, to = jid_bare(stanza.attr.from), jid_bare(stanza.attr.to or stanza.attr.from);
 	local body = stanza:get_child("body");
 	if not body then return; end
 	body = body:get_text();
@@ -78,7 +78,7 @@
 
 	if message_type == "error" or message_type == "groupchat" then return; end
 
-	local from, to = jid_bare(stanza.attr.from), jid_bare(stanza.attr.to);
+	local from, to = jid_bare(stanza.attr.from), jid_bare(stanza.attr.to or origin.full_jid);
 	local body = stanza:get_child("body");
 	if not body then return; end
 	body = body:get_text();