1
0
mirror of https://github.com/deavminet/dnetd synced 2024-09-21 09:43:37 +02:00

Fixed protocol type number 5

This commit is contained in:
Tristan B. Kildaire 2020-09-28 10:12:13 +02:00
parent aa41a13aed
commit a5f8596062

View File

@ -118,7 +118,7 @@ public class DConnection : Thread
receivedMessage = DataMessage.decode(receivedBytes); receivedMessage = DataMessage.decode(receivedBytes);
/* Process the message */ /* Process the message */
process(receivedMessage); process(receivedMessage);
/* TODO: Tristanable needs reserved-tag support (client-side concern) */ /* TODO: Tristanable needs reserved-tag support (client-side concern) */
} }
@ -359,23 +359,22 @@ public class DConnection : Thread
bool status = true; bool status = true;
/* Get the type of message */ /* Get the type of message */
byte messageType = message.data[0]; byte messageType = message.data[1];
/* Get the location length */
byte locationLength = message.data[2];
/* Get the channel/person name */ /* Get the channel/person name */
string destination; string destination = cast(string)message.data[3..cast(ulong)3+locationLength];
ulong i = 0;
while(message.data[1+i] != cast(byte)0)
{
destination ~= message.data[1+i];
i++;
}
/* Get the message (offset from null-terminator, hence +1 at the end) */ /* Get the message */
string msg = cast(string)message.data[1+i+1..message.data.length]; string msg = cast(string)message.data[cast(ulong)3+locationLength..message.data.length];
/* Send status */ /* Send status */
bool sendStatus; bool sendStatus;
writeln("bababoi b4");
/* If we are sending to a user */ /* If we are sending to a user */
if(messageType == cast(byte)0) if(messageType == cast(byte)0)
{ {
@ -408,6 +407,8 @@ public class DConnection : Thread
/* TODO: Handling here, should we make the user wait? */ /* TODO: Handling here, should we make the user wait? */
writeln("bababoi after");
/* Encode the reply */ /* Encode the reply */
/* TODO: */ /* TODO: */
reply = [status]; reply = [status];