mod_message_logging: Treat messages with no 'to' as directed to the sender
authorKim Alvefur <zash@zash.se>
Thu, 03 Apr 2014 00:19:18 +0200
changeset 1377 92f3b4d81b52
parent 1376 f4de4a35778d
child 1378 aa371405db34
mod_message_logging: Treat messages with no 'to' as directed to the sender
mod_message_logging/mod_message_logging.lua
--- 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();