diff options
Diffstat (limited to 'xmpp/xmpp.go')
-rw-r--r-- | xmpp/xmpp.go | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/xmpp/xmpp.go b/xmpp/xmpp.go index 5c6e3e9..c0a52a0 100644 --- a/xmpp/xmpp.go +++ b/xmpp/xmpp.go @@ -30,6 +30,8 @@ func Run(ch chan Event, jid string, pwd string) { enc := newEncoder(conn) defer enc.Close() + tr := newTokenRouter(&enc) + end := sendStreamStart(&enc, jid) defer sendStreamEnd(&enc, end) @@ -46,12 +48,9 @@ func Run(ch chan Event, jid string, pwd string) { log.Printf("Unknown Event '%d'!\n", ev) } case token := <-decoder.data: - switch element := token.(type) { - case xml.EndElement: - if element.Name.Local == "error" { - log.Println("Received stream error!") - return - } + err = tr.route(token) + if err != nil { + return } } } |