/// <summary> /// Initialises a new instance of the <see cref="IRCMarshal"/> class. /// </summary> /// <param name="connection">The connection to marshal data to and from.</param> /// <param name="tabHost">The TabControl that hosts the server and channel tabs.</param> /// <param name="autoCommands">A queue of commands to automatically execute once a connection is fully established.</param> /// <param name="parent">The owning form.</param> public IRCMarshal(Connection connection, TabControl tabHost, List<string> autoCommands, MainForm parent) { this.tabHost = tabHost; this.parent = parent; this.previousNickName = connection.Nickname; this.AwaitingModeMessage = true; this.AwaitingUserHostMessage = true; this.connection = connection; this.SetupConnectionEventHandlers(); this.channels = new List<IRCChannel>(); this.messageQueue = new Queue<Message>(15); this.channelBrowser = new ChannelBrowser(this); if (autoCommands != null) { this.autoCommands = autoCommands; } else { this.autoCommands = new List<string>(); } this.queueResetEvent = new AutoResetEvent(false); this.queueProcessingThread = new Thread(this.ProcessQueue); this.queueProcessingThread.Start(); }