1
0
Fork 0

Add resource for Steam JID

This commit is contained in:
Chteufleur 2016-04-23 11:23:58 +02:00
parent e064b71660
commit 7368dce789
3 changed files with 6 additions and 5 deletions

View File

@ -6,6 +6,7 @@ import (
const (
SentryDirectory = "sentries/"
resource = "go-xmpp4steam"
)
type GatewayInfo struct {

View File

@ -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)

View File

@ -15,7 +15,7 @@ import (
)
const (
Version = "v0.3.7d"
Version = "v0.3.7"
configurationFilePath = "xmpp4steam.cfg"
)