ChannelManager

- Added some testing channels

Server

- We now construct a `ChannelManager` on construction
- `getChannelNames(ulong, ubyte)` now uses the `ChannelManager` to enumerate the channels
This commit is contained in:
Tristan B. Velloza Kildaire 2023-11-16 14:54:08 +02:00
parent 938ca897bd
commit e9fddfc55c
2 changed files with 18 additions and 3 deletions

View File

@ -110,6 +110,11 @@ public final class ChannelManager
private this()
{
this.channelsLock = new Mutex();
// TODO: Disable later, this just adds some testing channels
// return ["#general", "#tomfoolery"];
channelCreate("#general");
channelCreate("#tomfoolery");
}
public static ChannelManager create(Server server)

View File

@ -7,6 +7,7 @@ import std.algorithm : canFind;
import renaissance.exceptions;
import renaissance.connection;
import renaissance.logging;
import renaissance.server.channelmanager;
/**
* Represents an instance of the daemon which manages
@ -26,12 +27,22 @@ public class Server
// TODO: volatility
private bool isRunning = false;
// TODO: Add constructor
private ChannelManager channelManager;
// TODO: Some sendq/recq mechanism with messages or something
// ... should be placed here
/**
* Constructs a new server
*/
this()
{
/* Initialize all mutexes */
this.listenerQLock = new Mutex();
this.connectionQLock = new Mutex();
/* Initialize the channel management sub-system */
this.channelManager = ChannelManager.create(this);
}
@ -187,8 +198,7 @@ public class Server
public string[] getChannelNames(ulong offset, ubyte limit)
{
// TODO: Implement me
return ["#general", "#tomfoolery"];
return this.channelManager.getChannelNames(offset, limit);
}
}