# HG changeset patch # User Chris Jones # Date 1325357144 25200 # Node ID 4a06f7ccfa84dfd6151d0c0b47529ee7637580c2 # Parent 2839fece923e082832d10786bd8df58a09403708 Use name tags for roster data structures. diff -r 2839fece923e -r 4a06f7ccfa84 roster.go --- a/roster.go Sat Dec 31 11:39:23 2011 -0700 +++ b/roster.go Sat Dec 31 11:45:44 2011 -0700 @@ -14,15 +14,13 @@ // Roster query/result type RosterQuery struct { - // Should always be NsRoster, "query" - XMLName xml.Name + XMLName xml.Name `xml:"jabber:iq:roster query"` Item []RosterItem } // See RFC 3921, Section 7.1. type RosterItem struct { - // Should always be "item" - XMLName xml.Name + XMLName xml.Name `xml:"item"` Jid string `xml:"attr"` Subscription string `xml:"attr"` Name string `xml:"attr"` @@ -38,8 +36,7 @@ // that information. func (cl *Client) fetchRoster() os.Error { iq := &Iq{From: cl.Jid.String(), Id: <- cl.Id, Type: "get", - Nested: RosterQuery{XMLName: xml.Name{Local: "query", - Space: NsRoster}}} + Nested: RosterQuery{}} ch := make(chan os.Error) f := func(st Stanza) bool { if iq.Type == "error" { diff -r 2839fece923e -r 4a06f7ccfa84 roster_test.go --- a/roster_test.go Sat Dec 31 11:39:23 2011 -0700 +++ b/roster_test.go Sat Dec 31 11:45:44 2011 -0700 @@ -14,9 +14,7 @@ // This is mostly just tests of the roster data structures. func TestRosterIqMarshal(t *testing.T) { - iq := &Iq{From: "from", Lang: "en", Nested: - RosterQuery{XMLName: xml.Name{Space: NsRoster, Local: - "query"}, Item: []RosterItem{}}} + iq := &Iq{From: "from", Lang: "en", Nested: RosterQuery{}} exp := `` assertMarshal(t, exp, iq)