From d7d1abc3b7c515d905f50021fde28bd645a5cb33 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Thu, 20 Jul 2023 01:54:30 +0300 Subject: [PATCH] Fix some bugs --- portal.go | 4 ++++ puppet.go | 8 ++++++-- user.go | 1 + 3 files changed, 11 insertions(+), 2 deletions(-) diff --git a/portal.go b/portal.go index 793b629..9aa55cb 100644 --- a/portal.go +++ b/portal.go @@ -726,6 +726,10 @@ func (portal *Portal) SyncParticipants(source *User, metadata *gmproto.Conversat } portal.zlog.Debug().Interface("participant", participant).Msg("Syncing participant") puppet := source.GetPuppetByID(participant.ID.ParticipantID, participant.ID.Number) + if puppet == nil { + portal.zlog.Error().Any("participant_id", participant.ID).Msg("Failed to get puppet for participant") + continue + } userIDs = append(userIDs, puppet.MXID) puppet.Sync(source, participant) if portal.MXID != "" { diff --git a/puppet.go b/puppet.go index 134afb5..15f3368 100644 --- a/puppet.go +++ b/puppet.go @@ -140,8 +140,12 @@ func (br *GMBridge) NewPuppet(dbPuppet *database.Puppet) *Puppet { return &Puppet{ Puppet: dbPuppet, bridge: br, - log: br.ZLog.With().Str("phone", dbPuppet.Phone).Int("puppet_receiver", dbPuppet.Receiver).Logger(), - MXID: br.FormatPuppetMXID(dbPuppet.Key), + log: br.ZLog.With(). + Str("phone", dbPuppet.Phone). + Str("puppet_id", dbPuppet.ID). + Int("puppet_receiver", dbPuppet.Receiver). + Logger(), + MXID: br.FormatPuppetMXID(dbPuppet.Key), } } diff --git a/user.go b/user.go index 37cb03b..556969a 100644 --- a/user.go +++ b/user.go @@ -537,6 +537,7 @@ func (user *User) DeleteConnection() { defer user.connLock.Unlock() user.unlockedDeleteConnection() user.longPollingError = errors.New("not connected") + user.phoneResponding = true } func (user *User) HasSession() bool {