diff options
author | bodqhrohro <bodqhrohro@gmail.com> | 2019-12-22 04:04:45 +0300 |
---|---|---|
committer | bodqhrohro <bodqhrohro@gmail.com> | 2019-12-22 04:04:45 +0300 |
commit | ed8fd6415c2e7dc6ce4cd2907aea10ffe9b4ba55 (patch) | |
tree | 43d7fe245e99eb043648647815f5a9b08dffa936 /xmpp/handlers.go | |
parent | 915b7fe1de6bf8f726a596b000956ae14ecbf2a2 (diff) |
Migrate some comments from Zhabogram; change queue behaviour
Diffstat (limited to 'xmpp/handlers.go')
-rw-r--r-- | xmpp/handlers.go | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/xmpp/handlers.go b/xmpp/handlers.go index f7f628b..2addd7b 100644 --- a/xmpp/handlers.go +++ b/xmpp/handlers.go @@ -148,6 +148,7 @@ func handlePresence(s xmpp.Sender, p stanza.Presence) { }).Warn("Presence") log.Debugf("%#v", p) + // create session fromJid, err := xmpp.NewJid(p.From) if err != nil { log.Error("Invalid from JID!") @@ -160,11 +161,14 @@ func handlePresence(s xmpp.Sender, p stanza.Presence) { } switch p.Type { + // destroy session case "unsubscribed", "unsubscribe": session.Disconnect() delete(sessions, bareFromJid) + // go offline case "unavailable", "error": session.Disconnect() + // go online case "probe", "", "online": // due to the weird implementation of go-tdlib wrapper, it won't // return the client instance until successful authorization |