mirror of
https://github.com/deavmi/birchwood
synced 2024-09-20 13:02:54 +02:00
ConnInfo
- 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:
parent
b3f102276a
commit
357deeb5e4
@ -40,6 +40,12 @@ public shared struct ConnectionInfo
|
||||
*/
|
||||
public const string quitMessage;
|
||||
|
||||
/**
|
||||
* Key-value pairs learnt from the
|
||||
* server
|
||||
*/
|
||||
private string[string] db;
|
||||
|
||||
/* TODO: before publishing change this bulk size */
|
||||
|
||||
/**
|
||||
@ -116,6 +122,26 @@ public shared struct ConnectionInfo
|
||||
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
|
||||
* can be provided to the Client class to create a new connection based on its
|
||||
|
Loading…
Reference in New Issue
Block a user