string IPlugin.InvokeWithChannelUserChange(string channel, string user, string kicker, string message, ChannelUserChange type, ref IrcClient client) { return(null); // Not implemented }
static void InvokePluginWithChannelUserChange(string channel, string user, string kicker, string message, ChannelUserChange type) { // This doesn't matter anyways if it succeeds or not try { foreach (Type p in plugins) { Thread t = new Thread(() => { // Why not spawn instances when we loaded them? Sometimes state likes to stick or something. string to_send = ((IPlugin)Activator.CreateInstance(p)).InvokeWithChannelUserChange(channel, user, kicker, message, type, ref i); if (!String.IsNullOrWhiteSpace(message)) { i.SendMessage(SendType.Message, channel, to_send); } }); t.IsBackground = true; t.Name = p.Name; t.Start(); if (!t.Join(5000)) { t.Abort(); Debug.WriteLine(String.Format("The plugin ({0}) took too long to respond for InvokePluginWithChannelUserChange.", p.Name), "PluginLoader"); } } } catch (Exception ex) { Debug.WriteLine(ex.ToString()); } }