diff --git a/lib.go b/lib.go index 7bd9d41..ed64fb9 100644 --- a/lib.go +++ b/lib.go @@ -521,5 +521,24 @@ func ImportBundle(profileOnion string, bundle string) { } } +//export c_SetGroupAttribute +func c_SetGroupAttribute(profile_ptr *C.char, profile_len C.int, group_ptr *C.char, group_len C.int, key_ptr *C.char, key_len C.int, val_ptr *C.char, val_len C.int) { + profileOnion := C.GoStringN(profile_ptr, profile_len) + groupHandle := C.GoStringN(group_ptr, group_len) + key := C.GoStringN(key_ptr, key_len) + value := C.GoStringN(val_ptr, val_len) + SetGroupAttribute(profileOnion, groupHandle, key, value) +} + +// SetGroupAttribute provides a wrapper around profile.SetGroupAttribute, gated by global experiments... +func SetGroupAttribute(profileOnion string, groupHandle string, key string, value string) { + profile := application.GetPeer(profileOnion) + _, err := groups.ExperimentGate(utils.ReadGlobalSettings().Experiments) + if err == nil { + profile.SetGroupAttribute(groupHandle, key, value) + } +} + + // Leave as is, needed by ffi func main() {}