Upgrade Cwtch to v0.9.2
continuous-integration/drone/pr Build is passing Details

Also prevent NPE during delete contact state
This commit is contained in:
Sarah Jamie Lewis 2021-07-08 12:55:26 -07:00
parent 4d218df85d
commit df6c3dd84a
3 changed files with 32 additions and 28 deletions

2
go.mod
View File

@ -3,7 +3,7 @@ module git.openprivacy.ca/flutter/libcwtch-go
go 1.15
require (
cwtch.im/cwtch v0.9.1
cwtch.im/cwtch v0.9.2
git.openprivacy.ca/openprivacy/connectivity v1.4.5
git.openprivacy.ca/openprivacy/log v1.0.2
golang.org/x/sys v0.0.0-20210630005230-0f9fa26af87c // indirect

4
go.sum
View File

@ -1,5 +1,5 @@
cwtch.im/cwtch v0.9.1 h1:xv883HaHxZhSXOCsOmuXJiKZoS3GoxQ4zictS4vRWGM=
cwtch.im/cwtch v0.9.1/go.mod h1:EwUUVWIU4OAcz0HmHUxaY4orzKH6ZiNXaVI8y/5UP5k=
cwtch.im/cwtch v0.9.2 h1:daDJPDWJ3uwRZ/UYPkmhpxxA/G8/FtFAQwbIGhM24ng=
cwtch.im/cwtch v0.9.2/go.mod h1:EwUUVWIU4OAcz0HmHUxaY4orzKH6ZiNXaVI8y/5UP5k=
git.openprivacy.ca/cwtch.im/tapir v0.4.4 h1:KyuTVmr9GYptTCeR7JDODjmhBBbnIBf9V3NSC4+6bHc=
git.openprivacy.ca/cwtch.im/tapir v0.4.4/go.mod h1:qMFTdmDZITc1BLP1jSW0gVpLmvpg+Zjsh5ek8StwbFE=
git.openprivacy.ca/openprivacy/bine v0.0.4 h1:CO7EkGyz+jegZ4ap8g5NWRuDHA/56KKvGySR6OBPW+c=

4
lib.go
View File

@ -543,6 +543,7 @@ func GetMessage(profileOnion, handle string, message_index int) string {
profile := application.GetPeer(profileOnion)
ph := utils.NewPeerHelper(profile)
if ph.IsGroup(handle) {
if profile.GetGroup(handle) != nil {
// If we are safely within the limits of the timeline just grab the message at the index..
if len(profile.GetGroup(handle).Timeline.Messages) > message_index {
message.Message = profile.GetGroup(handle).Timeline.Messages[message_index]
@ -559,7 +560,9 @@ func GetMessage(profileOnion, handle string, message_index int) string {
log.Errorf("Couldn't find message in timeline or unacked messages, probably transient threading issue, but logging for visibility..")
}
}
}
} else {
if profile.GetContact(handle) != nil {
// If we are safely within the limits of the timeline just grab the message at the index..
if len(profile.GetContact(handle).Timeline.Messages) > message_index {
message.Message = profile.GetContact(handle).Timeline.Messages[message_index]
@ -576,6 +579,7 @@ func GetMessage(profileOnion, handle string, message_index int) string {
}
}
}
}
bytes, _ := json.Marshal(message)
return string(bytes)
}