From 381c04b8b310c27870726d0f8cb66aee0ed954ba Mon Sep 17 00:00:00 2001 From: Matt Goodall Date: Sun, 8 Jul 2012 23:20:15 +0100 Subject: [PATCH] Pad out the standard XMPP stanzas a bit so they're at least useful. --- client.go | 1 + src/xmpp/stanza.go | 12 ++++++++++++ 2 files changed, 13 insertions(+) diff --git a/client.go b/client.go index 8f3bb45..366ce88 100644 --- a/client.go +++ b/client.go @@ -23,6 +23,7 @@ func main() { } log.Printf("Connection established for %s\n", x.JID) x.Send(xmpp.Presence{}) + x.Send(xmpp.Message{To: "carol@localhost", Body: "Hello!"}) select {} } diff --git a/src/xmpp/stanza.go b/src/xmpp/stanza.go index da307ba..369196e 100644 --- a/src/xmpp/stanza.go +++ b/src/xmpp/stanza.go @@ -7,6 +7,8 @@ type Iq struct { XMLName xml.Name `xml:"iq"` Id string `xml:"id,attr"` Type string `xml:"type,attr"` + To string `xml:"to,attr,omitempty"` + From string `xml:"from,attr,omitempty"` Payload string `xml:",innerxml"` } @@ -30,9 +32,19 @@ func (iq *Iq) PayloadDecode(v interface{}) error { // XMPP stanza. type Message struct { XMLName xml.Name `xml:"message"` + Id string `xml:"id,attr,omitempty"` + Type string `xml:"type,attr,omitempty"` + To string `xml:"to,attr,omitempty"` + From string `xml:"from,attr,omitempty"` + Subject string `xml:"subject,omitempty"` + Body string `xml:"body,omitempty"` } // XMPP stanza. type Presence struct { XMLName xml.Name `xml:"presence"` + Id string `xml:"id,attr,omitempty"` + Type string `xml:"type,attr,omitempty"` + To string `xml:"to,attr,omitempty"` + From string `xml:"from,attr,omitempty"` }