private async Task CtcpRequestsHandler(object sender, CtcpEventArgs e) { if (CtcpDelegates.ContainsKey(e.CtcpCommand)) { await CtcpDelegates[e.CtcpCommand].Invoke(e); } else { /* No CTCP Handler for this Command */ } RemoveInvalidDccConnections(); }
public IrcFeatures() { // This method calls all the ctcp handlers defined below (or added anywhere else) OnCtcpRequest += CtcpRequestsHandler; // Adding ctcp handler, all commands are lower case (.ToLower() in handler) CtcpDelegates.Add("version", CtcpVersionDelegate); CtcpDelegates.Add("clientinfo", CtcpClientInfoDelegate); CtcpDelegates.Add("time", CtcpTimeDelegate); CtcpDelegates.Add("userinfo", CtcpUserInfoDelegate); CtcpDelegates.Add("url", CtcpUrlDelegate); CtcpDelegates.Add("source", CtcpSourceDelegate); CtcpDelegates.Add("finger", CtcpFingerDelegate); // The DCC Handler CtcpDelegates.Add("dcc", CtcpDccDelegate); // Don't remove the Ping handler without your own implementation CtcpDelegates.Add("ping", CtcpPingDelegate); }