using IRCTokens; namespace IRCRobots; public class Server : IServer { public string Name { get; set; } public IBot Bot { get; set; } public bool Disconnected { get; set; } public ConnectionParams Params { get; set; } public List DesiredCaps { get; set; } public float LastRead { get; set; } private int _sentCount = 0; public Task SendRawAsync(string line, SendPriority priority = SendPriority.Medium) => SendAsync(new(line), priority); public Task SendAsync(Line line, SendPriority priority = SendPriority.Medium) { LinePresend(line); var sentLine = new SentLine(_sentCount++, priority, line); var label = CapAvailable(CAP_LABEL); if (label is not null) { } } public Task WaitForAsync() { throw new NotImplementedException(); } public void SetThrottle(int rate, float time) { throw new NotImplementedException(); } public (string, int) ServerAddress() { throw new NotImplementedException(); } public Task ConnectAsync(ITcpTransport transport, ConnectionParams connectionParams) { throw new NotImplementedException(); } public Task DisconnectAsync() { throw new NotImplementedException(); } public void LinePreread(Line line) { throw new NotImplementedException(); } public void LinePresend(Line line) { throw new NotImplementedException(); } public Task LineReadAsync(Line line) { throw new NotImplementedException(); } public Task LineSendAsync(Line line) { throw new NotImplementedException(); } public Task StsPolicyAsync(STSPolicy sts) { throw new NotImplementedException(); } public Task ResumePolicyAsync(ResumePolicy resume) { throw new NotImplementedException(); } public bool CapAgreed(ICapability capability) { throw new NotImplementedException(); } public string CapAvailable(ICapability capability) { throw new NotImplementedException(); } public Task SaslAuthAsync(SaslParams sasl) { throw new NotImplementedException(); } } public enum SendPriority { High = 0, Medium = 10, Low = 20, Default = Medium } public interface IServer { Task SendRawAsync(string line, SendPriority priority = SendPriority.Default); Task SendAsync(Line line, SendPriority priority = SendPriority.Default); Task WaitForAsync(); void SetThrottle(int rate, float time); (string, int) ServerAddress(); Task ConnectAsync(ITcpTransport transport, ConnectionParams connectionParams); Task DisconnectAsync(); void LinePreread(Line line); void LinePresend(Line line); Task LineReadAsync(Line line); Task LineSendAsync(Line line); Task StsPolicyAsync(STSPolicy sts); Task ResumePolicyAsync(ResumePolicy resume); bool CapAgreed(ICapability capability); string CapAvailable(ICapability capability); Task SaslAuthAsync(SaslParams sasl); } public interface ITcpTransport { (ITcpReader, ITcpWriter) Connect(string hostname, int port, Tls tls, string bindhost); } public interface ICapability { string Available(IEnumerable capabilities); bool Match(string capability); ICapability Copy(); } public record struct SentLine(int Id, SendPriority Priority, Line Line);