Fix session element parsing on IQ

This commit is contained in:
Mickael Remond
2019-06-29 17:39:19 +02:00
parent 40e907e8ee
commit cca0919b8a
4 changed files with 110 additions and 6 deletions
+1 -1
View File
@@ -183,7 +183,7 @@ func (s *Session) rfc3921Session(o Config) {
}
var iq stanza.IQ
if s.Features.Session.XMLName.Local == "session" && !s.Features.Session.Optional {
if !s.Features.Session.IsOptional() {
fmt.Fprintf(s.streamLogger, "<iq type='set' id='%s'><session xmlns='%s'/></iq>", s.PacketId(), stanza.NSSession)
if s.err = s.decoder.Decode(&iq); s.err != nil {
s.err = errors.New("expecting iq result after session open: " + s.err.Error())