From 608f1d1c58ceac633a29036eb1a6b70103d2e0e0 Mon Sep 17 00:00:00 2001
From: Kim Alvefur <zash@zash.se>
Date: Sun, 26 Apr 2020 20:24:51 +0200
Subject: mod_carbons: Carbon anything that has been archived by the current
 user

This ensures rules in mod_mam apply to some extent. Messages worth
archiving are probably worth sending to other clients.
---
 plugins/mod_carbons.lua | 6 ++++++
 1 file changed, 6 insertions(+)

(limited to 'plugins')

diff --git a/plugins/mod_carbons.lua b/plugins/mod_carbons.lua
index 9befc9cb..c5efce39 100644
--- a/plugins/mod_carbons.lua
+++ b/plugins/mod_carbons.lua
@@ -47,6 +47,12 @@ local function should_copy(stanza, c2s, user_bare)
 		return true, "bounce";
 	end
 
+	for archived in stanza:childtags("stanza-id", "urn:xmpp:sid:0") do
+		if archived and archived.attr.by == user_bare then
+			return true, "archived";
+		end
+	end
+
 	return false, "default";
 end
 
-- 
cgit v1.2.3