mod_carbons: Make the conditions for ignoring MUC PMs more specific (fixes #744)
authorKim Alvefur <zash@zash.se>
Fri, 23 Sep 2016 14:03:37 +0200
changeset 7673 2be85cb3bc66
parent 7668 2e553f80aedd
child 7674 07fb4a8c4c89
mod_carbons: Make the conditions for ignoring MUC PMs more specific (fixes #744)
plugins/mod_carbons.lua
util/jid.lua
--- a/plugins/mod_carbons.lua	Mon Sep 12 22:30:37 2016 +0100
+++ b/plugins/mod_carbons.lua	Fri Sep 23 14:03:37 2016 +0200
@@ -1,5 +1,5 @@
 -- XEP-0280: Message Carbons implementation for Prosody
--- Copyright (C) 2011 Kim Alvefur
+-- Copyright (C) 2011-2016 Kim Alvefur
 --
 -- This file is MIT/X11 licensed.
 
@@ -67,7 +67,7 @@
 	elseif stanza:get_child("no-copy", "urn:xmpp:hints") then
 		module:log("debug", "Message has no-copy hint, ignoring");
 		return
-	elseif stanza:get_child("x", "http://jabber.org/protocol/muc#user") then
+	elseif not c2s and orig_from ~= orig_from and stanza:get_child("x", "http://jabber.org/protocol/muc#user") then
 		module:log("debug", "MUC PM, ignoring");
 		return
 	end
--- a/util/jid.lua	Mon Sep 12 22:30:37 2016 +0100
+++ b/util/jid.lua	Fri Sep 23 14:03:37 2016 +0200
@@ -46,7 +46,7 @@
 
 local function prepped_split(jid)
 	local node, host, resource = split(jid);
-	if host then
+	if host and host ~= "." then
 		if sub(host, -1, -1) == "." then -- Strip empty root label
 			host = sub(host, 1, -2);
 		end