mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-10-13 15:14:21 +00:00
Multicast chat messages
Only the sender and the recipients receive the chat messages. This commit only has an affecto on messages where the addressee(s) are selected through the dropdown. Addressee(s) selected with a "/" command are still sent to evevyone and filteret by the receiver.
This commit is contained in:
@@ -41,6 +41,8 @@
|
||||
|
||||
#include "third_party/encryption/pkcs5_pbkdf2.h"
|
||||
|
||||
#include <optional>
|
||||
|
||||
namespace JSI_Network
|
||||
{
|
||||
u16 GetDefaultPort()
|
||||
@@ -237,11 +239,25 @@ void KickPlayer(const CStrW& playerName, bool ban)
|
||||
g_NetClient->SendKickPlayerMessage(playerName, ban);
|
||||
}
|
||||
|
||||
void SendNetworkChat(const CStrW& message)
|
||||
void SendNetworkChat(const ScriptRequest& rq, const CStrW& message, JS::HandleValue handle)
|
||||
{
|
||||
ENSURE(g_NetClient);
|
||||
|
||||
g_NetClient->SendChatMessage(message);
|
||||
if (handle.isNullOrUndefined())
|
||||
{
|
||||
g_NetClient->SendChatMessage(message, std::nullopt);
|
||||
return;
|
||||
}
|
||||
|
||||
auto receivers = std::make_optional<std::vector<std::string>>();
|
||||
if (!Script::FromJSVal(rq, handle, *receivers))
|
||||
{
|
||||
ScriptException::Raise(rq, "The second argument to `SendNetworkChat` has to be either an Array "
|
||||
"or a nullish value.");
|
||||
return;
|
||||
}
|
||||
|
||||
g_NetClient->SendChatMessage(message, std::move(receivers));
|
||||
}
|
||||
|
||||
void SendNetworkReady(int message)
|
||||
|
||||
Reference in New Issue
Block a user