Handle leave conversation in XMPP -> Steam way + send inactive on XMPP after 2 min inactivity
This commit is contained in:
parent
1e63cc1759
commit
d32b143bb3
|
|
@ -233,6 +233,10 @@ func (g *GatewayInfo) SendSteamMessageComposing(steamId string) {
|
||||||
g.sendSteamMessage(steamId, "", steamlang.EChatEntryType_Typing)
|
g.sendSteamMessage(steamId, "", steamlang.EChatEntryType_Typing)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (g *GatewayInfo) SendSteamMessageLeaveConversation(steamId string) {
|
||||||
|
g.sendSteamMessage(steamId, "", steamlang.EChatEntryType_LeftConversation)
|
||||||
|
}
|
||||||
|
|
||||||
func (g *GatewayInfo) sendSteamMessage(steamId, message string, chatEntryType steamlang.EChatEntryType) {
|
func (g *GatewayInfo) sendSteamMessage(steamId, message string, chatEntryType steamlang.EChatEntryType) {
|
||||||
if !g.IsSteamConnected() {
|
if !g.IsSteamConnected() {
|
||||||
log.Printf("%sTry to send message, but disconnected", LogSteamDebug)
|
log.Printf("%sTry to send message, but disconnected", LogSteamDebug)
|
||||||
|
|
|
||||||
|
|
@ -132,7 +132,7 @@ func (g *GatewayInfo) ReceivedXMPP_Message(message *xmpp.Message) {
|
||||||
} else if message.Inactive != nil {
|
} else if message.Inactive != nil {
|
||||||
return
|
return
|
||||||
} else if message.Gone != nil {
|
} else if message.Gone != nil {
|
||||||
return
|
g.SendSteamMessageLeaveConversation(steamID)
|
||||||
} else {
|
} else {
|
||||||
if message.Body != "" {
|
if message.Body != "" {
|
||||||
g.SendSteamMessage(steamID, message.Body)
|
g.SendSteamMessage(steamID, message.Body)
|
||||||
|
|
@ -178,10 +178,17 @@ func (g *GatewayInfo) SendXmppPresence(status, tpye, to, from, message, nick str
|
||||||
func (g *GatewayInfo) SendXmppMessage(from, subject, message string) {
|
func (g *GatewayInfo) SendXmppMessage(from, subject, message string) {
|
||||||
g.sendXmppMessage(from, subject, message, &xmpp.Active{})
|
g.sendXmppMessage(from, subject, message, &xmpp.Active{})
|
||||||
g.stopComposingTimer(from)
|
g.stopComposingTimer(from)
|
||||||
|
|
||||||
|
// Make inactive after 2 min if nothing happen
|
||||||
|
t := time.AfterFunc(120*time.Second, func() {
|
||||||
|
g.sendXmppMessage(from, "", "", &xmpp.Inactive{})
|
||||||
|
})
|
||||||
|
g.XMPP_Composing_Timers[from] = t
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *GatewayInfo) SendXmppMessageLeaveConversation(from string) {
|
func (g *GatewayInfo) SendXmppMessageLeaveConversation(from string) {
|
||||||
g.sendXmppMessage(from, "", "", &xmpp.Gone{})
|
g.sendXmppMessage(from, "", "", &xmpp.Gone{})
|
||||||
|
g.stopComposingTimer(from)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (g *GatewayInfo) SendXmppMessageComposing(from string) {
|
func (g *GatewayInfo) SendXmppMessageComposing(from string) {
|
||||||
|
|
|
||||||
|
|
@ -1 +1 @@
|
||||||
{"Addresses":[{"IP":"162.254.197.40","Port":27019},{"IP":"146.66.152.11","Port":27018},{"IP":"162.254.197.42","Port":27017},{"IP":"146.66.152.11","Port":27017},{"IP":"146.66.152.10","Port":27017},{"IP":"162.254.197.42","Port":27021},{"IP":"162.254.197.40","Port":27020},{"IP":"162.254.197.41","Port":27020},{"IP":"162.254.197.41","Port":27019},{"IP":"146.66.152.11","Port":27019},{"IP":"146.66.152.10","Port":27019},{"IP":"146.66.152.10","Port":27018},{"IP":"162.254.197.42","Port":27019},{"IP":"146.66.152.11","Port":27020},{"IP":"162.254.197.42","Port":27020},{"IP":"162.254.197.40","Port":27021},{"IP":"162.254.197.41","Port":27017},{"IP":"162.254.197.42","Port":27018},{"IP":"162.254.197.41","Port":27021},{"IP":"162.254.197.40","Port":27018},{"IP":"162.254.197.40","Port":27017},{"IP":"146.66.152.10","Port":27020},{"IP":"162.254.196.42","Port":27020},{"IP":"162.254.197.41","Port":27018},{"IP":"162.254.196.40","Port":27017},{"IP":"162.254.196.42","Port":27018},{"IP":"162.254.196.43","Port":27021},{"IP":"162.254.196.41","Port":27020},{"IP":"162.254.196.41","Port":27019},{"IP":"162.254.196.43","Port":27020},{"IP":"162.254.196.41","Port":27018},{"IP":"162.254.196.41","Port":27021},{"IP":"162.254.196.42","Port":27017},{"IP":"162.254.196.40","Port":27018},{"IP":"162.254.196.43","Port":27019},{"IP":"162.254.196.43","Port":27018},{"IP":"162.254.196.41","Port":27017},{"IP":"162.254.196.40","Port":27020},{"IP":"162.254.196.43","Port":27017},{"IP":"162.254.196.42","Port":27021},{"IP":"162.254.196.42","Port":27019},{"IP":"162.254.196.40","Port":27021},{"IP":"162.254.196.40","Port":27019},{"IP":"146.66.155.8","Port":27017},{"IP":"146.66.155.8","Port":27018},{"IP":"185.25.182.10","Port":27017},{"IP":"146.66.155.8","Port":27020},{"IP":"185.25.182.10","Port":27019},{"IP":"155.133.242.8","Port":27018},{"IP":"185.25.180.15","Port":27018},{"IP":"185.25.180.15","Port":27020},{"IP":"155.133.242.8","Port":27017},{"IP":"185.25.182.10","Port":27020},{"IP":"155.133.242.8","Port":27020},{"IP":"185.25.182.10","Port":27018},{"IP":"155.133.242.9","Port":27017},{"IP":"155.133.242.9","Port":27019},{"IP":"185.25.180.14","Port":27017},{"IP":"185.25.180.15","Port":27017},{"IP":"155.133.242.9","Port":27020},{"IP":"146.66.155.8","Port":27019},{"IP":"155.133.242.8","Port":27019},{"IP":"185.25.180.14","Port":27019},{"IP":"185.25.180.14","Port":27018},{"IP":"155.133.242.9","Port":27018},{"IP":"185.25.180.14","Port":27020},{"IP":"185.25.180.15","Port":27019},{"IP":"208.78.164.10","Port":27017},{"IP":"208.78.164.12","Port":27018},{"IP":"208.78.164.13","Port":27017},{"IP":"208.78.164.14","Port":27019},{"IP":"208.78.164.14","Port":27018},{"IP":"208.78.164.10","Port":27018},{"IP":"208.78.164.13","Port":27018},{"IP":"208.78.164.12","Port":27019},{"IP":"208.78.164.10","Port":27019},{"IP":"208.78.164.13","Port":27019},{"IP":"208.78.164.12","Port":27017},{"IP":"208.78.164.14","Port":27017},{"IP":"162.254.195.45","Port":27017}]}
|
{"Addresses":[{"IP":"162.254.197.41","Port":27018},{"IP":"162.254.197.40","Port":27018},{"IP":"146.66.152.10","Port":27017},{"IP":"146.66.152.10","Port":27020},{"IP":"146.66.152.11","Port":27017},{"IP":"162.254.197.42","Port":27017},{"IP":"162.254.197.41","Port":27021},{"IP":"162.254.197.40","Port":27020},{"IP":"146.66.152.11","Port":27020},{"IP":"162.254.197.42","Port":27019},{"IP":"146.66.152.10","Port":27019},{"IP":"162.254.197.41","Port":27020},{"IP":"146.66.152.11","Port":27019},{"IP":"162.254.197.41","Port":27019},{"IP":"146.66.152.11","Port":27018},{"IP":"162.254.197.41","Port":27017},{"IP":"146.66.152.10","Port":27018},{"IP":"162.254.197.42","Port":27021},{"IP":"162.254.197.40","Port":27021},{"IP":"162.254.197.42","Port":27018},{"IP":"162.254.197.42","Port":27020},{"IP":"162.254.197.40","Port":27019},{"IP":"162.254.196.41","Port":27017},{"IP":"162.254.196.41","Port":27021},{"IP":"162.254.196.43","Port":27017},{"IP":"162.254.196.41","Port":27019},{"IP":"162.254.196.41","Port":27020},{"IP":"162.254.196.43","Port":27019},{"IP":"162.254.196.42","Port":27019},{"IP":"162.254.196.41","Port":27018},{"IP":"162.254.196.43","Port":27018},{"IP":"162.254.196.42","Port":27020},{"IP":"162.254.196.42","Port":27018},{"IP":"162.254.196.40","Port":27019},{"IP":"162.254.196.40","Port":27017},{"IP":"162.254.197.40","Port":27017},{"IP":"162.254.196.42","Port":27017},{"IP":"162.254.196.40","Port":27020},{"IP":"162.254.196.40","Port":27021},{"IP":"162.254.196.40","Port":27018},{"IP":"162.254.196.42","Port":27021},{"IP":"162.254.196.43","Port":27020},{"IP":"162.254.196.43","Port":27021},{"IP":"146.66.155.8","Port":27017},{"IP":"185.25.182.10","Port":27020},{"IP":"146.66.155.8","Port":27018},{"IP":"146.66.155.8","Port":27019},{"IP":"185.25.182.10","Port":27018},{"IP":"185.25.182.10","Port":27019},{"IP":"146.66.155.8","Port":27020},{"IP":"185.25.182.10","Port":27017},{"IP":"185.25.180.14","Port":27020},{"IP":"185.25.180.14","Port":27019},{"IP":"185.25.180.14","Port":27018},{"IP":"155.133.242.8","Port":27017},{"IP":"155.133.242.9","Port":27020},{"IP":"155.133.242.8","Port":27018},{"IP":"155.133.242.9","Port":27017},{"IP":"185.25.180.14","Port":27017},{"IP":"155.133.242.9","Port":27019},{"IP":"185.25.180.15","Port":27020},{"IP":"155.133.242.8","Port":27020},{"IP":"155.133.242.8","Port":27019},{"IP":"185.25.180.15","Port":27019},{"IP":"155.133.242.9","Port":27018},{"IP":"185.25.180.15","Port":27017},{"IP":"185.25.180.15","Port":27018},{"IP":"208.78.164.13","Port":27019},{"IP":"208.78.164.12","Port":27019},{"IP":"208.78.164.12","Port":27018},{"IP":"208.78.164.10","Port":27017},{"IP":"208.78.164.14","Port":27017},{"IP":"208.78.164.10","Port":27018},{"IP":"208.78.164.13","Port":27017},{"IP":"208.78.164.13","Port":27018},{"IP":"208.78.164.10","Port":27019},{"IP":"208.78.164.12","Port":27017},{"IP":"208.78.164.14","Port":27018},{"IP":"208.78.164.14","Port":27019},{"IP":"162.254.195.46","Port":27020}]}
|
||||||
Loading…
Reference in New Issue