From 7395e4b88ffcef26d448f78e36e1e6964bcda26f Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Mon, 29 May 2017 03:40:34 +0100 Subject: [PATCH] roster: Make an empty name be None instead. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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.” --- src/roster.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/roster.rs b/src/roster.rs index aaca6d8e..51e8eb13 100644 --- a/src/roster.rs +++ b/src/roster.rs @@ -70,7 +70,7 @@ impl TryFrom 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!(), };