void OnStreamStart(object sender, Node node) { var e = (StreamElement)node; this._log.Debug("recv <<:\n{0}\n", e.StartTag()); var stream = new StreamElement { Id = this.Session.Id, From = "warface", Version = "1.0", Prefix = "stream", Namespace = Namespaces.STREAM }; this.Send(stream.StartTag().ToString().Replace("/>", ">")); if (e.To.Server != "warface") { var error = new Element("error", null, Namespaces.STREAM) { Prefix = "stream" }; error.C("host-unknown", ns: Namespaces.STREAMS); this.Send(error); return; } var features = new StreamFeatures { Prefix = "stream" }; { if (!this.Session.IsAuthenticated) { if (!this.Session.IsTlsStarted) { features.C("starttls", ns: Namespaces.TLS) .C("required"); } features.C("mechanisms", ns: Namespaces.SASL) .C("mechanism", "PLAIN"); } else { features.C("bind", ns: Namespaces.BIND); features.C("session", ns: Namespaces.SESSION); } } this.Send(features); }