forked from chteufleur/go-xmpp
Move xml declaration to stream.
This commit is contained in:
parent
7cf14c4f35
commit
4e7d9e68d1
|
|
@ -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(
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue