forked from chteufleur/go-xmpp4steam
Do not disconnect when an account disconnect while their is an other one connected
This commit is contained in:
parent
e11f5d3f98
commit
ce4b966c9c
2
main.go
2
main.go
|
|
@ -15,7 +15,7 @@ import (
|
|||
)
|
||||
|
||||
const (
|
||||
Version = "go-xmpp4steam v0.1.4.0"
|
||||
Version = "go-xmpp4steam v0.1.4.1"
|
||||
configurationFilePath = "xmpp4steam.cfg"
|
||||
)
|
||||
|
||||
|
|
|
|||
11
xmpp/xmpp.go
11
xmpp/xmpp.go
|
|
@ -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)
|
||||
Disconnect()
|
||||
ChanAction <- ActionDeconnexion
|
||||
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
|
||||
|
|
|
|||
Loading…
Reference in New Issue