1
0
Fork 0
mirror of https://github.com/besterprotocol/besterd synced 2023-12-13 21:00:32 +01:00

Retieve matched users for 'SEND_CLIENTS' command

This commit is contained in:
Tristan B. Kildaire 2020-04-25 22:33:35 +02:00
parent 1ca8f6e777
commit b56e989460
2 changed files with 10 additions and 4 deletions

View file

@ -131,9 +131,15 @@ public final class HandlerResponse
{ {
clients ~= clientList[i].str(); clients ~= clientList[i].str();
} }
/* TODO: Implement me */
writeln("Users wanting to send to ", clients); writeln("Users wanting to send to ", clients);
/* Find the users that are wanting to be sent to */
BesterConnection[] connectionList = originalRequester.server.getClients(clients);
writeln(connectionList);
/* TODO: Implement me */
writeln("sdafdfasd", originalRequester.server.clients[0].toString()); writeln("sdafdfasd", originalRequester.server.clients[0].toString());
} }
else if (commandType == CommandType.SEND_SERVERS) else if (commandType == CommandType.SEND_SERVERS)

View file

@ -39,13 +39,13 @@ public final class BesterServer
/* Search through the provided usernames */ /* Search through the provided usernames */
for(ulong i = 0; i < usernames.length; i++) for(ulong i = 0; i < usernames.length; i++)
{ {
for(ulong k = 0; k < clients.lenght; k++) for(ulong k = 0; k < clients.length; k++)
{ {
/* The potentially-matched user */ /* The potentially-matched user */
BesterConnection potentialMatch = clients[k]; BesterConnection potentialMatch = clients[k];
/* Check if the user is authenticated */ /* Check if the user is authenticated */
if(potentialMatch.isUser() && cmp(potentialMatch.getCredentials()[0], usernames[i]) if(potentialMatch.isUser() && cmp(potentialMatch.getCredentials()[0], usernames[i]))
{ {
matchedUsers ~= potentialMatch; matchedUsers ~= potentialMatch;
} }