From 3617b991c81f985f67c8eb5b8d746b38d31cb1d5 Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Sat, 30 Jul 2022 11:30:44 +0300 Subject: [PATCH] Update whatsmeow --- database/historysync.go | 11 ++++++----- go.mod | 2 +- go.sum | 6 ++---- main.go | 4 ++-- portal.go | 12 ++++++------ 5 files changed, 17 insertions(+), 18 deletions(-) diff --git a/database/historysync.go b/database/historysync.go index 16d9d4b..517ba4e 100644 --- a/database/historysync.go +++ b/database/historysync.go @@ -22,9 +22,10 @@ import ( "fmt" "time" - waProto "go.mau.fi/whatsmeow/binary/proto" "google.golang.org/protobuf/proto" + waProto "go.mau.fi/whatsmeow/binary/proto" + _ "github.com/mattn/go-sqlite3" log "maunium.net/go/maulogger/v2" @@ -48,8 +49,8 @@ type HistorySyncConversation struct { MuteEndTime time.Time Archived bool Pinned uint32 - DisappearingMode waProto.DisappearingMode_DisappearingModeInitiator - EndOfHistoryTransferType waProto.Conversation_ConversationEndOfHistoryTransferType + DisappearingMode waProto.DisappearingMode_Initiator + EndOfHistoryTransferType waProto.Conversation_EndOfHistoryTransferType EphemeralExpiration *uint32 MarkedAsUnread bool UnreadCount uint32 @@ -71,8 +72,8 @@ func (hsq *HistorySyncQuery) NewConversationWithValues( muteEndTime uint64, archived bool, pinned uint32, - disappearingMode waProto.DisappearingMode_DisappearingModeInitiator, - endOfHistoryTransferType waProto.Conversation_ConversationEndOfHistoryTransferType, + disappearingMode waProto.DisappearingMode_Initiator, + endOfHistoryTransferType waProto.Conversation_EndOfHistoryTransferType, ephemeralExpiration *uint32, markedAsUnread bool, unreadCount uint32) *HistorySyncConversation { diff --git a/go.mod b/go.mod index 397780d..9f59909 100644 --- a/go.mod +++ b/go.mod @@ -10,7 +10,7 @@ require ( github.com/prometheus/client_golang v1.12.2-0.20220613221938-ebd77f036066 github.com/skip2/go-qrcode v0.0.0-20200617195104-da1b6568686e github.com/tidwall/gjson v1.14.1 - go.mau.fi/whatsmeow v0.0.0-20220715134127-5e6b9804193a + go.mau.fi/whatsmeow v0.0.0-20220730081540-aaaedc8d029a golang.org/x/image v0.0.0-20220617043117-41969df76e82 golang.org/x/net v0.0.0-20220624214902-1bab6f366d9e google.golang.org/protobuf v1.28.0 diff --git a/go.sum b/go.sum index a8fa04e..7da2399 100644 --- a/go.sum +++ b/go.sum @@ -64,10 +64,8 @@ github.com/yuin/goldmark v1.4.12 h1:6hffw6vALvEDqJ19dOJvJKOoAOKe4NDaTqvd2sktGN0= github.com/yuin/goldmark v1.4.12/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= go.mau.fi/libsignal v0.0.0-20220628090436-4d18b66b087e h1:ByHDg+D+dMIGuBA2n+1xOUf4xr3FJFYg8yxl06s1YBE= go.mau.fi/libsignal v0.0.0-20220628090436-4d18b66b087e/go.mod h1:RCdzkTWSJv0AKGqurzPXJsEGIVMuQps3E/h7CMUPous= -go.mau.fi/whatsmeow v0.0.0-20220711111122-6340068d67de h1:ZrxHSdpUGODtCtq/0A6CXisEgWtcNwK6BGG4f+WVTlM= -go.mau.fi/whatsmeow v0.0.0-20220711111122-6340068d67de/go.mod h1:hsjqq2xLuoFew8vbsDCJcGf5EbXCRcR/yoQ+87w6m3k= -go.mau.fi/whatsmeow v0.0.0-20220715134127-5e6b9804193a h1:Ki4Y9d+qW/ED+7gsQ26AlQxUUyZOQ9bQEiVyjTWRmCQ= -go.mau.fi/whatsmeow v0.0.0-20220715134127-5e6b9804193a/go.mod h1:hsjqq2xLuoFew8vbsDCJcGf5EbXCRcR/yoQ+87w6m3k= +go.mau.fi/whatsmeow v0.0.0-20220730081540-aaaedc8d029a h1:qcvm6PdqfmNmO/Kg2BFqFCt5tNZa4acptVebNVyq6i4= +go.mau.fi/whatsmeow v0.0.0-20220730081540-aaaedc8d029a/go.mod h1:hsjqq2xLuoFew8vbsDCJcGf5EbXCRcR/yoQ+87w6m3k= golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d h1:sK3txAijHtOK88l68nt020reeT1ZdKLIYetKl95FzVY= golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= golang.org/x/image v0.0.0-20220617043117-41969df76e82 h1:KpZB5pUSBvrHltNEdK/tw0xlPeD13M6M6aGP32gKqiw= diff --git a/main.go b/main.go index 7c88eea..2e5355c 100644 --- a/main.go +++ b/main.go @@ -119,9 +119,9 @@ func (br *WABridge) Init() { store.DeviceProps.Version.Secondary = proto.Uint32(uint32(secondary)) store.DeviceProps.Version.Tertiary = proto.Uint32(uint32(tertiary)) } - platformID, ok := waProto.DeviceProps_DevicePropsPlatformType_value[strings.ToUpper(br.Config.WhatsApp.BrowserName)] + platformID, ok := waProto.DeviceProps_PlatformType_value[strings.ToUpper(br.Config.WhatsApp.BrowserName)] if ok { - store.DeviceProps.PlatformType = waProto.DeviceProps_DevicePropsPlatformType(platformID).Enum() + store.DeviceProps.PlatformType = waProto.DeviceProps_PlatformType(platformID).Enum() } } diff --git a/portal.go b/portal.go index 12f23e8..820670e 100644 --- a/portal.go +++ b/portal.go @@ -1823,15 +1823,15 @@ func (portal *Portal) convertTemplateMessage(intent *appservice.IntentAPI, sourc var convertedTitle *ConvertedMessage switch title := tpl.GetTitle().(type) { - case *waProto.HydratedFourRowTemplate_DocumentMessage: + case *waProto.TemplateMessage_HydratedFourRowTemplate_DocumentMessage: convertedTitle = portal.convertMediaMessage(intent, source, info, title.DocumentMessage, "file attachment", false) - case *waProto.HydratedFourRowTemplate_ImageMessage: + case *waProto.TemplateMessage_HydratedFourRowTemplate_ImageMessage: convertedTitle = portal.convertMediaMessage(intent, source, info, title.ImageMessage, "photo", false) - case *waProto.HydratedFourRowTemplate_VideoMessage: + case *waProto.TemplateMessage_HydratedFourRowTemplate_VideoMessage: convertedTitle = portal.convertMediaMessage(intent, source, info, title.VideoMessage, "video attachment", false) - case *waProto.HydratedFourRowTemplate_LocationMessage: + case *waProto.TemplateMessage_HydratedFourRowTemplate_LocationMessage: content = fmt.Sprintf("Unsupported location message\n\n%s", content) - case *waProto.HydratedFourRowTemplate_HydratedTitleText: + case *waProto.TemplateMessage_HydratedFourRowTemplate_HydratedTitleText: content = fmt.Sprintf("%s\n\n%s", title.HydratedTitleText, content) } @@ -2646,7 +2646,7 @@ func (portal *Portal) handleMediaRetry(retry *events.MediaRetry, source *User) { portal.sendMediaRetryFailureEdit(intent, msg, err) return } else if retryData.GetResult() != waProto.MediaRetryNotification_SUCCESS { - errorName := waProto.MediaRetryNotification_MediaRetryNotificationResultType_name[int32(retryData.GetResult())] + errorName := waProto.MediaRetryNotification_ResultType_name[int32(retryData.GetResult())] if retryData.GetDirectPath() == "" { portal.log.Warnfln("Got error response in media retry notification for %s: %s", retry.MessageID, errorName) portal.log.Debugfln("Error response contents: %+v", retryData)