package xmpp import ( "encoding/xml" "log" ) type stream struct { session *session end xml.EndElement } func (s *stream) terminate() { s.session.ed.encodeToken(s.end) } func sendStreamStart(enc *encoder, jid string) xml.EndElement { start := xml.StartElement{ xml.Name{"jabber:client", "stream:stream"}, []xml.Attr{ xml.Attr{xml.Name{"", "from"}, jid}, xml.Attr{xml.Name{"", "to"}, domainpart(jid)}, xml.Attr{xml.Name{"", "version"}, "1.0"}, xml.Attr{xml.Name{"", "xml:lang"}, "en"}, xml.Attr{xml.Name{"", "xmlns:stream"}, "http://etherx.jabber.org/streams"}, }, } err := enc.encodeNow(start) if err != nil { log.Println("Could not encode stream start!") } return start.End() } func sendStreamEnd(enc *encoder, end xml.EndElement) { err := enc.encodeNow(end) if err != nil { log.Println("Could not encode stream end!") } }