From 759d1623a17645d22edab35a8dd08addbf061902 Mon Sep 17 00:00:00 2001 From: "Tristan B. Kildaire" Date: Tue, 20 Oct 2020 07:57:21 +0200 Subject: [PATCH] Added default status --- source/dnetd/dconnection.d | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/source/dnetd/dconnection.d b/source/dnetd/dconnection.d index 561df16..cd18b99 100644 --- a/source/dnetd/dconnection.d +++ b/source/dnetd/dconnection.d @@ -93,6 +93,9 @@ public class DConnection : Thread /* Initialize locks */ initLocks(); + /* Initialize status */ + currentStatus = "available,Hey there I'm using DNET!"; + /* Start the connection handler */ start(); } @@ -616,6 +619,7 @@ public class DConnection : Thread bool status = true; /* TODO: Implement me */ + string user = cast(string)message.data[1..message.data.length]; /* TODO: fetch longontime, serveron, status */ string logontime; @@ -627,7 +631,7 @@ public class DConnection : Thread reply ~= logontime; reply ~= [cast(byte)serveron.length]; reply ~= serveron; - reply ~= getStatusMessage(); + reply ~= server.getStatusMessage(user); } /* If `status` command (requires: authed, client) */ else if(command == Command.STATUS && hasAuthed && connType == ConnectionType.CLIENT) @@ -772,21 +776,23 @@ public class DConnection : Thread /** * Returns the current status message */ - public string getStatusMessage() + public string getStatusMessage(string username) { - /* The current status message */ - string currentStatusMessage; + /* The status message */ + string statusMessage; + + writeln("hfsjkhfjsdkhfdskj"); /* Lock the status message mutex */ statusMessageLock.lock(); - /* Copy the status message */ - currentStatusMessage = currentStatus; + /* Get the status message */ + statusMessage = currentStatus; /* Unlock the statue message mutex */ statusMessageLock.unlock(); - return currentStatusMessage; + return statusMessage; } public ConnectionType getConnectionType()