mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-11-08 13:51:45 +00:00
Use XMPP Roster for BuddyList
This allows the same user to keep the buddy list across clients and config resets. At the same time this allows for per lobby buddy lists which is needed as the same nickname may refer to different people. Use lower case comparison for buddy names. This is in line with the idea of local part of jid should be seen as normalized nick and is used server-side to compare user names. The migration is kept simple. I.e. only attempted if the roster is empty and the config indicates no migration was done before. Fixes: #6824 Signed-off-by: Ralph Sennhauser <ralph.sennhauser@gmail.com>
This commit is contained in:
16 files changed
+313
-65
No files matched your search
@@ -20,6 +20,7 @@
|
||||
#include "JSInterface_Network.h"
|
||||
|
||||
#include "lib/code_generation.h"
|
||||
#include "lib/config2.h"
|
||||
#include "lib/debug.h"
|
||||
#include "lib/utf8.h"
|
||||
#include "lobby/XmppClient.h"
|
||||
@@ -45,6 +46,7 @@
|
||||
#include <js/TypeDecls.h>
|
||||
#include <js/Value.h>
|
||||
#include <optional>
|
||||
#include <set>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <utility>
|
||||
@@ -109,7 +111,18 @@ void StartNetworkHost(const CStrW& playerName, const std::uint16_t serverPort, c
|
||||
HashCryptographically(password, hostJID + password + PS_SERIALIZATION_VERSION) : "";
|
||||
|
||||
const std::string secret = ps_generate_guid();
|
||||
g_NetServer = new CNetServer(continueSavedGame, serverPort, hasLobby, hashedPassword, secret);
|
||||
|
||||
// Snapshot the host's buddies from the roster of the lobby they are
|
||||
// connected to. Hosting without a lobby means there is no roster, so
|
||||
// nobody is a buddy.
|
||||
std::set<std::string> buddies;
|
||||
#if CONFIG2_LOBBY
|
||||
if (hasLobby)
|
||||
buddies = g_XmppClient->GetBuddies();
|
||||
#endif
|
||||
|
||||
g_NetServer = new CNetServer(continueSavedGame, serverPort, hasLobby, hashedPassword, secret,
|
||||
{}, buddies);
|
||||
|
||||
// Generate a secret to identify the host client.
|
||||
|
||||
|
||||
Reference in new issue
Block a user