Skip to content
Snippets Groups Projects
Commit 4378c8ce authored by Tulir Asokan's avatar Tulir Asokan :cat2:
Browse files

Make number of chats to sync configurable

parent 75edda6b
Branches
Tags
No related merge requests found
......@@ -50,6 +50,9 @@ bridge:
# The prefix for commands. Only required in non-management rooms.
command_prefix: "!fb"
# Number of chats to sync (and create portals for) on startup/login.
# Maximum 20, set 0 to disable automatic syncing.
initial_chat_sync: 10
# Whether or not the Facebook users of logged in Matrix users should be
# invited to private chats when the user sends a message from another client.
invite_own_puppet_to_pm: false
......
......@@ -66,6 +66,7 @@ class Config(BaseFileConfig):
copy("bridge.command_prefix")
copy("bridge.initial_chat_sync")
copy("bridge.invite_own_puppet_to_pm")
copy("bridge.sync_with_custom_puppets")
copy("bridge.presence")
......
......@@ -143,8 +143,11 @@ class User(Client):
async def sync_threads(self) -> None:
try:
sync_count = min(20, config["bridge.initial_chat_sync"])
if sync_count <= 0:
return
self.log.debug("Fetching threads...")
threads = await self.fetchThreadList(limit=10)
threads = await self.fetchThreadList(limit=sync_count)
for thread in threads:
self.log.debug(f"Syncing thread {thread.uid} {thread.name}")
fb_receiver = self.uid if thread.type == ThreadType.USER else None
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment