From e4e100a184e7b97aae5233459bfd45dcccb50414 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Sat, 21 Jul 2018 11:23:34 -0400 Subject: [PATCH] Add option to disable /syncing with custom puppets --- example-config.yaml | 3 +++ mautrix_telegram/config.py | 1 + mautrix_telegram/puppet.py | 3 ++- 3 files changed, 6 insertions(+), 1 deletion(-) diff --git a/example-config.yaml b/example-config.yaml index 7668c236..4f0aa3b1 100644 --- a/example-config.yaml +++ b/example-config.yaml @@ -125,6 +125,9 @@ bridge: # Whether or not to fetch and handle Telegram updates at startup from the time the bridge was down. # WARNING: Probably buggy, might get stuck in infinite loop. catch_up: false + # Whether or not to use /sync to get presence, read receipts and typing notifications when using + # your own Matrix account as the Matrix puppet for your Telegram account. + sync_with_custom_puppets: true # The formats to use when sending messages to Telegram via the relay bot. # diff --git a/mautrix_telegram/config.py b/mautrix_telegram/config.py index 1dad0fb4..b7766f47 100644 --- a/mautrix_telegram/config.py +++ b/mautrix_telegram/config.py @@ -191,6 +191,7 @@ class Config(DictWithRecursion): copy("bridge.public_portals") copy("bridge.native_stickers") copy("bridge.catch_up") + copy("bridge.sync_with_custom_puppets") if "bridge.message_formats.m_text" in self: del self["bridge.message_formats"] diff --git a/mautrix_telegram/puppet.py b/mautrix_telegram/puppet.py index 1fbe6f76..f3da0c37 100644 --- a/mautrix_telegram/puppet.py +++ b/mautrix_telegram/puppet.py @@ -107,7 +107,8 @@ class Puppet: if mxid != self.custom_mxid: return 2 return 1 - asyncio.ensure_future(self.sync(), loop=self.loop) + if config["bridge.sync_with_custom_puppets"]: + asyncio.ensure_future(self.sync(), loop=self.loop) return 0 def create_sync_filter(self) -> Awaitable[str]: