aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBohdan Horbeshko <bodqhrohro@gmail.com>2024-02-10 23:22:24 +0300
committerBohdan Horbeshko <bodqhrohro@gmail.com>2024-02-10 23:22:24 +0300
commit772246ee4b78883ebacdf594e1fc1d485dcb3a58 (patch)
tree2e85aace1e3c50ffc07f3a26c86550a7a7ee9372
parentb0c5302c82b78c2f83ef12545437f31ab5406927 (diff)
Mark required fields in forms
-rw-r--r--xmpp/handlers.go10
1 files changed, 8 insertions, 2 deletions
diff --git a/xmpp/handlers.go b/xmpp/handlers.go
index 1885aae..08278d2 100644
--- a/xmpp/handlers.go
+++ b/xmpp/handlers.go
@@ -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,
+ Var: strconv.FormatInt(int64(i), 10),
+ Label: arg,
+ Required: required,
})
}
answer.Payload = &stanza.Command{