Changed the type of structure fields which hold JIDs from string to JID.
--- 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 {
--- 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
--- 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) {