Added command 'createFolder(string)'

This commit is contained in:
Tristan B. Kildaire 2020-06-19 18:55:46 +02:00
parent 5a0566ae01
commit 371288ac20
1 changed files with 33 additions and 0 deletions

View File

@ -128,6 +128,39 @@ public final class ButterflyClient
}
}
public void createFolder(string folderPath)
{
/**
* Construct the command.
*/
JSONValue commandBlock;
commandBlock["command"] = "createFolder";
JSONValue requestBlock;
requestBlock["folderName"] = folderPath;
commandBlock["request"] = requestBlock;
/* Send the command */
sendMessage(connection, cast(byte[])toJSON(commandBlock));
/* Get the status */
JSONValue response;
byte[] receivedBytes;
receiveMessage(connection, receivedBytes);
response = parseJSON(cast(string)receivedBytes);
if(response["status"].integer() == 0)
{
/* TODO: Good */
}
else
{
/* TODO: Throw an exception here */
}
}
public string[] listMail(string folderPath)
{
/**