Changed command `listFolder` to `listMail`

This commit is contained in:
Tristan B. Kildaire 2020-06-19 16:05:41 +02:00
parent 5caa99c06f
commit 452937dea5
3 changed files with 28 additions and 3 deletions

View File

@ -237,7 +237,7 @@ JSON sent:
```json
{
"command" : "listFolder",
"command" : "listMail",
"request" : {
"folderName" : "<folderName>"
}

View File

@ -8,6 +8,7 @@ import std.json;
import std.string;
import client.mail;
import server.server;
import std.conv : to;
public final class ButterflyClient : Thread
{
@ -255,18 +256,37 @@ public final class ButterflyClient : Thread
/* TODO: Add error handling */
}
}
else if(cmp(command, "listFolder") == 0)
else if(cmp(command, "listMail") == 0)
{
/* Make sure the connection is from a client */
if(connectionType == ClientType.CLIENT)
{
/* TODO: Implement me */
/* Get the folder wanting to be listed */
Folder listFolder = new Folder(mailbox, commandBlock["request"]["folderName"].str());
responseBlock["mailIDs"] = to!(string)(listFolder.getMessages());
}
else
{
/* TODO: Add error handling */
}
}
else if(cmp(command, "listFolder") == 0)
{
/* Make sure the connection is from a client */
if(connectionType == ClientType.CLIENT)
{
/* Get the folder wanting to be listed */
Folder listFolder = new Folder(mailbox, commandBlock["request"]["folderName"].str());
//responseBlock["folders"] = to!(string)(listFolder.getMessages());
}
else
{
/* TODO: Add error handling */
}
}
else if(cmp(command, "totsiens") == 0)
{
/* Close the connection on next loop condition check */

View File

@ -335,4 +335,9 @@ public final class Mail
return messageBlock;
}
override public string toString()
{
return "\""~mailID~"\"";
}
}