From f8ce0ead602f632819d56f782107bf555dad2635 Mon Sep 17 00:00:00 2001 From: mattn Date: Wed, 4 Apr 2012 01:46:01 +0900 Subject: [PATCH 1/2] fix parsing xml. --- xmpp.go | 38 +++++++++++++++++++------------------- 1 file changed, 19 insertions(+), 19 deletions(-) diff --git a/xmpp.go b/xmpp.go index 69d83f5..6cd20e1 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.NewParser(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) @@ -279,12 +279,12 @@ type tlsFailure struct { type saslMechanisms struct { XMLName xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-sasl mechanisms"` - Mechanism []string + Mechanism []string `xml:"mechanism"` } type saslAuth struct { XMLName xml.Name `xml:"urn:ietf:params:xml:ns:xmpp-sasl auth"` - Mechanism string `xml:"attr"` + Mechanism string `xml:",attr"` } type saslChallenge string @@ -316,10 +316,10 @@ 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:",attr"` + Id string `xml:",attr"` + To string `xml:",attr"` + Type string `xml:",attr"` // chat, error, groupchat, headline, or normal // These should technically be []clientText, // but string is much more convenient. @@ -329,17 +329,17 @@ type clientMessage struct { } type clientText struct { - Lang string `xml:"attr"` + Lang string `xml:",attr"` Body string `xml:"chardata"` } 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:",attr"` + Id string `xml:",attr"` + To string `xml:",attr"` + Type string `xml:",attr"` // error, probe, subscribe, subscribed, unavailable, unsubscribe, unsubscribed + Lang string `xml:",attr"` Show string // away, chat, dnd, xa Status string // sb []clientText @@ -349,18 +349,18 @@ type clientPresence struct { type clientIQ struct { // info/query XMLName xml.Name `xml:"jabber:client iq"` - From string `xml:"attr"` - Id string `xml:"attr"` - To string `xml:"attr"` - Type string `xml:"attr"` // error, get, result, set + From string `xml:",attr"` + Id string `xml:",attr"` + To string `xml:",attr"` + Type string `xml:",attr"` // error, get, result, set Error clientError Bind bindBind } type clientError struct { XMLName xml.Name `xml:"jabber:client error"` - Code string `xml:"attr"` - Type string `xml:"attr"` + Code string `xml:",attr"` + Type string `xml:",attr"` Any xml.Name Text string } From 2ec48a2db6aaea91557767f865fde545d8a1a16b Mon Sep 17 00:00:00 2001 From: mattn Date: Wed, 4 Apr 2012 01:46:21 +0900 Subject: [PATCH 2/2] fix example-gui. --- example/example-gui.go | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/example/example-gui.go b/example/example-gui.go index d34c086..499c365 100644 --- a/example/example-gui.go +++ b/example/example-gui.go @@ -40,7 +40,7 @@ func main() { hbox := gtk.HBox(false, 1) dialog.GetVBox().Add(hbox) label := gtk.Label("username:") - sgroup.Add(label) + sgroup.AddWidget(label) hbox.Add(label) username := gtk.Entry() hbox.Add(username) @@ -48,7 +48,7 @@ func main() { hbox = gtk.HBox(false, 1) dialog.GetVBox().Add(hbox) label = gtk.Label("password:") - sgroup.Add(label) + sgroup.AddWidget(label) hbox.Add(label) password := gtk.Entry() password.SetVisibility(false)