This is something I have asked for previously. I have written my own p2p raknet plugin that maintains p2p connections to all your friends that are logged in to the lobby. It uses some special code that I have added to the Lobby2 that serializes the GUID of the user in the Lobb2Presence data.
It might not be 100% correct RakNet code but it works and helps alot. It doesn't yet take into account multiple user logins with the same account name.
It would be great to see a proper RakNet way of serializing guids from the Lobby.
Note: This has nothing to do with the Rooms plugin.
void Lobby2Server::GetUserOnlineStatus(UsernameAndOnlineStatus &userInfo) const
{
unsigned int idx = GetUserIndexByUsername(userInfo.handle);
if (idx!=-1)
{
User *pUser = users[idx];
userInfo.isOnline=true;
userInfo.presence= pUser->presence;0);
userInfo.presence.guid = pUser->guids.Get(0);
}
else
{
userInfo.isOnline=false;
userInfo.presence.status=Lobby2Presence::NOT_ONLINE;
userInfo.presence.isVisible=false;
}
}
void Lobby2Server::GetPresence(RakNet::Lobby2Presence &presence, RakNet::RakString userHandle)
{
unsigned int userIndex = GetUserIndexByUsername(userHandle);
if (userIndex!=-1)
{
User *pUser = users[userIndex];
presence = pUser->presence;
presence.guid = pUser->guids.Get(0);
}
else
{
presence.status=Lobby2Presence::NOT_ONLINE;
}
}
Lobby2Presence::Lobby2Presence(const Lobby2Presence& input) {
status=input.status;
isVisible=input.isVisible;
titleNameOrID=input.titleNameOrID;
#if defined(_XBOX) || defined(X360)
#endif
statusString=input.statusString;
guid=input.guid;
}
Lobby2Presence& Lobby2Presence::operator = ( const Lobby2Presence& input )
{
status=input.status;
isVisible=input.isVisible;
titleNameOrID=input.titleNameOrID;
#if defined(_XBOX) || defined(X360)
#endif
statusString=input.statusString;
guid=input.guid;
return *this;
}
struct Lobby2Presence
{
.....
RakNet::RakNetGUID guid;
};