From 1dd8c2eeac3498c8ce20e46c801ddad1d63910ee Mon Sep 17 00:00:00 2001 From: Gatlin C Johnson Date: Sat, 16 Jun 2012 14:39:22 -0500 Subject: [PATCH 1/2] fixed the xml tag unmarshalling for client messages --- xmpp.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/xmpp.go b/xmpp.go index 5e18f48..d1273a6 100644 --- a/xmpp.go +++ b/xmpp.go @@ -119,7 +119,7 @@ func (c *Client) Close() error { func (c *Client) init(user, passwd string) error { // For debugging: the following causes the plaintext of the connection to be duplicated to stdout. - //c.p = xml.NewDecoder(tee{c.tls, os.Stdout}); + //c.p = xml.NewDecoder(tee{c.tls, os.Stdout}) c.p = xml.NewDecoder(c.tls) a := strings.SplitN(user, "@", 2) @@ -315,16 +315,16 @@ type bindBind struct { type clientMessage struct { XMLName xml.Name `xml:"jabber:client message"` - From string `xml:",attr"` - Id string `xml:",attr"` - To string `xml:",attr"` - Type string `xml:",attr"` // chat, error, groupchat, headline, or normal + From string `xml:"from,attr"` + Id string `xml:"id,attr"` + To string `xml:"to,attr"` + Type string `xml:"type,attr"` // chat, error, groupchat, headline, or normal // These should technically be []clientText, // but string is much more convenient. - Subject string - Body string - Thread string + Subject string `xml:"subject"` + Body string `xml:"body"` + Thread string `xml:"thread"` } type clientText struct { From cb6591b5131332c69305f3f230476673d2e0432a Mon Sep 17 00:00:00 2001 From: Gatlin C Johnson Date: Sat, 16 Jun 2012 21:47:48 -0500 Subject: [PATCH 2/2] similar fixes for presence --- xmpp.go | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/xmpp.go b/xmpp.go index d1273a6..eb94b52 100644 --- a/xmpp.go +++ b/xmpp.go @@ -334,15 +334,15 @@ type clientText struct { type clientPresence struct { XMLName xml.Name `xml:"jabber:client presence"` - From string `xml:",attr"` - Id string `xml:",attr"` - To string `xml:",attr"` - Type string `xml:",attr"` // error, probe, subscribe, subscribed, unavailable, unsubscribe, unsubscribed - Lang string `xml:",attr"` + From string `xml:"from,attr"` + Id string `xml:"id,attr"` + To string `xml:"to,attr"` + Type string `xml:"type,attr"` // error, probe, subscribe, subscribed, unavailable, unsubscribe, unsubscribed + Lang string `xml:"lang,attr"` - Show string // away, chat, dnd, xa - Status string // sb []clientText - Priority string + Show string `xml:"show,attr"`// away, chat, dnd, xa + Status string `xml:"status,attr"`// sb []clientText + Priority string `xml:"priority,attr"` Error *clientError }