Skip to content
This repository has been archived by the owner on Nov 13, 2024. It is now read-only.

Commit

Permalink
Merge with upstream
Browse files Browse the repository at this point in the history
  • Loading branch information
AndrewFerr committed Mar 7, 2024
2 parents a29f469 + 100a81a commit e9a4b5e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
7 changes: 4 additions & 3 deletions pkg/signalmeow/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,10 @@ type Client struct {

encryptionLock sync.Mutex

AuthedWS *web.SignalWebsocket
UnauthedWS *web.SignalWebsocket
WSCancel context.CancelFunc
AuthedWS *web.SignalWebsocket
UnauthedWS *web.SignalWebsocket
WSCancel context.CancelFunc
lastConnectionStatus SignalConnectionStatus

EventHandler func(events.SignalEvent)

Expand Down
9 changes: 6 additions & 3 deletions pkg/signalmeow/receiving.go
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,6 @@ func (cli *Client) StartReceiveLoops(ctx context.Context) (chan SignalConnection
defer close(statusChan)
defer cancel()
var currentStatus, lastAuthStatus, lastUnauthStatus web.SignalWebsocketConnectionStatus
var lastSentStatus SignalConnectionStatus
for {
select {
case <-ctx.Done():
Expand Down Expand Up @@ -172,10 +171,10 @@ func (cli *Client) StartReceiveLoops(ctx context.Context) (chan SignalConnection
Event: SignalConnectionCleanShutdown,
}
}
if statusToSend.Event != 0 && statusToSend.Event != lastSentStatus.Event {
if statusToSend.Event != 0 && statusToSend.Event != cli.lastConnectionStatus.Event {
log.Info().Any("status_to_send", statusToSend).Msg("Sending connection status")
statusChan <- statusToSend
lastSentStatus = statusToSend
cli.lastConnectionStatus = statusToSend
}
}
}()
Expand Down Expand Up @@ -220,6 +219,10 @@ func (cli *Client) StopReceiveLoops() error {
return nil
}

func (cli *Client) LastConnectionStatus() SignalConnectionStatus {
return cli.lastConnectionStatus
}

func (cli *Client) ClearKeysAndDisconnect(ctx context.Context) error {
// Essentially logout, clearing sessions and keys, and disconnecting websockets
// but don't clear ACI UUID or profile keys or contacts, or anything else that
Expand Down

0 comments on commit e9a4b5e

Please sign in to comment.