From 3e6d5daede59b48f56ba722ebb17bab7144b8c9a Mon Sep 17 00:00:00 2001 From: "Tristan B. Kildaire" Date: Tue, 20 Oct 2020 10:32:50 +0200 Subject: [PATCH] Implemented `isProperty` --- source/libdnet/dclient.d | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/source/libdnet/dclient.d b/source/libdnet/dclient.d index 44651c1..4858b52 100644 --- a/source/libdnet/dclient.d +++ b/source/libdnet/dclient.d @@ -251,6 +251,35 @@ public final class DClient return propertyValue; } + /** + * Check's whether the user has the given property + */ + public bool isProperty(string user, string property) + { + /* The property's value */ + bool status; + + /* The protocol data to send */ + byte[] data = [19]; + 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 */ + status = cast(bool)resp[1]; + } + + return status; + } + /** * Lists all the channels on the server