mirror of
https://github.com/PretendoNetwork/friends.git
synced 2026-04-24 14:56:52 -05:00
make 3DS friends display as online again
This commit is contained in:
parent
6916dbb1c1
commit
abb19ddf43
|
|
@ -22,14 +22,16 @@ func GetFriendPersistentInfos(user1_pid uint32, pids []uint32) ([]*friends_3ds_t
|
|||
|
||||
gameKey := friends_3ds_types.NewGameKey()
|
||||
|
||||
var pid uint32
|
||||
var lastOnlineTime uint64
|
||||
var msgUpdateTime uint64
|
||||
var miiModifiedAtTime uint64
|
||||
|
||||
rows.Scan(
|
||||
&persistentInfo.PID, &persistentInfo.Region, &persistentInfo.Area, &persistentInfo.Language,
|
||||
&pid, &persistentInfo.Region, &persistentInfo.Area, &persistentInfo.Language,
|
||||
&gameKey.TitleID, &gameKey.TitleVersion, &persistentInfo.Message, &msgUpdateTime, &lastOnlineTime, &miiModifiedAtTime)
|
||||
|
||||
persistentInfo.PID = nex.NewPID(pid)
|
||||
persistentInfo.MessageUpdatedAt = nex.NewDateTime(msgUpdateTime)
|
||||
persistentInfo.MiiModifiedAt = nex.NewDateTime(miiModifiedAtTime)
|
||||
persistentInfo.LastOnline = nex.NewDateTime(lastOnlineTime)
|
||||
|
|
|
|||
|
|
@ -4,6 +4,7 @@ import (
|
|||
"database/sql"
|
||||
|
||||
"github.com/PretendoNetwork/friends/database"
|
||||
"github.com/PretendoNetwork/nex-go"
|
||||
friends_3ds_types "github.com/PretendoNetwork/nex-protocols-go/friends-3ds/types"
|
||||
)
|
||||
|
||||
|
|
@ -14,7 +15,7 @@ func GetUserFriends(pid uint32) ([]*friends_3ds_types.FriendRelationship, error)
|
|||
rows, err := database.Postgres.Query(`
|
||||
SELECT user2_pid, type FROM "3ds".friendships WHERE user1_pid=$1 AND type=1 LIMIT 100`, pid)
|
||||
if err != nil {
|
||||
if err == sql.ErrNoRows {
|
||||
if err == sql.ErrNoRows {
|
||||
return friendRelationships, database.ErrEmptyList
|
||||
} else {
|
||||
return friendRelationships, err
|
||||
|
|
@ -22,9 +23,14 @@ func GetUserFriends(pid uint32) ([]*friends_3ds_types.FriendRelationship, error)
|
|||
}
|
||||
|
||||
for rows.Next() {
|
||||
var pid uint32
|
||||
|
||||
relationship := friends_3ds_types.NewFriendRelationship()
|
||||
relationship.LFC = 0
|
||||
rows.Scan(&relationship.PID, &relationship.RelationshipType)
|
||||
|
||||
rows.Scan(&pid, &relationship.RelationshipType)
|
||||
|
||||
relationship.PID = nex.NewPID(pid)
|
||||
|
||||
friendRelationships = append(friendRelationships, relationship)
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,14 +7,21 @@ import (
|
|||
"github.com/PretendoNetwork/friends/globals"
|
||||
nex "github.com/PretendoNetwork/nex-go"
|
||||
friends_3ds "github.com/PretendoNetwork/nex-protocols-go/friends-3ds"
|
||||
friends_3ds_types "github.com/PretendoNetwork/nex-protocols-go/friends-3ds/types"
|
||||
)
|
||||
|
||||
func GetFriendMii(err error, packet nex.PacketInterface, callID uint32, pids []uint32) (*nex.RMCMessage, uint32) {
|
||||
func GetFriendMii(err error, packet nex.PacketInterface, callID uint32, friends []*friends_3ds_types.FriendInfo) (*nex.RMCMessage, uint32) {
|
||||
if err != nil {
|
||||
globals.Logger.Error(err.Error())
|
||||
return nil, nex.Errors.FPD.InvalidArgument
|
||||
}
|
||||
|
||||
pids := make([]uint32, 0, len(friends))
|
||||
|
||||
for _, friend := range friends {
|
||||
pids = append(pids, friend.PID.LegacyValue())
|
||||
}
|
||||
|
||||
miiList, err := database_3ds.GetFriendMiis(pids)
|
||||
if err != nil && err != sql.ErrNoRows {
|
||||
globals.Logger.Critical(err.Error())
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user