1
0
mirror of https://github.com/deavmi/birchwood synced 2024-09-20 16:43:21 +02:00
- Slightly improved trailer detection
- Added some TODOs and notes

Client

- Log the key-value parameters and trailer
This commit is contained in:
Tristan B. Velloza Kildaire 2023-03-16 18:38:06 +02:00
parent f930618162
commit 75f3f7b867
2 changed files with 17 additions and 1 deletions

View File

@ -140,6 +140,9 @@ public class Client : Thread
if(commandReply.getReplyType() == ReplyType.RPL_BOUNCE) if(commandReply.getReplyType() == ReplyType.RPL_BOUNCE)
{ {
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 everything: ", commandReply.getTrailing());
} }
} }

View File

@ -293,6 +293,12 @@ public final class Message
private string ppTrailing; private string ppTrailing;
private string[string] ppKVPairs; 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() private void parameterParse()
{ {
/* Only parse if there are params */ /* Only parse if there are params */
@ -308,7 +314,10 @@ public final class Message
string trailing; string trailing;
/* Find the first (and should be only) : (if any) */ /* 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 there is trailing */
if(trailingIdx > -1) if(trailingIdx > -1)
@ -318,6 +327,8 @@ public final class Message
/* Save the trailing text */ /* Save the trailing text */
trailing = params[trailingIdx+1..params.length]; trailing = params[trailingIdx+1..params.length];
logger.debug_("Look at this trailing '"~trailing~"'");
} }
/* If there is no trailing */ /* If there is no trailing */
else else
@ -326,6 +337,8 @@ public final class Message
kvPairs = params; kvPairs = params;
} }
// TODO: strip whitespace on either side of `kvPairs`
/* Generate the key-value pairs */ /* Generate the key-value pairs */
string[] pairs = split(kvPairs, " "); string[] pairs = split(kvPairs, " ");
logger.debug_("Pairs: ", pairs); logger.debug_("Pairs: ", pairs);