From c1bf76df1922acf78694293a4a15f31d575c923c Mon Sep 17 00:00:00 2001 From: "Tristan B. Velloza Kildaire" Date: Thu, 16 Mar 2023 13:03:16 +0200 Subject: [PATCH 01/19] Updated IRC compatibility information --- README.md | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index ed07c15..83dedb5 100644 --- a/README.md +++ b/README.md @@ -40,8 +40,10 @@ You can take a look at the `Client` API documentation on [DUB](https://birchwood ## Compatibiloty -- [ ] rfc1459 - * Should be more or less stable in supporting this standard +- [x] [rfc1459](https://www.rfc-editor.org/rfc/rfc1459) + * Supports all the numeric codes +- [x] [rfc2812](https://www.rfc-editor.org/rfc/rfc2812) + * Supports all the numeric codes More standards will be added within the next month or so, mostly relating to new response codes that just need to be added. From b34eaf0e4ee1e348888ce8a37d76fdd0b36b403e Mon Sep 17 00:00:00 2001 From: "Tristan B. Velloza Kildaire" Date: Thu, 16 Mar 2023 13:45:56 +0200 Subject: [PATCH 02/19] Messages - Added work-in-progress `parameterParse()` which attempts to parse parameters and trailing text (if any of both) - Added `ppTrailing` for any possible trailing text - Added `ppKVPairs` for any potential key-value pairs - Call `parameterParse()` on initialization of a new `Message` object --- source/birchwood/protocol/messages.d | 59 ++++++++++++++++++++++++++++ 1 file changed, 59 insertions(+) diff --git a/source/birchwood/protocol/messages.d b/source/birchwood/protocol/messages.d index 590335c..ce70c21 100644 --- a/source/birchwood/protocol/messages.d +++ b/source/birchwood/protocol/messages.d @@ -138,6 +138,9 @@ public final class Message logger.log(e); } } + + /* Parse the parameters into key-value pairs (if any) and trailing text (if any) */ + parameterParse(); } /* TODO: Implement encoder function */ @@ -276,6 +279,62 @@ public final class Message return params; } + + private string ppTrailing; + private string[string] ppKVPairs; + + private void parameterParse() + { + /* Only parse if there are params */ + if(params.length) + { + logger.debug_("Message: ", this); + logger.debug_("ParamsSTring in: ", params); + + /* Key-value pairs */ + string kvPairs; + + /* Trailing text */ + string trailing; + + /* Find the first (and should be only) : (if any) */ + long trailingIdx = indexOf(params, ":"); + + /* If there is trailing */ + if(trailingIdx > -1) + { + /* Then read till (and not including the `:` indicator) */ + kvPairs = params[0..trailingIdx]; + + /* Save the trailing text */ + trailing = params[trailingIdx+1..params.length]; + } + /* If there is no trailing */ + else + { + /* Read the entire parameter string */ + kvPairs = params; + } + + /* Generate the key-value pairs */ + string[] pairs = split(kvPairs, " "); + logger.debug_("Pairs: ", pairs); + foreach(string pair; pairs) + { + /* Only do this if we have an `=` in the current pair */ + if(indexOf(pair, "=") > -1) + { + string key = split(pair, "=")[0]; + string value = split(pair, "=")[1]; + ppKVPairs[key] = value; + } + } + + /* Save the trailing */ + ppTrailing = trailing; + } + } + /** * Returns whether or not this message was * a numeric response From 0224f4554b48cc1949a1f383b557c3712d054153 Mon Sep 17 00:00:00 2001 From: "Tristan B. Velloza Kildaire" Date: Thu, 16 Mar 2023 13:52:29 +0200 Subject: [PATCH 03/19] Messages - Added `getTrailing()` which returns the trailing text - Added `getKVPairs()` which returns the key-value pairs --- source/birchwood/protocol/messages.d | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/source/birchwood/protocol/messages.d b/source/birchwood/protocol/messages.d index ce70c21..a85275b 100644 --- a/source/birchwood/protocol/messages.d +++ b/source/birchwood/protocol/messages.d @@ -280,6 +280,16 @@ public final class Message } + public string getTrailing() + { + return ppTrailing; + } + + public string[string] getKVPairs() + { + return ppKVPairs; + } + private string ppTrailing; private string[string] ppKVPairs; From 8a808cf9f2f32c3393f0ca968bd1770152f70ba1 Mon Sep 17 00:00:00 2001 From: "Tristan B. Velloza Kildaire" Date: Thu, 16 Mar 2023 13:53:14 +0200 Subject: [PATCH 04/19] Client - Test out new `getKVPairs()` and `getTrailing()` --- source/birchwood/client/client.d | 3 +++ 1 file changed, 3 insertions(+) diff --git a/source/birchwood/client/client.d b/source/birchwood/client/client.d index 1c8291e..0f5187c 100644 --- a/source/birchwood/client/client.d +++ b/source/birchwood/client/client.d @@ -609,6 +609,9 @@ public class Client : Thread if(cmp(command, "PRIVMSG") == 0) { + logger.debug_("PrivMessage parser (kv-pairs): ", ircMessage.getKVPairs()); + logger.debug_("PrivMessage parser (trailing): ", ircMessage.getTrailing()); + /* Split up into (channel/nick) and (message)*/ long firstSpaceIdx = indexOf(params, " "); //TODO: validity check; string chanNick = params[0..firstSpaceIdx]; From f120a566a7fd0ae911e74997c71d7e1c1f8312ba Mon Sep 17 00:00:00 2001 From: "Tristan B. Velloza Kildaire" Date: Thu, 16 Mar 2023 13:58:20 +0200 Subject: [PATCH 05/19] Client - Added TODO regarding what needs to be done to update the `"PRIVMSG"` sub-handler --- source/birchwood/client/client.d | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/source/birchwood/client/client.d b/source/birchwood/client/client.d index 0f5187c..ffc17b8 100644 --- a/source/birchwood/client/client.d +++ b/source/birchwood/client/client.d @@ -609,6 +609,11 @@ public class Client : Thread if(cmp(command, "PRIVMSG") == 0) { + // TODO: We will need a non kv pair thing as well to see (in the + // ... case of channel messages) the singular pair + // ... name. + // + // Then our message will be in `getTrailing()` logger.debug_("PrivMessage parser (kv-pairs): ", ircMessage.getKVPairs()); logger.debug_("PrivMessage parser (trailing): ", ircMessage.getTrailing()); From c0a249a31c14af3762d317ddde2a0242c3e42d90 Mon Sep 17 00:00:00 2001 From: "Tristan B. Velloza Kildaire" Date: Thu, 16 Mar 2023 18:19:01 +0200 Subject: [PATCH 06/19] Constants - Don't use octals --- source/birchwood/protocol/constants.d | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/source/birchwood/protocol/constants.d b/source/birchwood/protocol/constants.d index b01a5e4..b1d6d3e 100644 --- a/source/birchwood/protocol/constants.d +++ b/source/birchwood/protocol/constants.d @@ -153,11 +153,11 @@ public enum ReplyType : ulong /** * rfc 2812 */ - RPL_WELCOME = 001, - RPL_YOURHOST = 002, - RPL_CREATED = 003, - RPL_MYINFO = 004, - RPL_BOUNCE = 005, // TODO: We care about the key-value pairs here in RPL_BOUNCE + RPL_WELCOME = 1, + RPL_YOURHOST = 2, + RPL_CREATED = 3, + RPL_MYINFO = 4, + RPL_BOUNCE = 5, // TODO: We care about the key-value pairs here in RPL_BOUNCE ERR_NOCHANMODES = 477, From dafc39274d8da131353a60f0813a1e9b77612f3e Mon Sep 17 00:00:00 2001 From: "Tristan B. Velloza Kildaire" Date: Thu, 16 Mar 2023 18:20:14 +0200 Subject: [PATCH 07/19] Constants - Don't use octal --- source/birchwood/protocol/constants.d | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/source/birchwood/protocol/constants.d b/source/birchwood/protocol/constants.d index b01a5e4..b1d6d3e 100644 --- a/source/birchwood/protocol/constants.d +++ b/source/birchwood/protocol/constants.d @@ -153,11 +153,11 @@ public enum ReplyType : ulong /** * rfc 2812 */ - RPL_WELCOME = 001, - RPL_YOURHOST = 002, - RPL_CREATED = 003, - RPL_MYINFO = 004, - RPL_BOUNCE = 005, // TODO: We care about the key-value pairs here in RPL_BOUNCE + RPL_WELCOME = 1, + RPL_YOURHOST = 2, + RPL_CREATED = 3, + RPL_MYINFO = 4, + RPL_BOUNCE = 5, // TODO: We care about the key-value pairs here in RPL_BOUNCE ERR_NOCHANMODES = 477, From 75f3f7b867f17ffa0f86f43c1fccbe49cb330d6a Mon Sep 17 00:00:00 2001 From: "Tristan B. Velloza Kildaire" Date: Thu, 16 Mar 2023 18:38:06 +0200 Subject: [PATCH 08/19] Messages - Slightly improved trailer detection - Added some TODOs and notes Client - Log the key-value parameters and trailer --- source/birchwood/client/client.d | 3 +++ source/birchwood/protocol/messages.d | 15 ++++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) diff --git a/source/birchwood/client/client.d b/source/birchwood/client/client.d index ffc17b8..09a9463 100644 --- a/source/birchwood/client/client.d +++ b/source/birchwood/client/client.d @@ -140,6 +140,9 @@ public class Client : Thread if(commandReply.getReplyType() == ReplyType.RPL_BOUNCE) { logger.log("Take a look:\n\n"~commandReply.getParams()); + + logger.log("And here is key-value pairs: ", commandReply.getKVPairs()); + logger.log("And here is everything: ", commandReply.getTrailing()); } } diff --git a/source/birchwood/protocol/messages.d b/source/birchwood/protocol/messages.d index a85275b..b71b39d 100644 --- a/source/birchwood/protocol/messages.d +++ b/source/birchwood/protocol/messages.d @@ -293,6 +293,12 @@ public final class Message private string ppTrailing; private string[string] ppKVPairs; + /** + * NOTE: This needs more work with trailing support + * we must make sure we only look for lastInex of `:` + * where it is first cyaracter after space but NOT within + * an active parameter + */ private void parameterParse() { /* Only parse if there are params */ @@ -308,7 +314,10 @@ public final class Message string trailing; /* Find the first (and should be only) : (if any) */ - long trailingIdx = indexOf(params, ":"); + // TODO: Maybe i misunderstoof it as it appears in + // some key-value pairs as the value + // ... therefore let's just look for the last one + long trailingIdx = lastIndexOf(params, ":"); /* If there is trailing */ if(trailingIdx > -1) @@ -318,6 +327,8 @@ public final class Message /* Save the trailing text */ trailing = params[trailingIdx+1..params.length]; + + logger.debug_("Look at this trailing '"~trailing~"'"); } /* If there is no trailing */ else @@ -326,6 +337,8 @@ public final class Message kvPairs = params; } + // TODO: strip whitespace on either side of `kvPairs` + /* Generate the key-value pairs */ string[] pairs = split(kvPairs, " "); logger.debug_("Pairs: ", pairs); From fc9301f632601099ecf70438343ffe160db5f7e2 Mon Sep 17 00:00:00 2001 From: "Tristan B. Velloza Kildaire" Date: Fri, 17 Mar 2023 08:35:23 +0200 Subject: [PATCH 09/19] Message - Implemented `splitting(string)` which returns a `string[]` of split parameters according to the rfc1459's ENBF --- source/birchwood/protocol/messages.d | 69 ++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/source/birchwood/protocol/messages.d b/source/birchwood/protocol/messages.d index b71b39d..4099fb6 100644 --- a/source/birchwood/protocol/messages.d +++ b/source/birchwood/protocol/messages.d @@ -293,6 +293,73 @@ public final class Message private string ppTrailing; private string[string] ppKVPairs; + + unittest + { + import std.stdio; + + string testInput = "A:=1 A=2 :Hello this is text"; + writeln("Input: ", testInput); + + string[] splitted = splitting(testInput); + writeln("Input (split): ", splitted); + } + + /** + * Imagine: `A:=1 A=2 :Hello` + * + * Params: + * input = + * Returns: + */ + private static string[] splitting(string input) + { + string[] splits; + + bool trailingMode; + string buildUp; + for(ulong idx = 0; idx < input.length; idx++) + { + /* Get current character */ + char curCHar = input[idx]; + + + if(trailingMode) + { + buildUp ~= curCHar; + continue; + } + + if(buildUp.length == 0) + { + if(curCHar == ':') + { + trailingMode = true; + continue; + } + } + + + if(curCHar == ' ') + { + /* Flush */ + splits ~= buildUp; + buildUp = ""; + } + else + { + buildUp ~= curCHar; + } + } + + if(buildUp.length) + { + splits ~= buildUp; + } + + return splits; + } + /** * NOTE: This needs more work with trailing support * we must make sure we only look for lastInex of `:` @@ -307,6 +374,8 @@ public final class Message logger.debug_("Message: ", this); logger.debug_("ParamsSTring in: ", params); + logger.debug_("Custom splitter: ", splitting(params)); + /* Key-value pairs */ string kvPairs; From 1af73cb9d39b3cdb2fe9e3fb8a09e5acb79eff42 Mon Sep 17 00:00:00 2001 From: "Tristan B. Velloza Kildaire" Date: Fri, 17 Mar 2023 08:36:09 +0200 Subject: [PATCH 10/19] Messages - Added unit test for `splitting(string)` --- source/birchwood/protocol/messages.d | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/source/birchwood/protocol/messages.d b/source/birchwood/protocol/messages.d index 4099fb6..ab92469 100644 --- a/source/birchwood/protocol/messages.d +++ b/source/birchwood/protocol/messages.d @@ -303,6 +303,11 @@ public final class Message string[] splitted = splitting(testInput); writeln("Input (split): ", splitted); + + + assert(cmp(splitted[0], "A:=1") == 0); + assert(cmp(splitted[1], "A=12") == 0); + assert(cmp(splitted[2], "Hello this is text") == 0); } /** From 988b1686d7c5cbdfd69e5171bf64e2930376229f Mon Sep 17 00:00:00 2001 From: "Tristan B. Velloza Kildaire" Date: Fri, 17 Mar 2023 08:37:13 +0200 Subject: [PATCH 11/19] Messages - FIxed assertion in unit test --- source/birchwood/protocol/messages.d | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/source/birchwood/protocol/messages.d b/source/birchwood/protocol/messages.d index ab92469..1a73735 100644 --- a/source/birchwood/protocol/messages.d +++ b/source/birchwood/protocol/messages.d @@ -306,7 +306,7 @@ public final class Message assert(cmp(splitted[0], "A:=1") == 0); - assert(cmp(splitted[1], "A=12") == 0); + assert(cmp(splitted[1], "A=2") == 0); assert(cmp(splitted[2], "Hello this is text") == 0); } From d705ad1e66fed48cb72fc0f26bcf45c0da1195a8 Mon Sep 17 00:00:00 2001 From: "Tristan B. Velloza Kildaire" Date: Fri, 17 Mar 2023 09:09:40 +0200 Subject: [PATCH 12/19] Messages - Added `ppPairs` and `getPairs()` which returns a `string[]` of all parameters (excluding trailing) - Implemented usage of new `splitter(string, ref bool)` - The `splitter()` function now sets a flag if there is a trailer Unit tests - Updated unit test to use new `splitter(string ref bool)` --- source/birchwood/protocol/messages.d | 65 ++++++++++++++-------------- 1 file changed, 33 insertions(+), 32 deletions(-) diff --git a/source/birchwood/protocol/messages.d b/source/birchwood/protocol/messages.d index 1a73735..cbc411d 100644 --- a/source/birchwood/protocol/messages.d +++ b/source/birchwood/protocol/messages.d @@ -290,8 +290,14 @@ public final class Message return ppKVPairs; } + public string[] getPairs() + { + return ppPairs; + } + private string ppTrailing; private string[string] ppKVPairs; + private string[] ppPairs; unittest @@ -301,12 +307,17 @@ public final class Message string testInput = "A:=1 A=2 :Hello this is text"; writeln("Input: ", testInput); - string[] splitted = splitting(testInput); + bool hasTrailer; + string[] splitted = splitting(testInput, hasTrailer); writeln("Input (split): ", splitted); + assert(cmp(splitted[0], "A:=1") == 0); assert(cmp(splitted[1], "A=2") == 0); + + /* Trailer test */ + assert(hasTrailer); assert(cmp(splitted[2], "Hello this is text") == 0); } @@ -317,7 +328,7 @@ public final class Message * input = * Returns: */ - private static string[] splitting(string input) + private static string[] splitting(string input, ref bool hasTrailer) { string[] splits; @@ -362,6 +373,8 @@ public final class Message splits ~= buildUp; } + hasTrailer = trailingMode; + return splits; } @@ -376,47 +389,33 @@ public final class Message /* Only parse if there are params */ if(params.length) { - logger.debug_("Message: ", this); - logger.debug_("ParamsSTring in: ", params); - - logger.debug_("Custom splitter: ", splitting(params)); - - /* Key-value pairs */ - string kvPairs; - /* Trailing text */ string trailing; - /* Find the first (and should be only) : (if any) */ - // TODO: Maybe i misunderstoof it as it appears in - // some key-value pairs as the value - // ... therefore let's just look for the last one - long trailingIdx = lastIndexOf(params, ":"); + /* Split the `` */ + bool hasTrailer; + string[] paramsSplit = splitting(params, hasTrailer); - /* If there is trailing */ - if(trailingIdx > -1) + logger.debug_("ParamsSPlit direct:", paramsSplit); + + + + /* Extract the trailer as the last item in the array (if it exists) */ + if(hasTrailer) { - /* Then read till (and not including the `:` indicator) */ - kvPairs = params[0..trailingIdx]; + trailing = paramsSplit[paramsSplit.length-1]; - /* Save the trailing text */ - trailing = params[trailingIdx+1..params.length]; + /* Remove it from the parameters */ + paramsSplit = paramsSplit[0..$-1]; - logger.debug_("Look at this trailing '"~trailing~"'"); - } - /* If there is no trailing */ - else - { - /* Read the entire parameter string */ - kvPairs = params; + logger.debug_("GOt railer ", trailing); } - // TODO: strip whitespace on either side of `kvPairs` + ppPairs = paramsSplit; + /* Generate the key-value pairs */ - string[] pairs = split(kvPairs, " "); - logger.debug_("Pairs: ", pairs); - foreach(string pair; pairs) + foreach(string pair; paramsSplit) { /* Only do this if we have an `=` in the current pair */ if(indexOf(pair, "=") > -1) @@ -429,6 +428,8 @@ public final class Message /* Save the trailing */ ppTrailing = trailing; + + logger.debug_("ppTrailing: ", ppTrailing); } } From 0c4382d7cef94a6c5ff618698d0c83b2bca9d502 Mon Sep 17 00:00:00 2001 From: "Tristan B. Velloza Kildaire" Date: Fri, 17 Mar 2023 09:10:04 +0200 Subject: [PATCH 13/19] Client - Test new parameter parsing - Noted DLog logging bug where output cannot be seen --- source/birchwood/client/client.d | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/source/birchwood/client/client.d b/source/birchwood/client/client.d index 09a9463..1e2c7da 100644 --- a/source/birchwood/client/client.d +++ b/source/birchwood/client/client.d @@ -139,10 +139,25 @@ public class Client : Thread if(commandReply.getReplyType() == ReplyType.RPL_BOUNCE) { + logger.log(); + logger.log("<<<>>>"); + logger.log("Take a look:\n\n"~commandReply.getParams()); logger.log("And here is key-value pairs: ", commandReply.getKVPairs()); - logger.log("And here is everything: ", commandReply.getTrailing()); + logger.log("And here is array: ", commandReply.getPairs()); + + // TODO: DLog bug, this prints nothing + logger.log("And here is trailing: ", commandReply.getTrailing().length); + + import std.stdio; + writeln("Trailer: "~commandReply.getTrailing()); + + logger.log("<<<>>>"); + logger.log(); + + + } } From 3c6ee2bbbb5294fca858d3e4a74460342cb24021 Mon Sep 17 00:00:00 2001 From: "Tristan B. Velloza Kildaire" Date: Fri, 17 Mar 2023 09:11:22 +0200 Subject: [PATCH 14/19] Unit tests - Added another unit test --- source/birchwood/protocol/messages.d | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/source/birchwood/protocol/messages.d b/source/birchwood/protocol/messages.d index cbc411d..c088e70 100644 --- a/source/birchwood/protocol/messages.d +++ b/source/birchwood/protocol/messages.d @@ -321,6 +321,19 @@ public final class Message assert(cmp(splitted[2], "Hello this is text") == 0); } + unittest + { + import std.stdio; + + string testInput = ":Hello this is text"; + bool hasTrailer; + string[] splitted = splitting(testInput, hasTrailer); + + /* Trailer test */ + assert(hasTrailer); + assert(cmp(splitted[0], "Hello this is text") == 0); + } + /** * Imagine: `A:=1 A=2 :Hello` * From 0e9c042d213b9d6d5e346b6d47f66f2e02d6dac2 Mon Sep 17 00:00:00 2001 From: "Tristan B. Velloza Kildaire" Date: Fri, 17 Mar 2023 09:18:17 +0200 Subject: [PATCH 15/19] Unit tests - Cleaned up --- source/birchwood/protocol/messages.d | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/source/birchwood/protocol/messages.d b/source/birchwood/protocol/messages.d index c088e70..0f405de 100644 --- a/source/birchwood/protocol/messages.d +++ b/source/birchwood/protocol/messages.d @@ -300,10 +300,13 @@ public final class Message private string[] ppPairs; - unittest + version(unittest) { import std.stdio; + } + unittest + { string testInput = "A:=1 A=2 :Hello this is text"; writeln("Input: ", testInput); @@ -323,8 +326,6 @@ public final class Message unittest { - import std.stdio; - string testInput = ":Hello this is text"; bool hasTrailer; string[] splitted = splitting(testInput, hasTrailer); From d982205b1b4c4c2d791ca29936249cbcd5c1d919 Mon Sep 17 00:00:00 2001 From: "Tristan B. Velloza Kildaire" Date: Fri, 17 Mar 2023 09:20:54 +0200 Subject: [PATCH 16/19] Messages - Documented `getKVPairs()`, `getTrailing()` and `getPairs()` --- source/birchwood/protocol/messages.d | 20 +++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/source/birchwood/protocol/messages.d b/source/birchwood/protocol/messages.d index 0f405de..1e29dc1 100644 --- a/source/birchwood/protocol/messages.d +++ b/source/birchwood/protocol/messages.d @@ -279,17 +279,35 @@ public final class Message return params; } - + /** + * Retrieves the trailing text in the paramaters + * (if any) + * + * Returns: the trailing text + */ public string getTrailing() { return ppTrailing; } + /** + * Returns the parameters excluding the trailing text + * which are seperated by spaces but only those + * which are key-value pairs + * + * Returns: the key-value pair parameters + */ public string[string] getKVPairs() { return ppKVPairs; } + /** + * Returns the parameters excluding the trailing text + * which are seperated by spaces + * + * Returns: the parameters + */ public string[] getPairs() { return ppPairs; From ac6d9dbc14245e62005cda1711104c62ae009fe3 Mon Sep 17 00:00:00 2001 From: "Tristan B. Velloza Kildaire" Date: Fri, 17 Mar 2023 09:24:24 +0200 Subject: [PATCH 17/19] ConnInfo - Added method documentation --- source/birchwood/config/conninfo.d | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/source/birchwood/config/conninfo.d b/source/birchwood/config/conninfo.d index ce2b9be..df69d94 100644 --- a/source/birchwood/config/conninfo.d +++ b/source/birchwood/config/conninfo.d @@ -36,16 +36,32 @@ public struct ConnectionInfo return this.bulkReadSize; } + /** + * Get the address of the endpoint server + * + * Returns: the server's address + */ public Address getAddr() { return addrInfo; } + /** + * Get the chosen fake lag + * + * Returns: the fake lag in seconds + */ public ulong getFakeLag() { return fakeLag; } + /** + * Sets the fake lag in seconds + * + * Params: + * fakeLag = the fake lag to use + */ public void setFakeLag(ulong fakeLag) { this.fakeLag = fakeLag; From 91235f7484baf338587fdd1489da728eaa5684e3 Mon Sep 17 00:00:00 2001 From: "Tristan B. Velloza Kildaire" Date: Fri, 17 Mar 2023 09:25:26 +0200 Subject: [PATCH 18/19] ConnInfo - Documented module ConnectionInfo - Documented struct --- source/birchwood/config/conninfo.d | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/source/birchwood/config/conninfo.d b/source/birchwood/config/conninfo.d index df69d94..2eebd76 100644 --- a/source/birchwood/config/conninfo.d +++ b/source/birchwood/config/conninfo.d @@ -1,8 +1,15 @@ +/** + * COnfiguration-related types + */ module birchwood.config.conninfo; import std.socket : SocketException, Address, getAddress; import birchwood.client.exceptions : BirchwoodException; +/** + * Represents the connection details for a server + * to connect to + */ public struct ConnectionInfo { /* Server address information */ From c6953057e8dd076708b842161e3c372020b655c2 Mon Sep 17 00:00:00 2001 From: "Tristan B. Velloza Kildaire" Date: Fri, 17 Mar 2023 09:29:04 +0200 Subject: [PATCH 19/19] Client - Disable testing code for now --- source/birchwood/client/client.d | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/source/birchwood/client/client.d b/source/birchwood/client/client.d index 1e2c7da..5c79113 100644 --- a/source/birchwood/client/client.d +++ b/source/birchwood/client/client.d @@ -139,22 +139,25 @@ public class Client : Thread if(commandReply.getReplyType() == ReplyType.RPL_BOUNCE) { - logger.log(); - logger.log("<<<>>>"); + // TODO: Testing code was here + // logger.log(); + // logger.log("<<<>>>"); - logger.log("Take a look:\n\n"~commandReply.getParams()); + // logger.log("Take a look:\n\n"~commandReply.getParams()); - logger.log("And here is key-value pairs: ", commandReply.getKVPairs()); - logger.log("And here is array: ", commandReply.getPairs()); + // logger.log("And here is key-value pairs: ", commandReply.getKVPairs()); + // logger.log("And here is array: ", commandReply.getPairs()); - // TODO: DLog bug, this prints nothing - logger.log("And here is trailing: ", commandReply.getTrailing().length); + // // TODO: DLog bug, this prints nothing + // logger.log("And here is trailing: ", commandReply.getTrailing()); - import std.stdio; - writeln("Trailer: "~commandReply.getTrailing()); + // import std.stdio; + // writeln("Trailer: "~commandReply.getTrailing()); - logger.log("<<<>>>"); - logger.log(); + // writeln(cast(ubyte[])commandReply.getTrailing()); + + // logger.log("<<<>>>"); + // logger.log();