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

Refactored bool 'status' after user/channel send

This commit is contained in:
Tristan B. Kildaire 2020-09-27 19:50:39 +02:00
parent e07f456848
commit aa41a13aed
2 changed files with 7 additions and 4 deletions

View File

@ -129,8 +129,9 @@ public class DChannel
memberLock.unlock(); memberLock.unlock();
} }
public void sendMessage(DConnection sender, string message) public bool sendMessage(DConnection sender, string message)
{ {
bool status;
/* TODO: Generate message */ /* TODO: Generate message */
/* TODO: Spec out in protocol */ /* TODO: Spec out in protocol */
/* TODO: Reserved tag 0 for notifications */ /* TODO: Reserved tag 0 for notifications */
@ -152,12 +153,15 @@ public class DChannel
{ {
/* Send the message */ /* Send the message */
writeln("Delivering message for channel '"~name~"' to user '"~member.getUsername()~"'..."); writeln("Delivering message for channel '"~name~"' to user '"~member.getUsername()~"'...");
bool status = member.writeSocket(0, msg); status = member.writeSocket(0, msg);
writeln("Delivered message for channel '"~name~"' to user '"~member.getUsername()~"'!"); writeln("Delivered message for channel '"~name~"' to user '"~member.getUsername()~"'!");
/* TODO: Errors from status */ /* TODO: Errors from status */
} }
} }
return status;
} }
public override string toString() public override string toString()

View File

@ -381,7 +381,6 @@ public class DConnection : Thread
{ {
/* Send the message to the user */ /* Send the message to the user */
sendStatus = sendUserMessage(destination, msg); sendStatus = sendUserMessage(destination, msg);
reply = [sendStatus];
} }
/* If we are sending to a channel */ /* If we are sending to a channel */
else if(messageType == cast(ubyte)1) else if(messageType == cast(ubyte)1)
@ -393,7 +392,7 @@ public class DConnection : Thread
if(channel) if(channel)
{ {
/* TODO Implemet me */ /* TODO Implemet me */
channel.sendMessage(this, msg); sendStatus = channel.sendMessage(this, msg);
} }
/* If the channel does not exist */ /* If the channel does not exist */
else else