Step 2 of converting to interface Stanza and embedded struct Header.
--- a/stream.go Sun Dec 16 22:36:53 2012 -0700
+++ b/stream.go Sun Dec 16 22:37:57 2012 -0700
@@ -148,7 +148,7 @@
// If it's a Stanza, we try to unmarshal its innerxml
// into objects of the appropriate respective
// types. This is specified by our extensions.
- if st, ok := obj.(Stanzer) ; ok {
+ if st, ok := obj.(Stanza) ; ok {
err = parseExtended(st.GetHeader(), extStanza)
if err != nil {
Warn.Logf("ext unmarshal: %s", err)
@@ -250,7 +250,7 @@
cl.handleTls(obj)
case *auth:
cl.handleSasl(obj)
- case Stanzer:
+ case Stanza:
st = obj.GetHeader()
default:
Warn.Logf("Unhandled non-stanza: %T %#v", x, x)
--- a/structs.go Sun Dec 16 22:36:53 2012 -0700
+++ b/structs.go Sun Dec 16 22:37:57 2012 -0700
@@ -77,7 +77,7 @@
Any *Generic
}
-type Stanzer interface {
+type Stanza interface {
GetHeader() *Header
}
@@ -102,7 +102,7 @@
Body *Generic `xml:"body"`
Thread *Generic `xml:"thread"`
}
-var _ Stanzer = &Message{}
+var _ Stanza = &Message{}
// presence stanza
type Presence struct {
@@ -112,14 +112,14 @@
Status *Generic `xml:"status"`
Priority *Generic `xml:"priority"`
}
-var _ Stanzer = &Presence{}
+var _ Stanza = &Presence{}
// iq stanza
type Iq struct {
XMLName xml.Name `xml:"iq"`
Header
}
-var _ Stanzer = &Iq{}
+var _ Stanza = &Iq{}
// Describes an XMPP stanza error. See RFC 3920, Section 9.3.
type Error struct {