summaryrefslogtreecommitdiff
path: root/xmpp/xmpp.go
diff options
context:
space:
mode:
authorxengineering <me@xengineering.eu>2023-05-21 15:30:39 +0200
committerxengineering <me@xengineering.eu>2023-05-21 15:30:39 +0200
commit50618675c84d2246f48a18de206200d27a733300 (patch)
treeaf731af431d5d3059cfe8a9a5806860bf2ca8b12 /xmpp/xmpp.go
parent8d4ebab923ae23d1dfbc9b47eeabec33d3605ef5 (diff)
downloadlimox-50618675c84d2246f48a18de206200d27a733300.tar
limox-50618675c84d2246f48a18de206200d27a733300.tar.zst
limox-50618675c84d2246f48a18de206200d27a733300.zip
Implement SASL PLAIN authentication
Diffstat (limited to 'xmpp/xmpp.go')
-rw-r--r--xmpp/xmpp.go13
1 files changed, 7 insertions, 6 deletions
diff --git a/xmpp/xmpp.go b/xmpp/xmpp.go
index 624090b..07d4c6d 100644
--- a/xmpp/xmpp.go
+++ b/xmpp/xmpp.go
@@ -19,6 +19,7 @@ type Conn struct {
ch chan Event
jid, pwd string
tcp *tls.Conn
+ enc encoder
}
func NewConn(ch chan Event, jid string, pwd string) *Conn {
@@ -65,13 +66,13 @@ func (c *Conn) Run() {
go decoder.run()
defer decoder.stop()
- enc := newEncoder(c.tcp)
- defer enc.Close()
+ c.enc = newEncoder(c.tcp)
+ defer c.enc.Close()
- tr := newTokenRouter(&enc)
+ tr := newTokenRouter()
- end := sendStreamStart(&enc, c.jid)
- defer sendStreamEnd(&enc, end)
+ end := sendStreamStart(&c.enc, c.jid)
+ defer sendStreamEnd(&c.enc, end)
c.ch <- ConnectEvent
defer func() { c.ch <- DisconnectEvent }()
@@ -86,7 +87,7 @@ func (c *Conn) Run() {
log.Printf("Unknown Event '%d'!\n", ev)
}
case token := <-decoder.data:
- err = tr.route(token)
+ err = tr.route(token, c)
if err != nil {
log.Println(err)
return