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:
Emmanuel Gil Peyrot 2017-05-29 03:40:34 +01:00
parent 073e208f06
commit 7395e4b88f

View file

@ -70,7 +70,7 @@ impl TryFrom<Element> for Item {
let mut item = Item {
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),
groups: vec!(),
};