summaryrefslogtreecommitdiff
path: root/xmpp/session.go
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2023-06-26 18:37:16 +0200
committerxengineering <me@xengineering.eu>2023-06-27 15:04:33 +0200
commit8715603ce1a713d1c8841382bb965cb55948fedd (patch)
treec3af42979a443168d85dd194b063308417ad0f42 /xmpp/session.go
parenta8a6c31d862ec1d491fc76ed21c46d7e0b35b7f2 (diff)
downloadlimox-8715603ce1a713d1c8841382bb965cb55948fedd.tar
limox-8715603ce1a713d1c8841382bb965cb55948fedd.tar.zst
limox-8715603ce1a713d1c8841382bb965cb55948fedd.zip
xmpp: Remove unused code
This is part of the refactoring. Details of the old implementation should be looked up by older commits.
Diffstat (limited to 'xmpp/session.go')
-rw-r--r--xmpp/session.go18
1 files changed, 5 insertions, 13 deletions
diff --git a/xmpp/session.go b/xmpp/session.go
index 2162d66..e928f01 100644
--- a/xmpp/session.go
+++ b/xmpp/session.go
@@ -16,8 +16,8 @@ type session struct {
in, out chan any
transport *tls.Conn
ed encoderDecoder
- streams []stream
rx chan xml.Token
+ streamEnd xml.EndElement
}
func StartSession(out chan any, jid string, pwd string) chan any {
@@ -26,7 +26,6 @@ func StartSession(out chan any, jid string, pwd string) chan any {
s.jid = jid
s.in = make(chan any)
s.out = out
- s.streams = make([]stream, 0)
s.rx = make(chan xml.Token, 0)
go s.run()
@@ -82,9 +81,6 @@ func (s *session) startTransport() error {
}
func (s *session) openStream() {
- stream := stream{}
- stream.session = s
-
start := xml.StartElement{
xml.Name{"jabber:client", "stream:stream"},
[]xml.Attr{
@@ -96,21 +92,17 @@ func (s *session) openStream() {
},
}
- stream.end = start.End()
+ s.streamEnd = start.End()
err := s.ed.encodeToken(start)
if err != nil {
log.Println("Could not encode stream start!")
}
-
- s.streams = append(s.streams, stream)
}
func (s *session) closeStreams() {
- for {
- limit := len(s.streams)
- if limit <= 0 { break }
- s.streams[limit - 1].terminate()
- s.streams = s.streams[:limit - 1]
+ err := s.ed.encodeToken(s.streamEnd)
+ if err != nil {
+ log.Println("Could not encode stream end!")
}
}