From 8a07cbe9d4be8e5cd239e5d79bb954cd09b4be63 Mon Sep 17 00:00:00 2001
From: Tulir Asokan <tulir@maunium.net>
Date: Thu, 23 Apr 2020 22:46:02 +0300
Subject: [PATCH] Fix double puppeted messages echoing back to Facebook when
 using e2be

---
 mautrix_facebook/portal.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/mautrix_facebook/portal.py b/mautrix_facebook/portal.py
index 851b395..5a4673a 100644
--- a/mautrix_facebook/portal.py
+++ b/mautrix_facebook/portal.py
@@ -582,6 +582,8 @@ class Portal(BasePortal):
     async def _send_message(self, intent: IntentAPI, content: MessageEventContent,
                             event_type: EventType = EventType.ROOM_MESSAGE, **kwargs) -> EventID:
         if self.encrypted and self.matrix.e2ee:
+            if intent.api.is_real_user:
+                content[intent.api.real_user_content_key] = True
             event_type, content = await self.matrix.e2ee.encrypt(self.mxid, event_type, content)
         return await intent.send_message_event(self.mxid, event_type, content, **kwargs)
 
-- 
GitLab