forked from MirrorHub/mautrix-whatsapp
Respond to bridge state ping with unconfigured if there's no session
This commit is contained in:
parent
52484dc992
commit
b2878d5d34
1 changed files with 10 additions and 4 deletions
|
@ -213,10 +213,11 @@ func (prov *ProvisioningAPI) BridgeStatePing(w http.ResponseWriter, r *http.Requ
|
|||
user := prov.bridge.GetUserByMXID(id.UserID(userID))
|
||||
var resp BridgeState
|
||||
if user.Conn == nil {
|
||||
resp.StateEvent = StateBadCredentials
|
||||
if user.Session == nil {
|
||||
resp.StateEvent = StateUnconfigured
|
||||
resp.Error = WANotLoggedIn
|
||||
} else {
|
||||
resp.StateEvent = StateBadCredentials
|
||||
resp.Error = WANotConnected
|
||||
}
|
||||
} else {
|
||||
|
@ -248,11 +249,16 @@ func (prov *ProvisioningAPI) BridgeStatePing(w http.ResponseWriter, r *http.Requ
|
|||
resp.StateEvent = StateConnecting
|
||||
resp.Error = WAConnecting
|
||||
} else if user.Conn.IsConnected() {
|
||||
resp.StateEvent = StateBadCredentials
|
||||
resp.StateEvent = StateUnconfigured
|
||||
resp.Error = WANotLoggedIn
|
||||
} else {
|
||||
resp.StateEvent = StateBadCredentials
|
||||
resp.Error = WANotConnected
|
||||
if user.Session == nil {
|
||||
resp.StateEvent = StateUnconfigured
|
||||
resp.Error = WANotLoggedIn
|
||||
} else {
|
||||
resp.StateEvent = StateBadCredentials
|
||||
resp.Error = WANotConnected
|
||||
}
|
||||
}
|
||||
}
|
||||
resp = resp.fill(user)
|
||||
|
|
Loading…
Reference in a new issue