From 62a55a6fec96a2fc3938ff76a4b9694ad5de3d05 Mon Sep 17 00:00:00 2001 From: Dan Ballard Date: Sun, 6 Jun 2021 10:40:58 -0700 Subject: [PATCH 1/4] api call for QueryACNVersion --- lib.go | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/lib.go b/lib.go index c01444a..de59552 100644 --- a/lib.go +++ b/lib.go @@ -570,6 +570,15 @@ func ResetTor() { globalACN.Restart() } +//export c_QueryACNVersion +func c_QueryACNVersion() { + QueryACNVersion() +} + +func QueryACNVersion() { + application.QueryACNVersion() +} + //export c_CreateGroup func c_CreateGroup(profile_ptr *C.char, profile_len C.int, server_ptr *C.char, server_len C.int, name_ptr *C.char, name_len C.int) { profile := C.GoStringN(profile_ptr, profile_len) From 9b1814e43d3a4587c1c2dde3466ac10b1098d9fb Mon Sep 17 00:00:00 2001 From: Sarah Jamie Lewis Date: Wed, 9 Jun 2021 11:25:39 -0700 Subject: [PATCH 2/4] Add UpdateMessageFlags --- go.mod | 6 +++--- go.sum | 8 ++++++++ lib.go | 18 ++++++++++++++++++ 3 files changed, 29 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index a2f75ba..506fab5 100644 --- a/go.mod +++ b/go.mod @@ -3,8 +3,8 @@ module git.openprivacy.ca/flutter/libcwtch-go go 1.15 require ( - cwtch.im/cwtch v0.8.5 - git.openprivacy.ca/openprivacy/connectivity v1.4.3 + cwtch.im/cwtch v0.8.7 + git.openprivacy.ca/openprivacy/connectivity v1.4.4 git.openprivacy.ca/openprivacy/log v1.0.2 golang.org/x/mobile v0.0.0-20210220033013-bdb1ca9a1e08 // indirect -) \ No newline at end of file +) diff --git a/go.sum b/go.sum index 44ab9e4..4b71769 100644 --- a/go.sum +++ b/go.sum @@ -4,14 +4,22 @@ cwtch.im/cwtch v0.8.3 h1:HmMD+Lso5kZsYGZ6ak4nNkzIyPw1hFasw6BUglQgodA= cwtch.im/cwtch v0.8.3/go.mod h1:+SY/4ueF1U7mK+CX8hZFbtd+GC1lx/cReo110KgtQAw= cwtch.im/cwtch v0.8.5 h1:W67jAF2oRwqWytbZEv1UeCqW0cU2x69tgUw8iy27xFA= cwtch.im/cwtch v0.8.5/go.mod h1:5GHxaaeVnKeXSU64IvtCKzkqhU8DRiLoVM+tiBT8kkc= +cwtch.im/cwtch v0.8.6 h1:V1cQIDlVijvwJAfQLMY0hbT8FsjrgkWm5ADITQR60qY= +cwtch.im/cwtch v0.8.6/go.mod h1:D9dtO+WnKqdmufKSfFeFlUYaxLTfE/RtqVe1OD0kiKc= +cwtch.im/cwtch v0.8.7 h1:SgXU4yvyhh+5pl2ITt2fQBAFcFk2ZHhxcs5PUmkJEL4= +cwtch.im/cwtch v0.8.7/go.mod h1:D9dtO+WnKqdmufKSfFeFlUYaxLTfE/RtqVe1OD0kiKc= git.openprivacy.ca/cwtch.im/tapir v0.4.1 h1:9LMpQX41IzecNNlRc1FZKXHg6wlFss679tFsa3vzb3Y= git.openprivacy.ca/cwtch.im/tapir v0.4.1/go.mod h1:eH6dZxXrhW0C4KZX18ksUa6XJCrEvtg8cJJ/Fy6gv+E= git.openprivacy.ca/cwtch.im/tapir v0.4.2 h1:bxMWZnVJXX4dqqOFS7ELW4iFkVL4GS8wiRkjRv5rJe8= git.openprivacy.ca/cwtch.im/tapir v0.4.2/go.mod h1:eH6dZxXrhW0C4KZX18ksUa6XJCrEvtg8cJJ/Fy6gv+E= +git.openprivacy.ca/cwtch.im/tapir v0.4.3 h1:sctSfUXHDIqaHfJPDl+5lHtmoEJolQiHTcHZGAe5Qc4= +git.openprivacy.ca/cwtch.im/tapir v0.4.3/go.mod h1:10qEaib5x021zgyZ/97JKWsEpedH5+Vfy2CvB2V+08E= git.openprivacy.ca/openprivacy/bine v0.0.4 h1:CO7EkGyz+jegZ4ap8g5NWRuDHA/56KKvGySR6OBPW+c= git.openprivacy.ca/openprivacy/bine v0.0.4/go.mod h1:13ZqhKyqakDsN/ZkQkIGNULsmLyqtXc46XBcnuXm/mU= git.openprivacy.ca/openprivacy/connectivity v1.4.3 h1:i2Ad/U9FlL9dKr2bhRck7lJ8NoWyGtoEfUwoCyMT0fU= git.openprivacy.ca/openprivacy/connectivity v1.4.3/go.mod h1:bR0Myx9nm2YzWtsThRelkNMV4Pp7sPDa123O1qsAbVo= +git.openprivacy.ca/openprivacy/connectivity v1.4.4 h1:11M3akVCyy/luuhMpZTM1r9Jayl7IHD944Bxsn2FDpU= +git.openprivacy.ca/openprivacy/connectivity v1.4.4/go.mod h1:JVRCIdL+lAG6ohBFWiKeC/MN42nnC0sfFszR9XG6vPQ= git.openprivacy.ca/openprivacy/log v1.0.1/go.mod h1:gGYK8xHtndRLDymFtmjkG26GaMQNgyhioNS82m812Iw= git.openprivacy.ca/openprivacy/log v1.0.2 h1:HLP4wsw4ljczFAelYnbObIs821z+jgMPCe8uODPnGQM= git.openprivacy.ca/openprivacy/log v1.0.2/go.mod h1:gGYK8xHtndRLDymFtmjkG26GaMQNgyhioNS82m812Iw= diff --git a/lib.go b/lib.go index 3bf81d8..a525864 100644 --- a/lib.go +++ b/lib.go @@ -454,6 +454,24 @@ func NumMessages(profile, handle string) (n int) { return } +//export c_UpdateMessageFlags +func c_UpdateMessageFlags(profile_ptr *C.char, profile_len C.int, handle_ptr *C.char, handle_len C.int, mIdx C.int, message_flags C.uint) { + profile := C.GoStringN(profile_ptr, profile_len) + handle := C.GoStringN(handle_ptr, handle_len) + UpdateMessageFlags(profile, handle, int(mIdx), uint64(message_flags)) +} + + +// UpdateMessageFlags sets the messages flags on a given message for a given profile. +func UpdateMessageFlags(profileOnion, handle string, mIdx int, flags uint64) { + profile := application.GetPeer(profileOnion) + if profile != nil { + profile.UpdateMessageFlags(handle, mIdx, flags) + } else { + log.Errorf("called updatemessageflags with invalid profile onion") + } +} + //export c_GetMessage func c_GetMessage(profile_ptr *C.char, profile_len C.int, handle_ptr *C.char, handle_len C.int, message_index C.int) *C.char { profile := C.GoStringN(profile_ptr, profile_len) From 2b86f7b28295c1fb7e9e71830e53d2e652229d9c Mon Sep 17 00:00:00 2001 From: Sarah Jamie Lewis Date: Wed, 9 Jun 2021 11:57:20 -0700 Subject: [PATCH 3/4] Use int64 for UpdateMessageFlags api so gomobile can generate it --- go.mod | 3 ++- go.sum | 4 ++++ lib.go | 9 +++++---- 3 files changed, 11 insertions(+), 5 deletions(-) diff --git a/go.mod b/go.mod index 506fab5..d949202 100644 --- a/go.mod +++ b/go.mod @@ -6,5 +6,6 @@ require ( cwtch.im/cwtch v0.8.7 git.openprivacy.ca/openprivacy/connectivity v1.4.4 git.openprivacy.ca/openprivacy/log v1.0.2 - golang.org/x/mobile v0.0.0-20210220033013-bdb1ca9a1e08 // indirect + golang.org/x/mobile v0.0.0-20210527171505-7e972142eb43 // indirect + golang.org/x/sys v0.0.0-20210608053332-aa57babbf139 // indirect ) diff --git a/go.sum b/go.sum index 4b71769..eb2f312 100644 --- a/go.sum +++ b/go.sum @@ -70,6 +70,8 @@ golang.org/x/lint v0.0.0-20210508222113-6edffad5e616/go.mod h1:3xt1FjdF8hUf6vQPI golang.org/x/mobile v0.0.0-20190312151609-d3739f865fa6/go.mod h1:z+o9i4GpDbdi3rU15maQ/Ox0txvL9dWGYEHz965HBQE= golang.org/x/mobile v0.0.0-20210220033013-bdb1ca9a1e08 h1:h+GZ3ubjuWaQjGe8owMGcmMVCqs0xYJtRG5y2bpHaqU= golang.org/x/mobile v0.0.0-20210220033013-bdb1ca9a1e08/go.mod h1:skQtrUTUwhdJvXM/2KKJzY8pDgNr9I/FOMqDVRPBUS4= +golang.org/x/mobile v0.0.0-20210527171505-7e972142eb43 h1:YfX4EDYuRrJhCu1S8M+jsXVoQj+koh5ZIwpI7bzeQ38= +golang.org/x/mobile v0.0.0-20210527171505-7e972142eb43/go.mod h1:jFTmtFYCV0MFtXBU+J5V/+5AUeVS0ON/0WkE/KSrl6E= golang.org/x/mod v0.1.0/go.mod h1:0QHyrYULN0/3qlju5TqG8bIK38QM8yzMo5ekMj3DlcY= golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg= golang.org/x/mod v0.1.1-0.20191209134235-331c550502dd h1:ePuNC7PZ6O5BzgPn9bZayERXBdfZjUYoXEf5BTfDfh8= @@ -95,6 +97,8 @@ golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44 h1:Bli41pIlzTzf3KEY06n+xnzK/ golang.org/x/sys v0.0.0-20210330210617-4fbd30eecc44/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= golang.org/x/sys v0.0.0-20210510120138-977fb7262007 h1:gG67DSER+11cZvqIMb8S8bt0vZtiN6xWYARwirrOSfE= golang.org/x/sys v0.0.0-20210510120138-977fb7262007/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20210608053332-aa57babbf139 h1:C+AwYEtBp/VQwoLntUmQ/yx3MS9vmZaKNdw5eOpoQe8= +golang.org/x/sys v0.0.0-20210608053332-aa57babbf139/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1 h1:v+OssWQX+hTHEmOBgwxdZxK4zHq3yOs8F9J7mk0PY8E= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= diff --git a/lib.go b/lib.go index a525864..e400ccf 100644 --- a/lib.go +++ b/lib.go @@ -455,18 +455,19 @@ func NumMessages(profile, handle string) (n int) { } //export c_UpdateMessageFlags -func c_UpdateMessageFlags(profile_ptr *C.char, profile_len C.int, handle_ptr *C.char, handle_len C.int, mIdx C.int, message_flags C.uint) { +func c_UpdateMessageFlags(profile_ptr *C.char, profile_len C.int, handle_ptr *C.char, handle_len C.int, mIdx C.int, message_flags C.ulong) { profile := C.GoStringN(profile_ptr, profile_len) handle := C.GoStringN(handle_ptr, handle_len) - UpdateMessageFlags(profile, handle, int(mIdx), uint64(message_flags)) + UpdateMessageFlags(profile, handle, int(mIdx), int64(message_flags)) } // UpdateMessageFlags sets the messages flags on a given message for a given profile. -func UpdateMessageFlags(profileOnion, handle string, mIdx int, flags uint64) { +// gomobile doesn't support uint64...so here we are.... +func UpdateMessageFlags(profileOnion, handle string, mIdx int, flags int64) { profile := application.GetPeer(profileOnion) if profile != nil { - profile.UpdateMessageFlags(handle, mIdx, flags) + profile.UpdateMessageFlags(handle, mIdx, uint64(flags)) } else { log.Errorf("called updatemessageflags with invalid profile onion") } From 936c45f234c30f92c17cf0cf1c13556df8b53160 Mon Sep 17 00:00:00 2001 From: Sarah Jamie Lewis Date: Thu, 10 Jun 2021 10:59:22 -0700 Subject: [PATCH 4/4] Upgrade cwtch --- go.mod | 2 +- go.sum | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/go.mod b/go.mod index d949202..9e35047 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module git.openprivacy.ca/flutter/libcwtch-go go 1.15 require ( - cwtch.im/cwtch v0.8.7 + cwtch.im/cwtch v0.8.8 git.openprivacy.ca/openprivacy/connectivity v1.4.4 git.openprivacy.ca/openprivacy/log v1.0.2 golang.org/x/mobile v0.0.0-20210527171505-7e972142eb43 // indirect diff --git a/go.sum b/go.sum index eb2f312..0069a99 100644 --- a/go.sum +++ b/go.sum @@ -8,6 +8,8 @@ cwtch.im/cwtch v0.8.6 h1:V1cQIDlVijvwJAfQLMY0hbT8FsjrgkWm5ADITQR60qY= cwtch.im/cwtch v0.8.6/go.mod h1:D9dtO+WnKqdmufKSfFeFlUYaxLTfE/RtqVe1OD0kiKc= cwtch.im/cwtch v0.8.7 h1:SgXU4yvyhh+5pl2ITt2fQBAFcFk2ZHhxcs5PUmkJEL4= cwtch.im/cwtch v0.8.7/go.mod h1:D9dtO+WnKqdmufKSfFeFlUYaxLTfE/RtqVe1OD0kiKc= +cwtch.im/cwtch v0.8.8 h1:NGe7HlScpCf5Me/35P9G+mo6dE5KgubVBfztGIEWxvc= +cwtch.im/cwtch v0.8.8/go.mod h1:D9dtO+WnKqdmufKSfFeFlUYaxLTfE/RtqVe1OD0kiKc= git.openprivacy.ca/cwtch.im/tapir v0.4.1 h1:9LMpQX41IzecNNlRc1FZKXHg6wlFss679tFsa3vzb3Y= git.openprivacy.ca/cwtch.im/tapir v0.4.1/go.mod h1:eH6dZxXrhW0C4KZX18ksUa6XJCrEvtg8cJJ/Fy6gv+E= git.openprivacy.ca/cwtch.im/tapir v0.4.2 h1:bxMWZnVJXX4dqqOFS7ELW4iFkVL4GS8wiRkjRv5rJe8=