Compare commits
3 Commits
09a4907044
...
ead47834fb
Author | SHA1 | Date |
---|---|---|
Tristan B. Velloza Kildaire | ead47834fb | |
Tristan B. Velloza Kildaire | 9d010247f5 | |
Tristan B. Velloza Kildaire | 4002854c50 |
|
@ -35,6 +35,30 @@ public enum Status
|
||||||
NOT_USER
|
NOT_USER
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Support for message validation
|
||||||
|
* to ensure that it is valid given
|
||||||
|
* some of its parameters
|
||||||
|
*/
|
||||||
|
public interface Validatable
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* Validates the item returning whether
|
||||||
|
* this process failed or not
|
||||||
|
*
|
||||||
|
* In the case of a failure the ref-based
|
||||||
|
* argument is updated with the reason
|
||||||
|
* of failure
|
||||||
|
*
|
||||||
|
* Params:
|
||||||
|
* reason = the reason of failure (if
|
||||||
|
* any)
|
||||||
|
* Returns: `true` if the validation
|
||||||
|
* passes, `false` otherwise
|
||||||
|
*/
|
||||||
|
public bool validate(ref string reason);
|
||||||
|
}
|
||||||
|
|
||||||
public abstract class Command
|
public abstract class Command
|
||||||
{
|
{
|
||||||
private byte[] data;
|
private byte[] data;
|
||||||
|
@ -94,6 +118,13 @@ public enum CommandType
|
||||||
SPACER,
|
SPACER,
|
||||||
NOP_COMMAND,
|
NOP_COMMAND,
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Error
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
ERROR,
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Unknown command
|
* Unknown command
|
||||||
*
|
*
|
||||||
|
|
|
@ -80,11 +80,16 @@ public final class ChannelMessage : Command
|
||||||
registerClass!(typeof(this));
|
registerClass!(typeof(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setMessage(string data)
|
||||||
|
{
|
||||||
|
this.data = data;
|
||||||
|
}
|
||||||
|
|
||||||
public void setTo(string[] to)
|
public void setTo(string[] to)
|
||||||
{
|
{
|
||||||
foreach(string curTo; to)
|
foreach(string curTo; to)
|
||||||
{
|
{
|
||||||
this.to ~= curTo;
|
setTo(curTo);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue