Mark required fields in forms

This commit is contained in:
Bohdan Horbeshko 2024-02-10 15:22:24 -05:00
parent b0c5302c82
commit 772246ee4b

View file

@ -759,9 +759,15 @@ func handleSetQueryCommand(s xmpp.Sender, iq *stanza.IQ, command *stanza.Command
if ok && len(cmd.Arguments) > 0 {
var fields []*stanza.Field
for i, arg := range cmd.Arguments {
var required *string
if i < cmd.RequiredArgs {
dummyString := ""
required = &dummyString
}
fields = append(fields, &stanza.Field{
Var: strconv.FormatInt(int64(i), 10),
Label: arg,
Required: required,
})
}
answer.Payload = &stanza.Command{