Compare commits
4 Commits
ead47834fb
...
2d1db7b1ef
Author | SHA1 | Date |
---|---|---|
Tristan B. Velloza Kildaire | 2d1db7b1ef | |
Tristan B. Velloza Kildaire | ad9c01f490 | |
Tristan B. Velloza Kildaire | f48e95887f | |
Tristan B. Velloza Kildaire | 9dadb5aec9 |
|
@ -29,6 +29,7 @@ public enum MessageType
|
|||
*/
|
||||
public enum Status
|
||||
{
|
||||
UNSET,
|
||||
GOOD,
|
||||
BAD_ARGS,
|
||||
NOT_AUTHD,
|
||||
|
@ -187,6 +188,14 @@ public enum CommandType
|
|||
*/
|
||||
CHANNEL_SEND_MESSAGE,
|
||||
|
||||
/**
|
||||
* Channel message (reply)
|
||||
*
|
||||
* Status on if message was
|
||||
* sent or not
|
||||
*/
|
||||
SEND_CHANNEL_MESG_REP,
|
||||
|
||||
/**
|
||||
* Membership (join)
|
||||
*
|
||||
|
|
|
@ -154,12 +154,11 @@ public class BaseMessage
|
|||
import davinci.c2s.channels : ChannelEnumerateReply;
|
||||
message.command = Command.decodeTo!(ChannelEnumerateReply)(payload);
|
||||
}
|
||||
else if(message.commandType == CommandType.CHANNEL_SEND_MESSAGE)
|
||||
{
|
||||
import davinci.c2s.channels : ChannelMessage;
|
||||
message.command = Command.decodeTo!(ChannelMessage)(payload);
|
||||
}
|
||||
else if(message.commandType == CommandType.CHANNEL_NEW_MESSAGE)
|
||||
else if(
|
||||
message.commandType == CommandType.CHANNEL_NEW_MESSAGE ||
|
||||
message.commandType == CommandType.CHANNEL_SEND_MESSAGE ||
|
||||
message.commandType == CommandType.SEND_CHANNEL_MESG_REP
|
||||
)
|
||||
{
|
||||
import davinci.c2s.channels : ChannelMessage;
|
||||
message.command = Command.decodeTo!(ChannelMessage)(payload);
|
||||
|
|
|
@ -75,6 +75,8 @@ public final class ChannelMessage : Command
|
|||
// TODO: Add mime-type here
|
||||
private string data;
|
||||
|
||||
private Status status;
|
||||
|
||||
this()
|
||||
{
|
||||
registerClass!(typeof(this));
|
||||
|
@ -117,6 +119,27 @@ public final class ChannelMessage : Command
|
|||
{
|
||||
return data;
|
||||
}
|
||||
|
||||
public ChannelMessage messageDelivered()
|
||||
{
|
||||
return setStatus(Status.GOOD);
|
||||
}
|
||||
|
||||
public ChannelMessage setStatus(Status status)
|
||||
{
|
||||
this.status = status;
|
||||
return this;
|
||||
}
|
||||
|
||||
public Status getStatus()
|
||||
{
|
||||
return this.status;
|
||||
}
|
||||
|
||||
public bool wasDelivered()
|
||||
{
|
||||
return getStatus() == Status.GOOD;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
|
Loading…
Reference in New Issue