From e223dcf94bf7ce2fc894d7ca8b64dd98c0373039 Mon Sep 17 00:00:00 2001 From: Martin Dosch Date: Tue, 23 Apr 2024 21:24:34 +0200 Subject: [PATCH] Only set from if connection is encrypted. --- xmpp.go | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) 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 .