diff --git a/gateway/gateway.go b/gateway/gateway.go index 306111e..875c8a5 100644 --- a/gateway/gateway.go +++ b/gateway/gateway.go @@ -6,6 +6,7 @@ import ( const ( SentryDirectory = "sentries/" + resource = "go-xmpp4steam" ) type GatewayInfo struct { diff --git a/gateway/xmpp.go b/gateway/xmpp.go index 5f375ae..c8150d6 100644 --- a/gateway/xmpp.go +++ b/gateway/xmpp.go @@ -46,6 +46,7 @@ func (g *GatewayInfo) ReceivedXMPP_Presence(presence *xmpp.Presence) { transfertPresence := false jid := strings.SplitN(presence.From, "/", 2) + steamJid := strings.SplitN(strings.SplitN(presence.To, "/", 2)[0], "@", 2) if len(jid) == 2 { // Resource exist —> client speaking if presence.Type == Type_available { @@ -56,10 +57,9 @@ func (g *GatewayInfo) ReceivedXMPP_Presence(presence *xmpp.Presence) { } if presence.Type == Type_probe { - steamId := strings.SplitN(strings.SplitN(presence.To, "/", 2)[0], "@", 2)[0] - steamFriendStatus := g.FriendSteamId[steamId] + steamFriendStatus := g.FriendSteamId[steamJid[0]] if steamFriendStatus != nil { - g.SendXmppPresence(steamFriendStatus.XMPP_Status, steamFriendStatus.XMPP_Type, "", steamId+"@"+XmppJidComponent, steamFriendStatus.SteamGameName, steamFriendStatus.SteamName) + g.SendXmppPresence(steamFriendStatus.XMPP_Status, steamFriendStatus.XMPP_Type, "", steamJid[0]+"@"+XmppJidComponent, steamFriendStatus.SteamGameName, steamFriendStatus.SteamName) } } else if presence.Type == Type_subscribe { @@ -155,7 +155,7 @@ func (g *GatewayInfo) SendXmppPresence(status, tpye, to, from, message, nick str // TODO add an option to allow message comming directly from the gateway p.From = XmppJidComponent } else { - p.From = from + p.From = from+"/"+resource } log.Printf("%sSend presence %v", LogXmppInfo, p) diff --git a/main.go b/main.go index 188bf12..283409b 100644 --- a/main.go +++ b/main.go @@ -15,7 +15,7 @@ import ( ) const ( - Version = "v0.3.7d" + Version = "v0.3.7" configurationFilePath = "xmpp4steam.cfg" )