mirror of
https://github.com/mautrix/whatsapp.git
synced 2025-03-14 14:15:38 +00:00
dependencies: update mautrix-go and send error state if connect fails
This commit is contained in:
parent
3e9bf5a7fa
commit
5dabca8dda
4 changed files with 13 additions and 10 deletions
2
go.mod
2
go.mod
|
@ -18,7 +18,7 @@ require (
|
|||
golang.org/x/sync v0.9.0
|
||||
google.golang.org/protobuf v1.35.2
|
||||
gopkg.in/yaml.v3 v3.0.1
|
||||
maunium.net/go/mautrix v0.22.0
|
||||
maunium.net/go/mautrix v0.22.1-0.20241202131110-166ba04aae02
|
||||
)
|
||||
|
||||
require (
|
||||
|
|
4
go.sum
4
go.sum
|
@ -101,5 +101,5 @@ gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
|||
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
||||
maunium.net/go/mauflag v1.0.0 h1:YiaRc0tEI3toYtJMRIfjP+jklH45uDHtT80nUamyD4M=
|
||||
maunium.net/go/mauflag v1.0.0/go.mod h1:nLivPOpTpHnpzEh8jEdSL9UqO9+/KBJFmNRlwKfkPeA=
|
||||
maunium.net/go/mautrix v0.22.0 h1:nLrnLYiMyFV6qZPqpkNogkOPgm2dQTYiQXlu9Nc3rz8=
|
||||
maunium.net/go/mautrix v0.22.0/go.mod h1:oqwf9WYC/brqucM+heYk4gX11O59nP+ljvyxVhndFIM=
|
||||
maunium.net/go/mautrix v0.22.1-0.20241202131110-166ba04aae02 h1:g8L4GpOhyg5EuXtASDKyU9Cg79ZjATlUnh+giFumQgc=
|
||||
maunium.net/go/mautrix v0.22.1-0.20241202131110-166ba04aae02/go.mod h1:oqwf9WYC/brqucM+heYk4gX11O59nP+ljvyxVhndFIM=
|
||||
|
|
|
@ -148,21 +148,27 @@ func (wa *WhatsAppClient) IsThisUser(_ context.Context, userID networkid.UserID)
|
|||
return userID == waid.MakeUserID(wa.JID)
|
||||
}
|
||||
|
||||
func (wa *WhatsAppClient) Connect(ctx context.Context) error {
|
||||
func (wa *WhatsAppClient) Connect(ctx context.Context) {
|
||||
if wa.Client == nil {
|
||||
state := status.BridgeState{
|
||||
StateEvent: status.StateBadCredentials,
|
||||
Error: WANotLoggedIn,
|
||||
}
|
||||
wa.UserLogin.BridgeState.Send(state)
|
||||
return nil
|
||||
return
|
||||
}
|
||||
wa.Main.firstClientConnectOnce.Do(wa.Main.onFirstClientConnect)
|
||||
if err := wa.Main.updateProxy(ctx, wa.Client, false); err != nil {
|
||||
zerolog.Ctx(ctx).Err(err).Msg("Failed to update proxy")
|
||||
}
|
||||
wa.startLoops()
|
||||
return wa.Client.Connect()
|
||||
if err := wa.Client.Connect(); err != nil {
|
||||
state := status.BridgeState{
|
||||
StateEvent: status.StateUnknownError,
|
||||
Error: WAConnectionFailed,
|
||||
}
|
||||
wa.UserLogin.BridgeState.Send(state)
|
||||
}
|
||||
}
|
||||
|
||||
func (wa *WhatsAppClient) startLoops() {
|
||||
|
|
|
@ -319,10 +319,7 @@ func (wl *WALogin) Wait(ctx context.Context) (*bridgev2.LoginStep, error) {
|
|||
}
|
||||
|
||||
ul.Client.(*WhatsAppClient).isNewLogin = true
|
||||
err = ul.Client.Connect(ul.Log.WithContext(context.Background()))
|
||||
if err != nil {
|
||||
return nil, fmt.Errorf("failed to connect after login: %w", err)
|
||||
}
|
||||
ul.Client.Connect(ul.Log.WithContext(context.Background()))
|
||||
|
||||
return &bridgev2.LoginStep{
|
||||
Type: bridgev2.LoginStepTypeComplete,
|
||||
|
|
Loading…
Add table
Reference in a new issue