roster: Make an empty name be None instead.
RFC 6121 §2.4.1: “Implementation Note: Including an empty 'name' attribute is equivalent to including no 'name' attribute; both actions set the name to the empty string.”
This commit is contained in:
parent
073e208f06
commit
7395e4b88f
1 changed files with 1 additions and 1 deletions
|
@ -70,7 +70,7 @@ impl TryFrom<Element> for Item {
|
||||||
|
|
||||||
let mut item = Item {
|
let mut item = Item {
|
||||||
jid: get_attr!(elem, "jid", required),
|
jid: get_attr!(elem, "jid", required),
|
||||||
name: get_attr!(elem, "name", optional),
|
name: get_attr!(elem, "name", optional).and_then(|name| if name == "" { None } else { Some(name) }),
|
||||||
subscription: get_attr!(elem, "subscription", optional),
|
subscription: get_attr!(elem, "subscription", optional),
|
||||||
groups: vec!(),
|
groups: vec!(),
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in a new issue