Merge pull request 'Set Group Attribute' (#28) from groups into trunk
continuous-integration/drone/push Build is failing Details

Reviewed-on: #28
This commit is contained in:
erinn 2021-04-23 13:02:24 -07:00
commit 65fd80b21a
2 changed files with 20 additions and 0 deletions

19
lib.go
View File

@ -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() {}

View File

@ -130,6 +130,7 @@ func (eh *EventHandler) handleAppBusEvent(e *event.Event) string {
if err == nil {
servers = append(servers, groupHandler.GetServerInfo(contact, profile))
}
continue
}
contactInfo := profile.GetContact(contact)