diff --git a/source/dnetd/dchannel.d b/source/dnetd/dchannel.d index 9c472f4..da4e22c 100644 --- a/source/dnetd/dchannel.d +++ b/source/dnetd/dchannel.d @@ -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) diff --git a/source/dnetd/dconnection.d b/source/dnetd/dconnection.d index 6723f7e..85bcedc 100644 --- a/source/dnetd/dconnection.d +++ b/source/dnetd/dconnection.d @@ -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; }