Update vendor (whatsapp)

This commit is contained in:
Wim
2022-03-12 23:02:04 +01:00
parent 1b9877fda4
commit aefa70891c
206 changed files with 367071 additions and 164229 deletions

View File

@@ -33,7 +33,7 @@ func (cli *Client) handleStreamError(node *waBinary.Node) {
case code == "401" && conflictType == "device_removed":
cli.expectDisconnect()
cli.Log.Infof("Got device removed stream error, sending LoggedOut event and deleting session")
go cli.dispatchEvent(&events.LoggedOut{OnConnect: false})
go cli.dispatchEvent(&events.LoggedOut{OnConnect: false, Reason: events.ConnectFailureLoggedOut})
err := cli.Store.Delete()
if err != nil {
cli.Log.Warnf("Failed to delete store after device_removed error: %v", err)
@@ -77,17 +77,30 @@ func (cli *Client) handleIB(node *waBinary.Node) {
func (cli *Client) handleConnectFailure(node *waBinary.Node) {
ag := node.AttrGetter()
reason := ag.String("reason")
if reason == "401" {
cli.expectDisconnect()
cli.Log.Infof("Got 401 connect failure, sending LoggedOut event and deleting session")
go cli.dispatchEvent(&events.LoggedOut{OnConnect: true})
reason := events.ConnectFailureReason(ag.Int("reason"))
cli.expectDisconnect()
if reason.IsLoggedOut() {
cli.Log.Infof("Got %s connect failure, sending LoggedOut event and deleting session", reason)
go cli.dispatchEvent(&events.LoggedOut{OnConnect: true, Reason: reason})
err := cli.Store.Delete()
if err != nil {
cli.Log.Warnf("Failed to delete store after 401 failure: %v", err)
cli.Log.Warnf("Failed to delete store after %d failure: %v", int(reason), err)
}
} else if reason == events.ConnectFailureTempBanned {
cli.Log.Warnf("Temporary ban connect failure: %s", node.XMLString())
expiryTimeUnix := ag.Int64("expire")
var expiryTime time.Time
if expiryTimeUnix > 0 {
expiryTime = time.Unix(expiryTimeUnix, 0)
}
go cli.dispatchEvent(&events.TemporaryBan{
Code: events.TempBanReason(ag.Int("code")),
Expire: expiryTime,
})
} else if reason == events.ConnectFailureClientOutdated {
cli.Log.Errorf("Client outdated (405) connect failure")
go cli.dispatchEvent(&events.ClientOutdated{})
} else {
cli.expectDisconnect()
cli.Log.Warnf("Unknown connect failure: %s", node.XMLString())
go cli.dispatchEvent(&events.ConnectFailure{Reason: reason, Raw: node})
}