Implemented `getProperty` command

This commit is contained in:
Tristan B. Kildaire 2020-10-20 10:26:47 +02:00
parent ba72ba2dbf
commit d040dcf926
1 changed files with 29 additions and 0 deletions

View File

@ -222,6 +222,35 @@ public final class DClient
return properties;
}
/**
* Get a property's value
*/
public string getProperty(string user, string property)
{
/* The property's value */
string propertyValue;
/* The protocol data to send */
byte[] data = [16];
data ~= user~","~property;
/* Send the protocol data */
DataMessage protocolData = new DataMessage(reqRepQueue.getTag(), data);
bSendMessage(socket, protocolData.encode());
/* Receive the server's response */
byte[] resp = reqRepQueue.dequeue().getData();
/* If it worked */
if(cast(bool)resp[0])
{
/* Get the property line */
propertyValue = cast(string)resp[1..resp.length];
}
return propertyValue;
}
/**
* Lists all the channels on the server