From d94cd6a669bb97af854989ab27075e126a41dda1 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Sat, 30 Oct 2021 23:12:16 +0300 Subject: [PATCH] Add option to request more history from phone on login --- config/bridge.go | 1 + example-config.yaml | 3 +++ main.go | 1 + 3 files changed, 5 insertions(+) diff --git a/config/bridge.go b/config/bridge.go index 83aa1e5..a74388a 100644 --- a/config/bridge.go +++ b/config/bridge.go @@ -44,6 +44,7 @@ type BridgeConfig struct { MaxAge int64 `yaml:"max_age"` Backfill bool `yaml:"backfill"` DoublePuppetBackfill bool `yaml:"double_puppet_backfill"` + RequestFullSync bool `yaml:"request_full_sync"` } `yaml:"history_sync"` UserAvatarSync bool `yaml:"user_avatar_sync"` BridgeMatrixLeave bool `yaml:"bridge_matrix_leave"` diff --git a/example-config.yaml b/example-config.yaml index d3dc865..0f1dd13 100644 --- a/example-config.yaml +++ b/example-config.yaml @@ -107,6 +107,9 @@ bridge: # Whether to use custom puppet for backfilling. # In order to use this, the custom puppets must be in the appservice's user ID namespace. double_puppet_backfill: false + # Whether the client should request a full sync from the phone when logging in. + # This bumps the size of history syncs from 3 months to 1 year. + request_full_sync: false # Whether or not puppet avatars should be fetched from the server even if an avatar is already set. user_avatar_sync: true # Whether or not Matrix users leaving groups should be bridged to WhatsApp diff --git a/main.go b/main.go index 5a881ee..5d0b81d 100644 --- a/main.go +++ b/main.go @@ -291,6 +291,7 @@ func (bridge *Bridge) Init() { store.BaseClientPayload.UserAgent.OsVersion = proto.String(WAVersion) store.BaseClientPayload.UserAgent.OsBuildNumber = proto.String(WAVersion) store.CompanionProps.Os = proto.String(bridge.Config.WhatsApp.OSName) + store.CompanionProps.RequireFullSync = proto.Bool(bridge.Config.Bridge.HistorySync.RequestFullSync) versionParts := strings.Split(WAVersion, ".") if len(versionParts) > 2 { primary, _ := strconv.Atoi(versionParts[0])