From 772246ee4b78883ebacdf594e1fc1d485dcb3a58 Mon Sep 17 00:00:00 2001 From: Bohdan Horbeshko Date: Sat, 10 Feb 2024 15:22:24 -0500 Subject: [PATCH] Mark required fields in forms --- xmpp/handlers.go | 10 ++++++++-- 1 file 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{