Expose new Enhanced Permission APIs
This commit is contained in:
parent
32ea146ec0
commit
425c3e6030
|
@ -96,7 +96,9 @@ func main() {
|
|||
case "profile":
|
||||
generatedBindings = generateProfileFunction(generatedBindings, fName, args)
|
||||
case "(json)profile":
|
||||
generatedBindings = generateJsonProfileFunction(generatedBindings, fName, args)
|
||||
generatedBindings = generateJsonProfileFunction(generatedBindings, fName, args, false)
|
||||
case "(json-err)profile":
|
||||
generatedBindings = generateJsonProfileFunction(generatedBindings, fName, args, true)
|
||||
case "@profile-experiment":
|
||||
experiment := args[0]
|
||||
generatedBindings = generateExperimentalProfileFunction(generatedBindings, experiment, fName, args[1:])
|
||||
|
@ -382,7 +384,7 @@ func {{FNAME}}({{GO_ARGS_SPEC}}) {
|
|||
return bindings
|
||||
}
|
||||
|
||||
func generateJsonProfileFunction(bindings string, name string, argsTypes []string) string {
|
||||
func generateJsonProfileFunction(bindings string, name string, argsTypes []string, handleErr bool) string {
|
||||
appPrototype := `
|
||||
//export c_{{FNAME}}
|
||||
func c_{{FNAME}}({{C_ARGS}}) *C.char {
|
||||
|
@ -392,14 +394,26 @@ func c_{{FNAME}}({{C_ARGS}}) *C.char {
|
|||
func {{FNAME}}({{GO_ARGS_SPEC}}) string {
|
||||
cwtchProfile := application.GetPeer(profile)
|
||||
if cwtchProfile != nil {
|
||||
return cwtchProfile.{{LIBNAME}}({{GO_ARG}})
|
||||
{{HANDLE_FUNC}}
|
||||
}
|
||||
return ""
|
||||
}
|
||||
`
|
||||
|
||||
noErrorPrototype := `return cwtchProfile.{{LIBNAME}}({{GO_ARG}})`
|
||||
withErrorPrototype := `res,err := cwtchProfile.{{LIBNAME}}({{GO_ARG}})
|
||||
if err != nil {
|
||||
log.Errorf("could not {{FNAME}} %v", err)
|
||||
}
|
||||
return res`
|
||||
functionPrototype := noErrorPrototype
|
||||
if handleErr {
|
||||
functionPrototype = withErrorPrototype
|
||||
}
|
||||
|
||||
cArgs, c2GoArgs, goSpec, gUse := mapArgs(argsTypes)
|
||||
|
||||
appPrototype = strings.ReplaceAll(appPrototype, "{{HANDLE_FUNC}}", functionPrototype)
|
||||
appPrototype = strings.ReplaceAll(appPrototype, "{{FNAME}}", strings.TrimPrefix(name, "Enhanced"))
|
||||
appPrototype = strings.ReplaceAll(appPrototype, "{{LIBNAME}}", name)
|
||||
// We need to prepend a set of profile handle arguments...
|
||||
|
|
|
@ -20,6 +20,7 @@ nilaway -include-pkgs="git.openprivacy.ca/cwtch.im/cwtch-autobindings,cwtch.im/c
|
|||
|
||||
echo "Time to format"
|
||||
gofmt -l -s -w ./utils/*
|
||||
gofmt -l -s -w ./generate/*
|
||||
|
||||
# ineffassign (https://github.com/gordonklaus/ineffassign)
|
||||
# echo "Checking for ineffectual assignment of errors (unchecked errors...)"
|
||||
|
|
2
spec
2
spec
|
@ -22,6 +22,8 @@ profile UnblockConversation conversation
|
|||
profile DeleteConversation conversation
|
||||
profile PeerWithOnion string:handle
|
||||
profile DisconnectFromPeer string:handle
|
||||
(json-err)profile EnhancedGetConversationAccessControlList conversation
|
||||
profile EnhancedUpdateConversationAccessControlList conversation string:json
|
||||
|
||||
# Search
|
||||
(json)profile SearchConversations string:pattern
|
||||
|
|
Loading…
Reference in New Issue