~samwhited/xmpp

xmpp/form d---------
form: add Iter interface

The form.Iter interface will be implemented by handlers that need to
advertise disco info extensions.

Signed-off-by: Sam Whited <sam@samwhited.com>
form: add Len and Raw methods

Signed-off-by: Sam Whited <sam@samwhited.com>
form: provide access to fixed fields with no var

The data forms spec says that fixed fields do not have to have a
variable name since they can't be set anyways.
However, we currently rely on the variable name to get the value of
fields when iterating over all fields in a form.
This patch adds the raw, wire-format, untyped value of each field to its
data when iterating so that it can be used for fixed fields that cannot
be referenced otherwise, and for debugging.

Signed-off-by: Sam Whited <sam@samwhited.com>
all: generate disco features

Signed-off-by: Sam Whited <sam@samwhited.com>
form: fix panic when unmarshaling form

Previously unmarshaling a form did not create the fields map, resulting
in a panic when calling Set. This could have also resulted in a leak of
information across form if the map already existed and a previously used
form was being reused.

Signed-off-by: Sam Whited <sam@samwhited.com>
form: remove unused field

Signed-off-by: Sam Whited <sam@samwhited.com>
form: remove unnecessary loop

Signed-off-by: Sam Whited <sam@samwhited.com>
form: remove unnecessary return

Signed-off-by: Sam Whited <sam@samwhited.com>
form: text is the default type of a field

Previously if the type attribute was left off of a field we would error,
but we should be using text-single as the default type.

Signed-off-by: Sam Whited <sam@samwhited.com>
form: skip chardata when unmarshaling forms

Signed-off-by: Sam Whited <sam@samwhited.com>
receipts, form_test: typo fixes

Signed-off-by: Sam Whited <sam@samwhited.com>
form: fix (and test) xmlstream.WriterTo impl

Signed-off-by: Sam Whited <sam@samwhited.com>
form: rewrite package (again)

Using a hybrid of our previous two approaches (functional options based
and struct based) we can hide most of the gritty details, make
validation of forms easier, and provide a somewhat nicer API that
doesn't look like an absolute mess.

Signed-off-by: Sam Whited <sam@samwhited.com>
form: revert "rewrite package to use a struct based API"

This reverts commit 50475d95942b4eb7b6c43e11cdb64623211d4246.

Signed-off-by: Sam Whited <sam@samwhited.com>
form: revert "fix list encoding"

This reverts commit 482ebfc70b447e675cb8bd42c1c0bf6bccf4af0b.

Signed-off-by: Sam Whited <sam@samwhited.com>
form: fix list encoding

Previously this was just rendering raw strings into the list. This is
what I get for doing a rewrite without tests late at night on the
weekend.

This patch also merges ListMulti and List which don't really need to be
two different structs.

Signed-off-by: Sam Whited <sam@samwhited.com>
form: rewrite package to use a struct based API

Previously we had been experimenting with a function-based DSL for forms
and fields, but it hadn't been well thought out and wasn't very Go-like.
Using structs will be simpler and easier to maintain going forward even
if Go types can't perfectly model XMPP forms.

Signed-off-by: Sam Whited <sam@samwhited.com>
form: implement XML interfaces

Implement xmlstream.Marshaler, xmlstream.WriterTo, and xml.Marshaler for
forms.

Signed-off-by: Sam Whited <sam@samwhited.com>
all: update copyright message

[ci skip]
all: rewrap copyright comments/use xml.TokenReader
Next