Skip to content

Commit

Permalink
Update some field names
Browse files Browse the repository at this point in the history
[skip cd]
  • Loading branch information
tulir committed Jan 25, 2024
1 parent 4a57a0b commit fbc2016
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 14 deletions.
19 changes: 19 additions & 0 deletions messagix/table/contacts.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 ?
Expand Down
12 changes: 6 additions & 6 deletions messagix/table/sync_groups.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down
16 changes: 8 additions & 8 deletions messagix/table/threads.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"`
Expand Down Expand Up @@ -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"`
}
Expand Down Expand Up @@ -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"`
Expand Down
3 changes: 3 additions & 0 deletions user.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
Expand Down

0 comments on commit fbc2016

Please sign in to comment.