[Party] Don't let players join lobby with an incorrect password.
This commit is contained in:
parent
301690653d
commit
824a2a200a
@ -447,7 +447,7 @@ namespace Components
|
||||
// Send playlist request
|
||||
Party::Container.requestTime = Game::Sys_Milliseconds();
|
||||
Party::Container.awaitingPlaylist = true;
|
||||
Network::SendCommand(Party::Container.target, "getplaylist");
|
||||
Network::SendCommand(Party::Container.target, "getplaylist", Dvar::Var("password").get<std::string>());
|
||||
|
||||
// This is not a safe method
|
||||
// TODO: Fix actual error!
|
||||
|
@ -45,6 +45,16 @@ namespace Components
|
||||
|
||||
void Playlist::PlaylistRequest(Network::Address address, std::string data)
|
||||
{
|
||||
std::string password = Dvar::Var("g_password").get<std::string>();
|
||||
if (password.length())
|
||||
{
|
||||
if (password != data)
|
||||
{
|
||||
Network::SendCommand(address, "playlistInvalidPassword");
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
Logger::Print("Received playlist request, sending currently stored buffer.\n");
|
||||
|
||||
std::string compressedList = Utils::Compression::ZLib::Compress(Playlist::CurrentPlaylistBuffer);
|
||||
@ -104,6 +114,11 @@ namespace Components
|
||||
}
|
||||
}
|
||||
|
||||
void Playlist::PlaylistInvalidPassword(Network::Address address, std::string data)
|
||||
{
|
||||
Party::PlaylistError("Error: Invalid Password for Party.");
|
||||
}
|
||||
|
||||
void Playlist::MapNameCopy(char *dest, const char *src, int destsize)
|
||||
{
|
||||
Utils::Hook::Call<void(char*, const char*, int)>(0x4D6F80)(dest, src, destsize);
|
||||
@ -173,6 +188,7 @@ namespace Components
|
||||
|
||||
Network::Handle("getPlaylist", PlaylistRequest);
|
||||
Network::Handle("playlistResponse", PlaylistReponse);
|
||||
Network::Handle("playlistInvalidPassword", PlaylistInvalidPassword);
|
||||
}
|
||||
|
||||
Playlist::~Playlist()
|
||||
|
@ -22,6 +22,7 @@ namespace Components
|
||||
|
||||
static void PlaylistRequest(Network::Address address, std::string data);
|
||||
static void PlaylistReponse(Network::Address address, std::string data);
|
||||
static void PlaylistInvalidPassword(Network::Address address, std::string data);
|
||||
|
||||
static void MapNameCopy(char *dest, const char *src, int destsize);
|
||||
static void SetMapName(const char* cvar, const char* value);
|
||||
|
Loading…
Reference in New Issue
Block a user