From fbc201679a61b7e63feef509fc8b85931c66a6b4 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Thu, 25 Jan 2024 12:43:19 +0200 Subject: [PATCH] Update some field names [skip cd] --- messagix/table/contacts.go | 19 +++++++++++++++++++ messagix/table/sync_groups.go | 12 ++++++------ messagix/table/threads.go | 16 ++++++++-------- user.go | 3 +++ 4 files changed, 36 insertions(+), 14 deletions(-) diff --git a/messagix/table/contacts.go b/messagix/table/contacts.go index d395092..6e4448f 100644 --- a/messagix/table/contacts.go +++ b/messagix/table/contacts.go @@ -89,6 +89,25 @@ type LSDeleteThenInsertContact struct { Unrecognized map[int]any `json:",omitempty"` } +func (ls *LSDeleteThenInsertContact) GetUsername() string { + return ls.SecondaryName +} + +func (ls *LSDeleteThenInsertContact) GetName() string { + return ls.Name +} + +func (ls *LSDeleteThenInsertContact) GetAvatarURL() string { + if ls.ProfilePictureLargeUrl != "" { + return ls.ProfilePictureLargeUrl + } + return ls.ProfilePictureUrl +} + +func (ls *LSDeleteThenInsertContact) GetFBID() int64 { + return ls.Id +} + type LSDeleteThenInsertContactPresence struct { ContactId int64 `index:"0" json:",omitempty"` Status int64 `index:"1" json:",omitempty"` // make enum ? diff --git a/messagix/table/sync_groups.go b/messagix/table/sync_groups.go index 9f69899..1513524 100644 --- a/messagix/table/sync_groups.go +++ b/messagix/table/sync_groups.go @@ -164,17 +164,17 @@ type LSDeleteThenInsertBotProfileInfoCategoryV2 struct { } type LSDeleteThenInsertBotProfileInfoV2 struct { - BotID int64 `index:"0" json:",omitempty"` - UnknownBool1 bool `index:"1" json:",omitempty"` - UnknownInt2 int64 `index:"2" json:",omitempty"` - Title string `index:"3" json:",omitempty"` - Description string `index:"4" json:",omitempty"` + BotID int64 `index:"0" json:",omitempty"` + IsCreatedByViewer bool `index:"1" json:",omitempty"` + TintColor int64 `index:"2" json:",omitempty"` + ShortDescription string `index:"3" json:",omitempty"` + Description string `index:"4" json:",omitempty"` Unrecognized map[int]any `json:",omitempty"` } type LSHandleSyncFailure struct { - UnknownInt0 int64 `index:"0" json:",omitempty"` + DatabaseID int64 `index:"0" json:",omitempty"` ErrorMessage string `index:"1" json:",omitempty"` Unrecognized map[int]any `json:",omitempty"` diff --git a/messagix/table/threads.go b/messagix/table/threads.go index 2890317..60e0451 100644 --- a/messagix/table/threads.go +++ b/messagix/table/threads.go @@ -89,7 +89,7 @@ type LSDeleteThenInsertThread struct { IsCustomThreadPicture bool `index:"52" json:",omitempty"` OtidOfFirstMessage int64 `index:"53" json:",omitempty"` NormalizedSearchTerms string `index:"54" json:",omitempty"` - AdditionalThreadContext int64 `index:"55" json:",omitempty"` + AdditionalThreadContext string `index:"55" json:",omitempty"` DisappearingThreadKey int64 `index:"56" json:",omitempty"` IsDisappearingMode bool `index:"57" json:",omitempty"` DisappearingModeInitiator int64 `index:"58" json:",omitempty"` @@ -398,12 +398,12 @@ func (utn *LSSyncUpdateThreadName) GetThreadKey() int64 { } type LSSetThreadImageURL struct { - ThreadKey int64 `index:"0" json:",omitempty"` - ImageURL string `index:"1" json:",omitempty"` - ImageFallbackURL string `index:"2" json:",omitempty"` - ImageURLExpiryTimeMS int64 `index:"3" json:",omitempty"` - UnknownBool4 bool `index:"4" json:",omitempty"` - UnknownBool5 bool `index:"5" json:",omitempty"` + ThreadKey int64 `index:"0" json:",omitempty"` + ImageURL string `index:"1" json:",omitempty"` + ImageFallbackURL string `index:"2" json:",omitempty"` + ImageURLExpiryTimeMS int64 `index:"3" json:",omitempty"` + IsCustomThreadPicture bool `index:"4" json:",omitempty"` + ShouldRoundThreadPicture bool `index:"5" json:",omitempty"` Unrecognized map[int]any `json:",omitempty"` } @@ -507,7 +507,7 @@ type LSUpdateOrInsertThread struct { IsCustomThreadPicture bool `index:"55" json:",omitempty"` OtidOfFirstMessage int64 `index:"56" json:",omitempty"` NormalizedSearchTerms string `index:"57" json:",omitempty"` - AdditionalThreadContext int64 `index:"58" json:",omitempty"` + AdditionalThreadContext string `index:"58" json:",omitempty"` DisappearingThreadKey int64 `index:"59" json:",omitempty"` IsDisappearingMode bool `index:"60" json:",omitempty"` DisappearingModeInitiator int64 `index:"61" json:",omitempty"` diff --git a/user.go b/user.go index fdd03d3..6cbac65 100644 --- a/user.go +++ b/user.go @@ -453,6 +453,9 @@ func (br *MetaBridge) StartUsers() { func (user *User) handleTable(tbl *table.LSTable) { log := user.log.With().Str("action", "handle table").Logger() ctx := log.WithContext(context.TODO()) + for _, contact := range tbl.LSDeleteThenInsertContact { + user.bridge.GetPuppetByID(contact.Id).UpdateInfo(ctx, contact) + } for _, contact := range tbl.LSVerifyContactRowExists { user.bridge.GetPuppetByID(contact.ContactId).UpdateInfo(ctx, contact) }