1
0
Fork 0

Do not disconnect when an account disconnect while their is an other one connected

This commit is contained in:
Chteufleur 2016-02-29 23:02:19 +01:00
parent e11f5d3f98
commit ce4b966c9c
2 changed files with 10 additions and 3 deletions

View File

@ -15,7 +15,7 @@ import (
)
const (
Version = "go-xmpp4steam v0.1.4.0"
Version = "go-xmpp4steam v0.1.4.1"
configurationFilePath = "xmpp4steam.cfg"
)

View File

@ -50,6 +50,8 @@ var (
CurrentStatus = Status_offline
setJIDconnected = make(map[string]bool)
Debug = true
)
@ -70,10 +72,15 @@ func mainXMPP() {
case *xmpp.Presence:
if strings.SplitN(v.From, "/", 2)[0] == PreferedJID && v.To == JidStr && v.Type != Type_probe {
if v.Type == Type_unavailable {
delete(setJIDconnected, v.From)
log.Printf("%sPresence reçut unavailable", LogDebug)
if len(setJIDconnected) <= 0 {
// Disconnect only when all JID are disconnected
Disconnect()
ChanAction <- ActionDeconnexion
}
} else {
setJIDconnected[v.From] = true
log.Printf("%sPresence reçut", LogDebug)
CurrentStatus = v.Show
ChanAction <- ActionConnexion