- Documented
This commit is contained in:
Tristan B. Velloza Kildaire 2023-11-23 09:40:39 +02:00
parent 9e137e4301
commit f11c81d599
1 changed files with 46 additions and 0 deletions

View File

@ -5,12 +5,24 @@ import std.container.dlist : DList;
import core.sync.mutex : Mutex;
import renaissance.logging;
/**
* An in-memory representation of
* a message
*/
public struct Message
{
private string destination;
private string message;
private string from;
/**
* Constructs a new message
*
* Params:
* destination = the destination
* from = the from user
* message = the message itself
*/
this(string destination, string from, string message)
{
this.destination = destination;
@ -18,31 +30,65 @@ public struct Message
this.message = message;
}
/**
* Sets the message's body
*
* Params:
* message = the contents
*/
public void setBody(string message)
{
this.message = message;
}
/**
* Sets the from paramneter
*
* Params:
* from = the username
*/
public void setFrom(string from)
{
this.from = from;
}
/**
* Sets the destination of this message
*
* Params:
* destination = the username
*/
public void setDestination(string destination)
{
this.destination = destination;
}
/**
* Returns the contents of this
* message
*
* Returns: the contents
*/
public string getBody()
{
return this.message;
}
/**
* Returns the from parameter
*
* Returns: the username
*/
public string getFrom()
{
return this.from;
}
/**
* Returns the destination
*
* Returns: the username
*/
public string getDestination()
{
return this.destination;