From 0c0be96ec42938ad81c320a45259ffe3f7dff657 Mon Sep 17 00:00:00 2001 From: Emmanuel Gil Peyrot Date: Fri, 16 Oct 2020 22:02:14 +0200 Subject: [PATCH] xmpp-parsers/bookmarks: Make @name actually optional No idea why these two attribute got considered required, maybe a wrong read of the spec. --- xmpp-parsers/src/bookmarks.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/xmpp-parsers/src/bookmarks.rs b/xmpp-parsers/src/bookmarks.rs index 7346cd8..6276d2b 100644 --- a/xmpp-parsers/src/bookmarks.rs +++ b/xmpp-parsers/src/bookmarks.rs @@ -24,7 +24,7 @@ generate_element!( jid: Required = "jid", /// A user-defined name for this conference. - name: Required = "name", + name: Option = "name", ], children: [ /// The nick the user will use to join this conference. @@ -40,7 +40,7 @@ generate_element!( Url, "url", BOOKMARKS, attributes: [ /// A user-defined name for this URL. - name: Required = "name", + name: Option = "name", /// The URL of this bookmark. url: Required = "url", @@ -106,7 +106,7 @@ mod tests { let elem: Element = "Coucousecret".parse().unwrap(); let storage = Storage::try_from(elem).unwrap(); assert_eq!(storage.urls.len(), 1); - assert_eq!(storage.urls[0].name, "Example"); + assert_eq!(storage.urls[0].clone().name.unwrap(), "Example"); assert_eq!(storage.urls[0].url, "https://example.org/"); assert_eq!(storage.conferences.len(), 1); assert_eq!(storage.conferences[0].autojoin, Autojoin::True); @@ -114,7 +114,7 @@ mod tests { storage.conferences[0].jid, BareJid::new("test-muc", "muc.localhost") ); - assert_eq!(storage.conferences[0].name, "Test MUC"); + assert_eq!(storage.conferences[0].clone().name.unwrap(), "Test MUC"); assert_eq!(storage.conferences[0].clone().nick.unwrap(), "Coucou"); assert_eq!(storage.conferences[0].clone().password.unwrap(), "secret"); }