Merge pull request #3 from intellectronica/master

Update to make XML unmarshaling work.
This commit is contained in:
mattn 2011-05-17 17:31:04 -07:00
commit 19a383f5b4

14
xmpp.go
View File

@ -193,7 +193,7 @@ func (c *Client) init(user, passwd string) os.Error {
return os.ErrorString("expected <stream>, got <" + se.Name.Local + "> in " + se.Name.Space) return os.ErrorString("expected <stream>, got <" + se.Name.Local + "> in " + se.Name.Space)
} }
if err = c.p.Unmarshal(&f, nil); err != nil { if err = c.p.Unmarshal(&f, nil); err != nil {
// TODO: often stream stop. // TODO: often stream stop.
//return os.ErrorString("unmarshal <features>: " + err.String()) //return os.ErrorString("unmarshal <features>: " + err.String())
} }
@ -203,7 +203,7 @@ func (c *Client) init(user, passwd string) os.Error {
if err = c.p.Unmarshal(&iq, nil); err != nil { if err = c.p.Unmarshal(&iq, nil); err != nil {
return os.ErrorString("unmarshal <iq>: " + err.String()) return os.ErrorString("unmarshal <iq>: " + err.String())
} }
if iq.Bind == nil { if &iq.Bind == nil {
return os.ErrorString("<iq> result missing <bind>") return os.ErrorString("<iq> result missing <bind>")
} }
c.jid = iq.Bind.Jid // our local id c.jid = iq.Bind.Jid // our local id
@ -246,9 +246,9 @@ func (c *Client) Send(chat Chat) {
type streamFeatures struct { type streamFeatures struct {
XMLName xml.Name "http://etherx.jabber.org/streams features" XMLName xml.Name "http://etherx.jabber.org/streams features"
StartTLS *tlsStartTLS StartTLS tlsStartTLS
Mechanisms *saslMechanisms Mechanisms saslMechanisms
Bind *bindBind Bind bindBind
Session bool Session bool
} }
@ -351,8 +351,8 @@ type clientIQ struct { // info/query
Id string "attr" Id string "attr"
To string "attr" To string "attr"
Type string "attr" // error, get, result, set Type string "attr" // error, get, result, set
Error *clientError Error clientError
Bind *bindBind Bind bindBind
} }
type clientError struct { type clientError struct {