mirror of
https://github.com/WiiLink24/wfc-server.git
synced 2026-04-24 23:47:50 -05:00
GPCM: Send dummy status message to open host players
This commit is contained in:
parent
28c65cc55a
commit
6d0c656bea
|
|
@ -279,6 +279,7 @@ func (g *GameSpySession) sendFriendStatus(profileId uint32) {
|
|||
return
|
||||
}
|
||||
|
||||
session.recordStatusSent(g.User.ProfileId)
|
||||
sendMessageToSession("100", g.User.ProfileId, session, g.Status)
|
||||
}
|
||||
}
|
||||
|
|
@ -291,6 +292,7 @@ func (g *GameSpySession) exchangeFriendStatus(profileId uint32) {
|
|||
return
|
||||
}
|
||||
|
||||
session.recordStatusSent(g.User.ProfileId)
|
||||
sendMessageToSession("100", g.User.ProfileId, session, g.Status)
|
||||
}
|
||||
|
||||
|
|
@ -300,11 +302,22 @@ func (g *GameSpySession) exchangeFriendStatus(profileId uint32) {
|
|||
return
|
||||
}
|
||||
|
||||
g.recordStatusSent(profileId)
|
||||
sendMessageToSessionBuffer("100", profileId, g, session.Status)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (g *GameSpySession) recordStatusSent(sender uint32) {
|
||||
for _, friend := range g.RecvStatusFromList {
|
||||
if friend == sender {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
g.RecvStatusFromList = append(g.RecvStatusFromList, sender)
|
||||
}
|
||||
|
||||
func (g *GameSpySession) sendLogoutStatus() {
|
||||
mutex.Lock()
|
||||
defer mutex.Unlock()
|
||||
|
|
|
|||
|
|
@ -45,6 +45,8 @@ type GameSpySession struct {
|
|||
LocString string
|
||||
FriendList []uint32
|
||||
AuthFriendList []uint32
|
||||
// For syncing with local GS SDK buddy list
|
||||
RecvStatusFromList []uint32
|
||||
|
||||
QR2IP uint64
|
||||
Reservation common.MatchCommandData
|
||||
|
|
|
|||
|
|
@ -332,5 +332,37 @@ func (g *GameSpySession) bestieMessage(command common.GameSpyCommand) {
|
|||
newMsgStr = "GPCM90vMAT" + string(cmd) + common.Base64DwcEncoding.EncodeToString(newMsg)
|
||||
}
|
||||
|
||||
sendMessageToSession("1", g.User.ProfileId, toSession, newMsgStr)
|
||||
// Check if this session is on the destination's RecvStatusFromList
|
||||
for _, friend := range toSession.RecvStatusFromList {
|
||||
if friend == g.User.ProfileId {
|
||||
// The destination has already received a status message from the sender, so we can just send the message
|
||||
sendMessageToSession("1", g.User.ProfileId, toSession, newMsgStr)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
// Send a dummy status message so the destination will accept a message from the sender
|
||||
message := common.CreateGameSpyMessage(common.GameSpyCommand{
|
||||
Command: "bm",
|
||||
CommandValue: "100",
|
||||
OtherValues: map[string]string{
|
||||
"f": strconv.FormatUint(uint64(g.User.ProfileId), 10),
|
||||
"msg": "|s|0|ss||ls||ip|0|p|0|qm|0",
|
||||
},
|
||||
})
|
||||
|
||||
message += common.CreateGameSpyMessage(common.GameSpyCommand{
|
||||
Command: "bm",
|
||||
CommandValue: "1",
|
||||
OtherValues: map[string]string{
|
||||
"f": strconv.FormatUint(uint64(g.User.ProfileId), 10),
|
||||
"msg": newMsgStr,
|
||||
},
|
||||
})
|
||||
|
||||
toSession.Conn.Write([]byte(message))
|
||||
|
||||
// Append sender's profile ID to dest's RecvStatusFromList
|
||||
toSession.RecvStatusFromList = append(toSession.RecvStatusFromList, g.User.ProfileId)
|
||||
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user