Pad out the standard XMPP stanzas a bit so they're at least useful.

This commit is contained in:
Matt Goodall 2012-07-08 23:20:15 +01:00
parent 5399179d50
commit 381c04b8b3
2 changed files with 13 additions and 0 deletions

View File

@ -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 {}
}

View File

@ -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 <message/> 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 <presence/> 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"`
}