1
0
mirror of https://github.com/deavmi/birchwood synced 2024-09-20 13:43:19 +02:00
- Added a `string[string]` key-value pair named `db` to hold the parameters learnt from `RPL_ISUPPORT`s
- Added `updateDB(string, string)` to add an entry to the `db`
- Added `getDB(string)` to fetch a value from the `db` (if it doesn't exist then an empty string `""` is returned)
This commit is contained in:
Tristan B. Velloza Kildaire 2023-03-25 13:01:02 +02:00
parent b3f102276a
commit 357deeb5e4

View File

@ -40,6 +40,12 @@ public shared struct ConnectionInfo
*/ */
public const string quitMessage; public const string quitMessage;
/**
* Key-value pairs learnt from the
* server
*/
private string[string] db;
/* TODO: before publishing change this bulk size */ /* TODO: before publishing change this bulk size */
/** /**
@ -116,6 +122,26 @@ public shared struct ConnectionInfo
this.fakeLag = fakeLag; this.fakeLag = fakeLag;
} }
public void updateDB(string key, string value)
{
db[key] = value;
}
public string getDB(string key)
{
// TODO: Do existence check
if(key in db)
{
return db[key];
}
else
{
// TODO: Should throw an exception
return "";
}
}
/** /**
* Creates a ConnectionInfo struct representing a client configuration which * Creates a ConnectionInfo struct representing a client configuration which
* can be provided to the Client class to create a new connection based on its * can be provided to the Client class to create a new connection based on its