# HG changeset patch # User Chris Jones # Date 1384025605 25200 # Node ID 3010996c192886cb28c57f76e4c2ee3efda8c094 # Parent 4477c9f31f4300f0c2c60b24e38fb4783044b85b Changed the type of structure fields which hold JIDs from string to JID. diff -r 4477c9f31f43 -r 3010996c1928 xmpp/roster_test.go --- a/xmpp/roster_test.go Sat Nov 09 12:22:01 2013 -0700 +++ b/xmpp/roster_test.go Sat Nov 09 12:33:25 2013 -0700 @@ -29,7 +29,7 @@ t.Fatalf("parseExtended: %v", err) } assertEquals(t, "iq", iq.XMLName.Local) - assertEquals(t, "from", iq.From) + assertEquals(t, "from", string(iq.From)) assertEquals(t, "en", iq.Lang) nested := iq.Nested if nested == nil { diff -r 4477c9f31f43 -r 3010996c1928 xmpp/structs.go --- a/xmpp/structs.go Sat Nov 09 12:22:01 2013 -0700 +++ b/xmpp/structs.go Sat Nov 09 12:33:25 2013 -0700 @@ -75,8 +75,8 @@ // One of the three core XMPP stanza types: iq, message, presence. See // RFC3920, section 9. type Header struct { - To string `xml:"to,attr,omitempty"` - From string `xml:"from,attr,omitempty"` + To JID `xml:"to,attr,omitempty"` + From JID `xml:"from,attr,omitempty"` Id string `xml:"id,attr,omitempty"` Type string `xml:"type,attr,omitempty"` Lang string `xml:"http://www.w3.org/XML/1998/namespace lang,attr,omitempty"` @@ -130,7 +130,7 @@ type bindIq struct { XMLName xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-bind bind"` Resource *string `xml:"resource"` - Jid *string `xml:"jid"` + Jid *JID `xml:"jid"` } // Holds human-readable text, with an optional language diff -r 4477c9f31f43 -r 3010996c1928 xmpp/xmpp.go --- a/xmpp/xmpp.go Sat Nov 09 12:22:01 2013 -0700 +++ b/xmpp/xmpp.go Sat Nov 09 12:33:25 2013 -0700 @@ -224,7 +224,7 @@ // Initialize the session. id := NextId() - iq := &Iq{Header: Header{To: cl.Jid.Domain(), Id: id, Type: "set", + iq := &Iq{Header: Header{To: JID(cl.Jid.Domain()), Id: id, Type: "set", Nested: []interface{}{Generic{XMLName: xml.Name{Space: NsSession, Local: "session"}}}}} ch := make(chan error) f := func(st Stanza) {