My fok marelize

This commit is contained in:
Tristan B. Kildaire 2020-10-20 23:16:50 +02:00
parent 04e12941fb
commit 7e18e8e6fc
2 changed files with 28 additions and 1 deletions

View File

@ -269,7 +269,20 @@ public class DChannel
* byte length of name of channel/person (dm case)
* message-bytes
*/
msg ~= [cast(byte)1,(cast(byte)sender.getUsername().length)]~cast(byte[])sender.getUsername()~cast(byte[])message;
/* Set mode to channel message */
msg ~= [cast(byte)1];
/* Encode the [usernameLength, username] */
msg ~= [(cast(byte)sender.getUsername().length)];
msg ~= cast(byte[])sender.getUsername();
/* Encode the [channelLength, channel] */
msg ~= [(cast(byte)name.length)];
msg ~= cast(byte[])name;
/* Encode the message */
msg ~= cast(byte[])message;
/* Send the message to everyone else in the channel */
foreach(DConnection member; members)

View File

@ -766,7 +766,20 @@ public class DConnection : Thread
/* If `delete_user_prop` (requires: authed, client) */
else if(command == Command.DELETE_USER_PROP && hasAuthed && connType == ConnectionType.CLIENT)
{
/* Get the property */
string property = cast(string)message.data[1..message.data.length];
/* Check if the key exists */
bool keyExists = isProperty(property);
/* If the property exists */
if(keyExists)
{
/* Delete the property */
deleteProperty(property);
}
reply ~= [keyExists];
}
/* If `is_user_prop` (requires: authed, client) */
else if(command == Command.IS_USER_PROP && hasAuthed && connType == ConnectionType.CLIENT)
@ -824,6 +837,7 @@ public class DConnection : Thread
private bool authenticate(string username, string password)
{
/* TODO: Implement me */
this.username = username;
return true;
}