Skip to content

Commit 86b7754

Browse files
committed
Added security support to custom messages
1 parent 721b8d2 commit 86b7754

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

MLAPI/MonoBehaviours/Core/NetworkingManager.cs

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -174,7 +174,8 @@ internal void InvokeOnIncomingCustomMessage(uint clientId, Stream stream)
174174
/// <param name="clientIds">The clients to send to, sends to everyone if null</param>
175175
/// <param name="stream">The message stream containing the data</param>
176176
/// <param name="channel">The channel to send the data on</param>
177-
public void SendCustomMessage(List<uint> clientIds, BitStream stream, string channel = "MLAPI_DEFAULT_MESSAGE")
177+
/// <param name="security">The security settings to apply to the message</param>
178+
public void SendCustomMessage(List<uint> clientIds, BitStream stream, string channel = null, SecuritySendFlags security = SecuritySendFlags.None)
178179
{
179180
if (!IsServer)
180181
{
@@ -185,14 +186,14 @@ public void SendCustomMessage(List<uint> clientIds, BitStream stream, string cha
185186
{
186187
for (int i = 0; i < ConnectedClientsList.Count; i++)
187188
{
188-
InternalMessageHandler.Send(ConnectedClientsList[i].ClientId, MLAPIConstants.MLAPI_CUSTOM_MESSAGE, channel, stream, SecuritySendFlags.None);
189+
InternalMessageHandler.Send(ConnectedClientsList[i].ClientId, MLAPIConstants.MLAPI_CUSTOM_MESSAGE, string.IsNullOrEmpty(channel) ? "MLAPI_DEFAULT_MESSAGE" : channel, stream, security);
189190
}
190191
}
191192
else
192193
{
193194
for (int i = 0; i < clientIds.Count; i++)
194195
{
195-
InternalMessageHandler.Send(clientIds[i], MLAPIConstants.MLAPI_CUSTOM_MESSAGE, channel, stream, SecuritySendFlags.None);
196+
InternalMessageHandler.Send(clientIds[i], MLAPIConstants.MLAPI_CUSTOM_MESSAGE, string.IsNullOrEmpty(channel) ? "MLAPI_DEFAULT_MESSAGE" : channel, stream, security);
196197
}
197198
}
198199
}
@@ -203,9 +204,10 @@ public void SendCustomMessage(List<uint> clientIds, BitStream stream, string cha
203204
/// <param name="clientId">The client to send the message to</param>
204205
/// <param name="stream">The message stream containing the data</param>
205206
/// <param name="channel">The channel tos end the data on</param>
206-
public void SendCustomMessage(uint clientId, BitStream stream, string channel = "MLAPI_DEFAULT_MESSAGE")
207+
/// <param name="security">The security settings to apply to the message</param>
208+
public void SendCustomMessage(uint clientId, BitStream stream, string channel = null, SecuritySendFlags security = SecuritySendFlags.None)
207209
{
208-
InternalMessageHandler.Send(clientId, MLAPIConstants.MLAPI_CUSTOM_MESSAGE, channel, stream, SecuritySendFlags.None);
210+
InternalMessageHandler.Send(clientId, MLAPIConstants.MLAPI_CUSTOM_MESSAGE, string.IsNullOrEmpty(channel) ? "MLAPI_DEFAULT_MESSAGE" : channel, stream, security);
209211
}
210212

211213
private void OnValidate()

0 commit comments

Comments
 (0)