Move xml declaration to stream.

This commit is contained in:
Matt Goodall 2012-06-27 13:15:11 +01:00
parent 7cf14c4f35
commit 4e7d9e68d1
3 changed files with 4 additions and 8 deletions

View File

@ -25,10 +25,6 @@ func NewClient(jid JID, password string, config *ClientConfig) (*client, error)
return nil, err
}
if err := stream.Send("<?xml version='1.0'?>\n"); err != nil {
return nil, err
}
for {
// Send stream start.
s := fmt.Sprintf(

View File

@ -20,10 +20,6 @@ func NewComponent(addr string, jid JID, secret string) (*component, error) {
return nil, err
}
if err := stream.Send("<?xml version='1.0'?>"); err != nil {
return nil, err
}
streamId, err := startComponent(stream, jid)
if err != nil {
return nil, err

View File

@ -28,6 +28,10 @@ func NewStream(addr string) (*Stream, error) {
return nil, err
}
if _, err := conn.Write([]byte("<?xml version='1.0'?>")); err != nil {
return nil, err
}
dec := xml.NewDecoder(conn)
return &Stream{conn, dec}, nil
}