diff --git a/libgm/gmproto/conversations.pb.go b/libgm/gmproto/conversations.pb.go index 28fa10f..a4ec03a 100644 --- a/libgm/gmproto/conversations.pb.go +++ b/libgm/gmproto/conversations.pb.go @@ -2020,7 +2020,7 @@ type Participant struct { AvatarHexColor string `protobuf:"bytes,5,opt,name=avatarHexColor,proto3" json:"avatarHexColor,omitempty"` IsMe bool `protobuf:"varint,6,opt,name=isMe,proto3" json:"isMe,omitempty"` Muted *Muted `protobuf:"bytes,7,opt,name=muted,proto3" json:"muted,omitempty"` - SomeInt int64 `protobuf:"varint,8,opt,name=someInt,proto3" json:"someInt,omitempty"` + IsVisible bool `protobuf:"varint,8,opt,name=isVisible,proto3" json:"isVisible,omitempty"` ContactID string `protobuf:"bytes,10,opt,name=contactID,proto3" json:"contactID,omitempty"` Bs int64 `protobuf:"varint,14,opt,name=bs,proto3" json:"bs,omitempty"` FormattedNumber string `protobuf:"bytes,15,opt,name=formattedNumber,proto3" json:"formattedNumber,omitempty"` @@ -2102,11 +2102,11 @@ func (x *Participant) GetMuted() *Muted { return nil } -func (x *Participant) GetSomeInt() int64 { +func (x *Participant) GetIsVisible() bool { if x != nil { - return x.SomeInt + return x.IsVisible } - return 0 + return false } func (x *Participant) GetContactID() string { diff --git a/libgm/gmproto/conversations.pb.raw b/libgm/gmproto/conversations.pb.raw index 03f0ec5..429adf3 100644 Binary files a/libgm/gmproto/conversations.pb.raw and b/libgm/gmproto/conversations.pb.raw differ diff --git a/libgm/gmproto/conversations.proto b/libgm/gmproto/conversations.proto index e524649..b8e485c 100644 --- a/libgm/gmproto/conversations.proto +++ b/libgm/gmproto/conversations.proto @@ -183,7 +183,7 @@ message Participant { string avatarHexColor = 5; bool isMe = 6; Muted muted = 7; - int64 someInt = 8; + bool isVisible = 8; string contactID = 10; int64 bs = 14; string formattedNumber = 15; diff --git a/portal.go b/portal.go index 1c91767..f78c352 100644 --- a/portal.go +++ b/portal.go @@ -905,6 +905,14 @@ func (portal *Portal) getIntent(ctx context.Context, source *User, participant s return nil } return intent + } else if portal.IsPrivateChat() { + if participant != portal.OtherUserID { + zerolog.Ctx(ctx).Warn(). + Str("participant_id", participant). + Str("portal_other_user_id", portal.OtherUserID). + Msg("Got unexpected participant ID for message in DM portal, forcing to main intent") + } + return portal.MainIntent() } else { puppet := source.GetPuppetByID(participant, "") if puppet == nil { @@ -1291,44 +1299,14 @@ func (portal *Portal) SyncParticipants(ctx context.Context, source *User, metada } continue } else if participant.ID.Number == "" { - portal.zlog.Warn().Interface("participant", participant).Msg("No number found in non-self participant entry") + portal.zlog.Warn().Any("participant", participant).Msg("No number found in non-self participant entry") + continue + } else if !participant.IsVisible { + portal.zlog.Debug().Any("participant", participant).Msg("Ignoring fake participant") continue } filteredParticipants = append(filteredParticipants, participant) } - if len(filteredParticipants) > 1 && !metadata.IsGroupChat { - var bestParticipant *gmproto.Participant - var foundMultiple bool - for _, participant := range filteredParticipants { - if participant.GetSomeInt() == 1 && - // TODO this name check may be unnecessary (and is even more hacky) - (participant.GetFullName() == metadata.GetName() || - participant.GetFormattedNumber() == metadata.GetName() || - strings.TrimPrefix(participant.GetID().GetNumber(), "+") == strings.TrimPrefix(metadata.GetName(), "+")) { - if bestParticipant != nil { - foundMultiple = true - break - } else { - bestParticipant = participant - } - } - } - if foundMultiple { - portal.zlog.Warn(). - Any("participants", filteredParticipants). - Msg("Didn't apply hacky deduplication to DM participants: found multiple matches") - } else if bestParticipant != nil { - portal.zlog.Debug(). - Any("participants", filteredParticipants). - Any("chosen_participant", bestParticipant). - Msg("Applied hacky deduplication to DM participants") - filteredParticipants = []*gmproto.Participant{bestParticipant} - } else { - portal.zlog.Warn(). - Any("participants", filteredParticipants). - Msg("Didn't apply hacky deduplication to DM participants: no match found") - } - } for _, participant := range filteredParticipants { puppet := source.GetPuppetByID(participant.ID.ParticipantID, participant.ID.Number) if puppet == nil {