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)