Make ‘var’ attribute of a Field optional
Looking at [the spec](https://xmpp.org/extensions/xep-0004.html#protocol-field) it seems valid not to have a `var` attribute set, at least for fields of type `fixed` that is: > If the element type is anything other than "fixed" (see below), it MUST > possess a 'var' attribute that uniquely identifies the field in the context > of the form (if it is "fixed", it MAY possess a 'var' attribute). The element > MAY possess a 'label' attribute that defines a human-readable name for the field.
This commit is contained in:
parent
079379a178
commit
ac0707e52d
7 changed files with 71 additions and 24 deletions
|
|
@ -127,10 +127,12 @@ fn compute_extensions(extensions: &[DataForm]) -> Vec<u8> {
|
|||
}
|
||||
bytes.push(b'<');
|
||||
for field in extension.fields.clone() {
|
||||
if field.var == "FORM_TYPE" {
|
||||
if field.var.as_deref() == Some("FORM_TYPE") {
|
||||
continue;
|
||||
}
|
||||
bytes.append(&mut compute_item(&field.var));
|
||||
if let Some(var) = &field.var {
|
||||
bytes.append(&mut compute_item(var));
|
||||
}
|
||||
bytes.append(&mut compute_items(&field.values, |value| {
|
||||
compute_item(value)
|
||||
}));
|
||||
|
|
|
|||
Loading…
Reference in a new issue