Compare commits
No commits in common. "231a8acb5ffcb5605c2048ffd73fafe5343b1bbb" and "cb49e1fbe936705bb2fad46d682774a25b7dd88b" have entirely different histories.
231a8acb5f
...
cb49e1fbe9
|
|
@ -127,8 +127,8 @@ func (g *GatewayInfo) ReceivedXMPP_Message(message *xmpp.Message) {
|
|||
} else if message.Gone != nil {
|
||||
g.SendSteamMessageLeaveConversation(steamID)
|
||||
} else {
|
||||
if message.Body != nil && len(message.Body) != 0 {
|
||||
g.SendSteamMessage(steamID, message.Body[0].Value)
|
||||
if message.Body != "" {
|
||||
g.SendSteamMessage(steamID, message.Body)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -284,30 +284,24 @@ func (g *GatewayInfo) chatstatesNotification() {
|
|||
switch chatstate {
|
||||
case "stop":
|
||||
if okInactive {
|
||||
if timerInactive != nil {
|
||||
if !timerInactive.Stop() {
|
||||
<-timerInactive.C
|
||||
}
|
||||
delete(inactiveTimers, jid)
|
||||
if !timerInactive.Stop() {
|
||||
<-timerInactive.C
|
||||
}
|
||||
delete(inactiveTimers, jid)
|
||||
}
|
||||
if okPaused {
|
||||
if timerPaused != nil {
|
||||
if !timerPaused.Stop() {
|
||||
<-timerPaused.C
|
||||
}
|
||||
delete(pausedTimers, jid)
|
||||
if !timerPaused.Stop() {
|
||||
<-timerPaused.C
|
||||
}
|
||||
delete(pausedTimers, jid)
|
||||
}
|
||||
|
||||
case "paused":
|
||||
if okInactive {
|
||||
if timerPaused != nil {
|
||||
if !timerPaused.Stop() {
|
||||
<-timerPaused.C
|
||||
}
|
||||
timerPaused.Reset(20 * time.Second)
|
||||
if !timerPaused.Stop() {
|
||||
<-timerPaused.C
|
||||
}
|
||||
timerPaused.Reset(20 * time.Second)
|
||||
} else {
|
||||
timerPaused = time.AfterFunc(20*time.Second, func() {
|
||||
g.sendXmppMessage(jid, "", "", &xmpp.Paused{})
|
||||
|
|
@ -318,12 +312,10 @@ func (g *GatewayInfo) chatstatesNotification() {
|
|||
|
||||
case "inactive":
|
||||
if okInactive {
|
||||
if timerInactive != nil {
|
||||
if !timerInactive.Stop() {
|
||||
<-timerInactive.C
|
||||
}
|
||||
timerInactive.Reset(120 * time.Second)
|
||||
if !timerInactive.Stop() {
|
||||
<-timerInactive.C
|
||||
}
|
||||
timerInactive.Reset(120 * time.Second)
|
||||
} else {
|
||||
timerInactive = time.AfterFunc(120*time.Second, func() {
|
||||
g.sendXmppMessage(jid, "", "", &xmpp.Inactive{})
|
||||
|
|
@ -338,9 +330,7 @@ func (g *GatewayInfo) chatstatesNotification() {
|
|||
|
||||
func (g *GatewayInfo) sendXmppMessage(from, subject, message string, chatState interface{}) {
|
||||
if from != XmppJidComponent || from == XmppJidComponent && g.DebugMessage {
|
||||
m := xmpp.Message{To: g.XMPP_JID_Client, From: from, Type: "chat"}
|
||||
mBody := xmpp.MessageBody{Value: message}
|
||||
m.Body = append(m.Body, mBody)
|
||||
m := xmpp.Message{To: g.XMPP_JID_Client, From: from, Body: message, Type: "chat"}
|
||||
|
||||
if subject != "" {
|
||||
m.Subject = subject
|
||||
|
|
|
|||
|
|
@ -257,9 +257,7 @@ func SendPresence(status, tpye, from, to, message, nick string) {
|
|||
}
|
||||
|
||||
func SendMessage(to, subject, message string) {
|
||||
m := xmpp.Message{From: jid.Domain, To: to, Type: "chat"}
|
||||
mBody := xmpp.MessageBody{Value: message}
|
||||
m.Body = append(m.Body, mBody)
|
||||
m := xmpp.Message{From: jid.Domain, To: to, Body: message, Type: "chat"}
|
||||
|
||||
if subject != "" {
|
||||
m.Subject = subject
|
||||
|
|
|
|||
Loading…
Reference in New Issue