Handle pair revoke events
This commit is contained in:
parent
9f189d913b
commit
511e85c242
3 changed files with 10 additions and 1 deletions
|
@ -23,6 +23,7 @@ import (
|
|||
const (
|
||||
GMListenError status.BridgeStateErrorCode = "gm-listen-error"
|
||||
GMFatalError status.BridgeStateErrorCode = "gm-listen-fatal-error"
|
||||
GMUnpaired status.BridgeStateErrorCode = "gm-unpaired"
|
||||
GMNotConnected status.BridgeStateErrorCode = "gm-not-connected"
|
||||
GMConnecting status.BridgeStateErrorCode = "gm-connecting"
|
||||
GMConnectionFailed status.BridgeStateErrorCode = "gm-connection-failed"
|
||||
|
@ -35,7 +36,8 @@ const (
|
|||
func init() {
|
||||
status.BridgeStateHumanErrors.Update(status.BridgeStateErrorMap{
|
||||
GMListenError: "Error polling messages from Google Messages server, the bridge will try to reconnect",
|
||||
GMFatalError: "Google Messages login was invalidated, please re-link the bridge",
|
||||
GMFatalError: "Google Messages token was invalidated, please re-link the bridge",
|
||||
GMUnpaired: "The bridge was unpaired from Google Messages, please re-link the bridge",
|
||||
GMBrowserInactive: "Google Messages opened in another browser",
|
||||
GMBrowserInactiveTimeout: "Google Messages disconnected due to timeout",
|
||||
GMBrowserInactiveInactivity: "Google Messages disconnected due to inactivity",
|
||||
|
|
|
@ -23,6 +23,7 @@ func (c *Client) handlePairingEvent(response *pblite.Response) {
|
|||
}
|
||||
case *binary.PairEvents_Revoked:
|
||||
c.Logger.Debug().Any("data", evt).Msg("Revoked Device")
|
||||
c.triggerEvent(evt.Revoked)
|
||||
default:
|
||||
c.Logger.Debug().Any("response", response).Any("evt", evt).Msg("Invalid PairEvents type")
|
||||
}
|
||||
|
|
6
user.go
6
user.go
|
@ -546,6 +546,12 @@ func (user *User) HandleEvent(event interface{}) {
|
|||
if err != nil {
|
||||
user.zlog.Err(err).Msg("Failed to update session in database")
|
||||
}
|
||||
case *binary.RevokePairData:
|
||||
user.zlog.Info().Any("revoked_device", v.GetRevokedDevice()).Msg("Got pair revoked event")
|
||||
user.Logout(status.BridgeState{
|
||||
StateEvent: status.StateBadCredentials,
|
||||
Error: GMUnpaired,
|
||||
}, false)
|
||||
case *events.AuthTokenRefreshed:
|
||||
err := user.Update(context.TODO())
|
||||
if err != nil {
|
||||
|
|
Loading…
Reference in a new issue