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:
parent
e07f456848
commit
aa41a13aed
@ -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()
|
||||||
|
@ -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
|
||||||
|
Loading…
Reference in New Issue
Block a user