~samwhited/xmpp

b747c9b81afc479511559312bd1f07c042ed9b9a — Sam Whited 11 months ago 32c3994
xmpp: set to/from on response stream headers

Previously this was being left unset when going from empty to/from to
the JID being set because the previous (empty) origin/location would
continue to be used.

Fixes #107

Signed-off-by: Sam Whited <sam@samwhited.com>
1 files changed, 4 insertions(+), 1 deletions(-)

M negotiator.go
M negotiator.go => negotiator.go +4 -1
@@ 149,7 149,10 @@ func negotiator(cfg StreamConfig) Negotiator {
					return mask, nil, nState, fmt.Errorf("xmpp: stream location %s does not match previously set location %s", s.in.Info.To, location)
				}

				err = intstream.Send(s.Conn(), out, s.State()&S2S == S2S, cfg.WebSocket, stream.DefaultVersion, cfg.Lang, location.String(), origin.String(), attr.RandomID())
				location = in.To
				origin = in.From

				err = intstream.Send(s.Conn(), out, s.State()&S2S == S2S, cfg.WebSocket, stream.DefaultVersion, cfg.Lang, origin.String(), location.String(), attr.RandomID())
				if err != nil {
					nState.doRestart = false
					return mask, nil, nState, err