# HG changeset patch
# User Kim Alvefur <zash@zash.se>
# Date 1543949371 -3600
# Node ID b2d6b79c9513e7d89a978e28f34ade3f19314c4a
# Parent  bf32f2282b18c8732a22f4c6f727a318465f71c1
MUC/subject: Don't consider messages with <body> or <subject> (fixes #667)

diff -r bf32f2282b18 -r b2d6b79c9513 plugins/muc/subject.lib.lua
--- a/plugins/muc/subject.lib.lua	Tue Dec 04 16:19:58 2018 +0000
+++ b/plugins/muc/subject.lib.lua	Tue Dec 04 19:49:31 2018 +0100
@@ -94,6 +94,12 @@
 	local stanza = event.stanza;
 	local subject = stanza:get_child("subject");
 	if subject then
+		if stanza:get_child("body") or stanza:get_child("thread") then
+			-- Note: A message with a <subject/> and a <body/> or a <subject/> and
+			-- a <thread/> is a legitimate message, but it SHALL NOT be interpreted
+			-- as a subject change.
+			return;
+		end
 		local room = event.room;
 		local occupant = event.occupant;
 		-- Role check for subject changes