diff --git a/xmpp.go b/xmpp.go index 9bd55aa..c625209 100644 --- a/xmpp.go +++ b/xmpp.go @@ -1146,12 +1146,21 @@ func (c *Client) startStream(o *Options, domain string) (*streamFeatures, error) c.stanzaWriter = c.conn } - _, err := fmt.Fprintf(c.stanzaWriter, ""+ - "\n", - xmlEscape(o.User), xmlEscape(domain), nsClient, nsStream) - if err != nil { - return nil, err + if c.IsEncrypted() { + _, err := fmt.Fprintf(c.stanzaWriter, ""+ + "\n", + xmlEscape(o.User), xmlEscape(domain), nsClient, nsStream) + if err != nil { + return nil, err + } + } else { + _, err := fmt.Fprintf(c.stanzaWriter, ""+ + "\n", + xmlEscape(domain), nsClient, nsStream) + if err != nil { + return nil, err + } } // We expect the server to start a .