private void setTextForRich(Khendys.Controls.ExRichTextBox obj, string question) { // obj.Visible = true; //if (question == null || question == "{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fcharset0 Microsoft Sans Serif;}}\n\\viewkind4\\uc1\\pard\\f0\\fs17\\par\n}\n") //{ // obj.Visible = false; //else if (question != null && Utility.Base64Decode(question).Contains("\\rtf1\\ansi")) { obj.Rtf = Utility.Base64Decode(question); } else if (question != null && question.Length > 0) { obj.Rtf = @"{\rtf1\ansi\ansicpg1252\deff0\deflang16393{\fonttbl{\f0\fnil\fcharset0 Microsoft Sans Serif;}}\viewkind4\uc1\pard\f0\fs20" + question + @"}"; } // if (obj.TextLength == 0) // obj.Visible = false; }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.components = new System.ComponentModel.Container(); System.Resources.ResourceManager resources = new System.Resources.ResourceManager(typeof(chatControl)); this.txtBoxViewChat = new WebMeeting.Client.PrintableRichTextBox(); this.txtBoxPreviewChat = new Khendys.Controls.ExRichTextBox(); this.btnBold = new System.Windows.Forms.Button(); this.imageList1 = new System.Windows.Forms.ImageList(this.components); this.btnItalics = new System.Windows.Forms.Button(); this.btnUnderLine = new System.Windows.Forms.Button(); this.panel1 = new System.Windows.Forms.Panel(); this.splitter1 = new System.Windows.Forms.Splitter(); this.panel2 = new System.Windows.Forms.Panel(); this.btnFont = new NSPAControls.NSButton(); this.btnEmoticon = new NSPAControls.NSButton(); this.panel4 = new System.Windows.Forms.Panel(); this.panel3 = new System.Windows.Forms.Panel(); this.testCombo = new System.Windows.Forms.ComboBox(); this.btnSend = new NSPAControls.NSButton(); this.timer1 = new System.Windows.Forms.Timer(this.components); this.panel1.SuspendLayout(); this.panel2.SuspendLayout(); this.panel4.SuspendLayout(); this.panel3.SuspendLayout(); this.SuspendLayout(); // // txtBoxViewChat // this.txtBoxViewChat.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.txtBoxViewChat.Font = new System.Drawing.Font("Courier New", 9.75F); this.txtBoxViewChat.HideSelection = false; this.txtBoxViewChat.HiglightColor = Khendys.Controls.RtfColor.White; this.txtBoxViewChat.Location = new System.Drawing.Point(0, 0); this.txtBoxViewChat.Name = "txtBoxViewChat"; this.txtBoxViewChat.ReadOnly = true; this.txtBoxViewChat.Size = new System.Drawing.Size(256, 184); this.txtBoxViewChat.TabIndex = 3; this.txtBoxViewChat.Text = ""; this.txtBoxViewChat.TextColor = Khendys.Controls.RtfColor.Black; this.txtBoxViewChat.TextChanged += new System.EventHandler(this.txtBoxViewChat_TextChanged); this.txtBoxViewChat.KeyUp += new System.Windows.Forms.KeyEventHandler(this.txtBoxViewChat_KeyUp); // // txtBoxPreviewChat // this.txtBoxPreviewChat.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.txtBoxPreviewChat.Font = new System.Drawing.Font("Courier New", 9.75F); this.txtBoxPreviewChat.HiglightColor = Khendys.Controls.RtfColor.White; this.txtBoxPreviewChat.Location = new System.Drawing.Point(0, 35); this.txtBoxPreviewChat.Name = "txtBoxPreviewChat"; this.txtBoxPreviewChat.Size = new System.Drawing.Size(256, 45); this.txtBoxPreviewChat.TabIndex = 4; this.txtBoxPreviewChat.Text = ""; this.txtBoxPreviewChat.TextColor = Khendys.Controls.RtfColor.Black; this.txtBoxPreviewChat.KeyDown += new System.Windows.Forms.KeyEventHandler(this.txtBoxPreviewChat_KeyDown); this.txtBoxPreviewChat.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtBoxPreviewChat_KeyPress); this.txtBoxPreviewChat.TextChanged += new System.EventHandler(this.txtBoxPreviewChat_TextChanged); // // btnBold // this.btnBold.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("btnBold.BackgroundImage"))); this.btnBold.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.btnBold.ImageList = this.imageList1; this.btnBold.Location = new System.Drawing.Point(0, -1); this.btnBold.Name = "btnBold"; this.btnBold.Size = new System.Drawing.Size(22, 23); this.btnBold.TabIndex = 0; this.btnBold.Click += new System.EventHandler(this.btnBold_Click); // // imageList1 // this.imageList1.ImageSize = new System.Drawing.Size(23, 23); this.imageList1.ImageStream = ((System.Windows.Forms.ImageListStreamer)(resources.GetObject("imageList1.ImageStream"))); this.imageList1.TransparentColor = System.Drawing.Color.Transparent; // // btnItalics // this.btnItalics.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("btnItalics.BackgroundImage"))); this.btnItalics.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Italic))), System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.btnItalics.ImageList = this.imageList1; this.btnItalics.Location = new System.Drawing.Point(32, -1); this.btnItalics.Name = "btnItalics"; this.btnItalics.Size = new System.Drawing.Size(22, 23); this.btnItalics.TabIndex = 1; this.btnItalics.Click += new System.EventHandler(this.btnItalics_Click); // // btnUnderLine // this.btnUnderLine.BackgroundImage = ((System.Drawing.Image)(resources.GetObject("btnUnderLine.BackgroundImage"))); this.btnUnderLine.Font = new System.Drawing.Font("Microsoft Sans Serif", 8.25F, ((System.Drawing.FontStyle)((System.Drawing.FontStyle.Bold | System.Drawing.FontStyle.Underline))), System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.btnUnderLine.ImageList = this.imageList1; this.btnUnderLine.Location = new System.Drawing.Point(64, -1); this.btnUnderLine.Name = "btnUnderLine"; this.btnUnderLine.Size = new System.Drawing.Size(22, 23); this.btnUnderLine.TabIndex = 2; this.btnUnderLine.Click += new System.EventHandler(this.btnUnderline_Click); // // panel1 // this.panel1.Controls.Add(this.splitter1); this.panel1.Controls.Add(this.panel2); this.panel1.Controls.Add(this.txtBoxViewChat); this.panel1.Dock = System.Windows.Forms.DockStyle.Fill; this.panel1.Location = new System.Drawing.Point(0, 0); this.panel1.Name = "panel1"; this.panel1.Size = new System.Drawing.Size(256, 296); this.panel1.TabIndex = 11; // // splitter1 // this.splitter1.Cursor = System.Windows.Forms.Cursors.HSplit; this.splitter1.Dock = System.Windows.Forms.DockStyle.Bottom; this.splitter1.Enabled = false; this.splitter1.Location = new System.Drawing.Point(0, 179); this.splitter1.Name = "splitter1"; this.splitter1.Size = new System.Drawing.Size(256, 5); this.splitter1.TabIndex = 12; this.splitter1.TabStop = false; // // panel2 // this.panel2.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(174)), ((System.Byte)(204)), ((System.Byte)(72))); this.panel2.Controls.Add(this.btnFont); this.panel2.Controls.Add(this.btnEmoticon); this.panel2.Controls.Add(this.panel4); this.panel2.Controls.Add(this.panel3); this.panel2.Controls.Add(this.txtBoxPreviewChat); this.panel2.Dock = System.Windows.Forms.DockStyle.Bottom; this.panel2.Location = new System.Drawing.Point(0, 184); this.panel2.Name = "panel2"; this.panel2.Size = new System.Drawing.Size(256, 112); this.panel2.TabIndex = 11; this.panel2.Resize += new System.EventHandler(this.panel2_Resize); // // btnFont // this.btnFont.ButtonForm = NSPAControls.eButtonForm.Rectangle; this.btnFont.HighlightColor = System.Drawing.SystemColors.HotTrack; this.btnFont.HottrackImage = ((System.Drawing.Image)(resources.GetObject("btnFont.HottrackImage"))); this.btnFont.Location = new System.Drawing.Point(8, 2); this.btnFont.Name = "btnFont"; this.btnFont.NormalImage = ((System.Drawing.Image)(resources.GetObject("btnFont.NormalImage"))); this.btnFont.OnlyShowBitmap = true; this.btnFont.PressedImage = ((System.Drawing.Image)(resources.GetObject("btnFont.PressedImage"))); this.btnFont.Size = new System.Drawing.Size(58, 28); this.btnFont.Text = "nsButton1"; this.btnFont.TextAlign = NSPAControls.eTextAlign.Bottom; this.btnFont.ToolTip = null; this.btnFont.Click += new System.EventHandler(this.btnFont_Click); // // btnEmoticon // this.btnEmoticon.ButtonForm = NSPAControls.eButtonForm.Rectangle; this.btnEmoticon.HighlightColor = System.Drawing.SystemColors.HotTrack; this.btnEmoticon.HottrackImage = ((System.Drawing.Image)(resources.GetObject("btnEmoticon.HottrackImage"))); this.btnEmoticon.Location = new System.Drawing.Point(8, 0); this.btnEmoticon.Name = "btnEmoticon"; this.btnEmoticon.NormalImage = ((System.Drawing.Image)(resources.GetObject("btnEmoticon.NormalImage"))); this.btnEmoticon.OnlyShowBitmap = true; this.btnEmoticon.PressedImage = ((System.Drawing.Image)(resources.GetObject("btnEmoticon.PressedImage"))); this.btnEmoticon.Size = new System.Drawing.Size(57, 29); this.btnEmoticon.Text = "nsButton1"; this.btnEmoticon.TextAlign = NSPAControls.eTextAlign.Bottom; this.btnEmoticon.ToolTip = null; this.btnEmoticon.Visible = false; this.btnEmoticon.Click += new System.EventHandler(this.btnEmoticon_Click); // // panel4 // this.panel4.Anchor = System.Windows.Forms.AnchorStyles.Right; this.panel4.Controls.Add(this.btnBold); this.panel4.Controls.Add(this.btnItalics); this.panel4.Controls.Add(this.btnUnderLine); this.panel4.Location = new System.Drawing.Point(152, 5); this.panel4.Name = "panel4"; this.panel4.Size = new System.Drawing.Size(96, 27); this.panel4.TabIndex = 12; // // panel3 // this.panel3.Controls.Add(this.testCombo); this.panel3.Controls.Add(this.btnSend); this.panel3.Dock = System.Windows.Forms.DockStyle.Bottom; this.panel3.Location = new System.Drawing.Point(0, 82); this.panel3.Name = "panel3"; this.panel3.Size = new System.Drawing.Size(256, 30); this.panel3.TabIndex = 11; this.panel3.Paint += new System.Windows.Forms.PaintEventHandler(this.panel3_Paint); // // testCombo // this.testCombo.Anchor = ((System.Windows.Forms.AnchorStyles)((((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Bottom) | System.Windows.Forms.AnchorStyles.Left) | System.Windows.Forms.AnchorStyles.Right))); this.testCombo.DropDownStyle = System.Windows.Forms.ComboBoxStyle.DropDownList; this.testCombo.Location = new System.Drawing.Point(0, 2); this.testCombo.Name = "testCombo"; this.testCombo.Size = new System.Drawing.Size(148, 21); this.testCombo.TabIndex = 1; this.testCombo.Visible = false; // // btnSend // this.btnSend.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Right))); this.btnSend.ButtonForm = NSPAControls.eButtonForm.Rectangle; this.btnSend.HighlightColor = System.Drawing.SystemColors.HotTrack; this.btnSend.HottrackImage = ((System.Drawing.Image)(resources.GetObject("btnSend.HottrackImage"))); this.btnSend.Location = new System.Drawing.Point(172, 2); this.btnSend.Name = "btnSend"; this.btnSend.NormalImage = ((System.Drawing.Image)(resources.GetObject("btnSend.NormalImage"))); this.btnSend.OnlyShowBitmap = true; this.btnSend.PressedImage = ((System.Drawing.Image)(resources.GetObject("btnSend.PressedImage"))); this.btnSend.Size = new System.Drawing.Size(59, 25); this.btnSend.Text = "Send"; this.btnSend.TextAlign = NSPAControls.eTextAlign.Bottom; this.btnSend.ToolTip = null; this.btnSend.Click += new System.EventHandler(this.btnSend_Click); this.btnSend.Enter += new System.EventHandler(this.btnSend_Enter); // // timer1 // this.timer1.Interval = 500; this.timer1.Tick += new System.EventHandler(this.timer1_Tick); // // chatControl // this.AutoScroll = true; this.BackColor = System.Drawing.Color.FromArgb(((System.Byte)(212)), ((System.Byte)(208)), ((System.Byte)(200))); this.Controls.Add(this.panel1); this.Font = new System.Drawing.Font("Tahoma", 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); this.Name = "chatControl"; this.Size = new System.Drawing.Size(256, 296); this.Load += new System.EventHandler(this.chatControl_Load); this.panel1.ResumeLayout(false); this.panel2.ResumeLayout(false); this.panel4.ResumeLayout(false); this.panel3.ResumeLayout(false); this.ResumeLayout(false); }
/// <summary> /// Required method for Designer support - do not modify /// the contents of this method with the code editor. /// </summary> private void InitializeComponent() { this.components = new System.ComponentModel.Container(); System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ChatForm)); this.tabControlChatTabs = new System.Windows.Forms.TabControl(); this.tabPageChatOutput = new System.Windows.Forms.TabPage(); this.exRichTextBoxChatOutput = new Khendys.Controls.ExRichTextBox(); this.panelUserList = new System.Windows.Forms.Panel(); this.listBoxUserList = new System.Windows.Forms.ListBox(); this.panelChatInput = new System.Windows.Forms.Panel(); this.textBoxChatInput = new PsyTextBox.PsyTextBox(); this.panelChatTabs = new System.Windows.Forms.Panel(); this.timerAutoScroll = new System.Timers.Timer(); this.menuItemConnect = new System.Windows.Forms.MenuItem(); this.menuItemDisconnect = new System.Windows.Forms.MenuItem(); this.menuItemSeperator = new System.Windows.Forms.MenuItem(); this.menuItemExit = new System.Windows.Forms.MenuItem(); this.menuItemFile = new System.Windows.Forms.MenuItem(); this.menuItemAutoConnect = new System.Windows.Forms.MenuItem(); this.menuItemAutoScroll = new System.Windows.Forms.MenuItem(); this.menuItemOptions = new System.Windows.Forms.MenuItem(); this.mainMenu = new System.Windows.Forms.MainMenu(this.components); this.tabControlChatTabs.SuspendLayout(); this.tabPageChatOutput.SuspendLayout(); this.panelUserList.SuspendLayout(); this.panelChatInput.SuspendLayout(); this.panelChatTabs.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.timerAutoScroll)).BeginInit(); this.SuspendLayout(); // // tabControlChatTabs // this.tabControlChatTabs.Appearance = System.Windows.Forms.TabAppearance.FlatButtons; this.tabControlChatTabs.Controls.Add(this.tabPageChatOutput); this.tabControlChatTabs.Dock = System.Windows.Forms.DockStyle.Fill; this.tabControlChatTabs.DrawMode = System.Windows.Forms.TabDrawMode.OwnerDrawFixed; this.tabControlChatTabs.Font = new System.Drawing.Font("Verdana", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.tabControlChatTabs.HotTrack = true; this.tabControlChatTabs.Location = new System.Drawing.Point(0, 0); this.tabControlChatTabs.Name = "tabControlChatTabs"; this.tabControlChatTabs.SelectedIndex = 0; this.tabControlChatTabs.Size = new System.Drawing.Size(611, 341); this.tabControlChatTabs.TabIndex = 4; this.tabControlChatTabs.DrawItem += new System.Windows.Forms.DrawItemEventHandler(this.tabControlChatTabs_DrawItem); this.tabControlChatTabs.SelectedIndexChanged += new System.EventHandler(this.tabControlChatTabs_SelectedIndexChanged); // // tabPageChatOutput // this.tabPageChatOutput.BackColor = System.Drawing.SystemColors.Control; this.tabPageChatOutput.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle; this.tabPageChatOutput.Controls.Add(this.exRichTextBoxChatOutput); this.tabPageChatOutput.Location = new System.Drawing.Point(4, 26); this.tabPageChatOutput.Name = "tabPageChatOutput"; this.tabPageChatOutput.Size = new System.Drawing.Size(603, 311); this.tabPageChatOutput.TabIndex = 0; this.tabPageChatOutput.Text = "tabPage1"; // // exRichTextBoxChatOutput // this.exRichTextBoxChatOutput.AutoSize = true; this.exRichTextBoxChatOutput.BorderStyle = System.Windows.Forms.BorderStyle.None; this.exRichTextBoxChatOutput.Cursor = System.Windows.Forms.Cursors.IBeam; this.exRichTextBoxChatOutput.Dock = System.Windows.Forms.DockStyle.Fill; this.exRichTextBoxChatOutput.Font = new System.Drawing.Font("Verdana", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.exRichTextBoxChatOutput.HiglightColor = Khendys.Controls.RtfColor.White; this.exRichTextBoxChatOutput.Location = new System.Drawing.Point(0, 0); this.exRichTextBoxChatOutput.Name = "exRichTextBoxChatOutput"; this.exRichTextBoxChatOutput.ReadOnly = true; this.exRichTextBoxChatOutput.ScrollBars = System.Windows.Forms.RichTextBoxScrollBars.Vertical; this.exRichTextBoxChatOutput.Size = new System.Drawing.Size(601, 309); this.exRichTextBoxChatOutput.TabIndex = 4; this.exRichTextBoxChatOutput.Text = ""; this.exRichTextBoxChatOutput.TextColor = Khendys.Controls.RtfColor.Black; this.exRichTextBoxChatOutput.LinkClicked += new LinkClickedEventHandler(this.exRichTextBoxChatOutput_LinkClicked); // // panelUserList // this.panelUserList.BorderStyle = System.Windows.Forms.BorderStyle.Fixed3D; this.panelUserList.Controls.Add(this.listBoxUserList); this.panelUserList.Dock = System.Windows.Forms.DockStyle.Right; this.panelUserList.Location = new System.Drawing.Point(611, 0); this.panelUserList.Name = "panelUserList"; this.panelUserList.Size = new System.Drawing.Size(173, 341); this.panelUserList.TabIndex = 3432; // // listBoxUserList // this.listBoxUserList.BorderStyle = System.Windows.Forms.BorderStyle.None; this.listBoxUserList.Dock = System.Windows.Forms.DockStyle.Fill; this.listBoxUserList.Font = new System.Drawing.Font("Verdana", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.listBoxUserList.ForeColor = System.Drawing.Color.Black; this.listBoxUserList.HorizontalScrollbar = true; this.listBoxUserList.IntegralHeight = false; this.listBoxUserList.ItemHeight = 14; this.listBoxUserList.Location = new System.Drawing.Point(0, 0); this.listBoxUserList.Name = "listBoxUserList"; this.listBoxUserList.ScrollAlwaysVisible = true; this.listBoxUserList.Size = new System.Drawing.Size(169, 337); this.listBoxUserList.Sorted = true; this.listBoxUserList.TabIndex = 34; this.listBoxUserList.TabStop = false; this.listBoxUserList.DoubleClick += new System.EventHandler(this.listBoxUsers_DoubleClick); // // panelChatInput // this.panelChatInput.Controls.Add(this.textBoxChatInput); this.panelChatInput.Dock = System.Windows.Forms.DockStyle.Bottom; this.panelChatInput.Location = new System.Drawing.Point(0, 341); this.panelChatInput.Name = "panelChatInput"; this.panelChatInput.Size = new System.Drawing.Size(784, 24); this.panelChatInput.TabIndex = 3555; // // textBoxChatInput // this.textBoxChatInput.Dock = System.Windows.Forms.DockStyle.Fill; this.textBoxChatInput.Font = new System.Drawing.Font("Verdana", 9F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(0))); this.textBoxChatInput.Location = new System.Drawing.Point(0, 0); this.textBoxChatInput.MaxLength = 255; this.textBoxChatInput.Name = "textBoxChatInput"; this.textBoxChatInput.Size = new System.Drawing.Size(784, 22); this.textBoxChatInput.TabIndex = 1; this.textBoxChatInput.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.textBoxChatInput_KeyPress); // // panelChatTabs // this.panelChatTabs.Controls.Add(this.tabControlChatTabs); this.panelChatTabs.Dock = System.Windows.Forms.DockStyle.Fill; this.panelChatTabs.Location = new System.Drawing.Point(0, 0); this.panelChatTabs.Name = "panelChatTabs"; this.panelChatTabs.Size = new System.Drawing.Size(611, 341); this.panelChatTabs.TabIndex = 4444; // // timerAutoScroll // this.timerAutoScroll.Enabled = true; this.timerAutoScroll.Interval = 1000D; this.timerAutoScroll.SynchronizingObject = this; // // menuItemConnect // this.menuItemConnect.Index = 0; this.menuItemConnect.Text = "Connect"; this.menuItemConnect.Click += new System.EventHandler(this.menuItemConnect_Click); // // menuItemDisconnect // this.menuItemDisconnect.Enabled = false; this.menuItemDisconnect.Index = 1; this.menuItemDisconnect.Text = "Disconnect"; this.menuItemDisconnect.Click += new System.EventHandler(this.menuItemDisconnect_Click); // // menuItemSeperator // this.menuItemSeperator.Index = 2; this.menuItemSeperator.Text = "-"; // // menuItemExit // this.menuItemExit.Index = 3; this.menuItemExit.Text = "Exit"; this.menuItemExit.Click += new System.EventHandler(this.menuItemExit_Click); // // menuItemFile // this.menuItemFile.Index = 0; this.menuItemFile.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this.menuItemConnect, this.menuItemDisconnect, this.menuItemSeperator, this.menuItemExit}); this.menuItemFile.Text = "File"; // // menuItemAutoConnect // this.menuItemAutoConnect.Index = 0; this.menuItemAutoConnect.Text = "Auto Connect"; this.menuItemAutoConnect.Click += new System.EventHandler(this.menuItemAutoConnect_Click); // // menuItemAutoScroll // this.menuItemAutoScroll.Checked = true; this.menuItemAutoScroll.Index = 1; this.menuItemAutoScroll.Text = "Auto Scroll"; this.menuItemAutoScroll.Click += new System.EventHandler(this.menuItemAutoScroll_Click); // // menuItemOptions // this.menuItemOptions.Index = 1; this.menuItemOptions.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this.menuItemAutoConnect, this.menuItemAutoScroll}); this.menuItemOptions.Text = "Options"; // // mainMenu // this.mainMenu.MenuItems.AddRange(new System.Windows.Forms.MenuItem[] { this.menuItemFile, this.menuItemOptions}); // // ChatForm // this.AutoScaleBaseSize = new System.Drawing.Size(5, 13); this.ClientSize = new System.Drawing.Size(784, 365); this.Controls.Add(this.panelChatTabs); this.Controls.Add(this.panelUserList); this.Controls.Add(this.panelChatInput); this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon"))); this.Menu = this.mainMenu; this.MinimumSize = new System.Drawing.Size(800, 404); this.Name = "ChatForm"; this.Closing += new System.ComponentModel.CancelEventHandler(this.ChatForm_Closing); this.Load += new System.EventHandler(this.ChatForm_Load); this.Resize += new System.EventHandler(this.ChatForm_Resize); this.tabControlChatTabs.ResumeLayout(false); this.tabPageChatOutput.ResumeLayout(false); this.tabPageChatOutput.PerformLayout(); this.panelUserList.ResumeLayout(false); this.panelChatInput.ResumeLayout(false); this.panelChatInput.PerformLayout(); this.panelChatTabs.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.timerAutoScroll)).EndInit(); this.ResumeLayout(false); }
private void AppendText(string target, string type, string text) { try { if (exRichTextBoxChatOutput.InvokeRequired) { exRichTextBoxChatOutput.Invoke(new RichTextBoxUpdate_Delegate(AppendText), new object[] { target, type, text }); } else { textBoxChatInput.Font = new Font(User.defaultFontFamily, User.defaultFontSize, User.defaultFontStyle, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); tabControlChatTabs.Font = new Font(User.defaultFontFamily, User.defaultFontSize, User.defaultFontStyle, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); listBoxUserList.Font = new Font(User.defaultFontFamily, User.defaultFontSize, User.defaultFontStyle, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); if (target.Equals(User.channel)) { switch (type) { case "tag": exRichTextBoxChatOutput.SelectionColor = User.tag; break; case "time": exRichTextBoxChatOutput.SelectionColor = User.time; break; case "action": exRichTextBoxChatOutput.SelectionColor = User.action; break; case "yourself": exRichTextBoxChatOutput.SelectionColor = User.yourself; break; case "text": exRichTextBoxChatOutput.SelectionColor = User.text; break; case "notice": exRichTextBoxChatOutput.SelectionColor = User.notice; break; case "person": exRichTextBoxChatOutput.SelectionColor = User.person; break; } exRichTextBoxChatOutput.Font = new Font(User.defaultFontFamily, User.defaultFontSize, User.defaultFontStyle, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); exRichTextBoxChatOutput.AppendText(text); } else { ArrayList chatWindows = new ArrayList(); Khendys.Controls.ExRichTextBox chat = new Khendys.Controls.ExRichTextBox(); chat.Font = new Font(User.defaultFontFamily, User.defaultFontSize, User.defaultFontStyle, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); if (alprivMsgs.Count > 0) { chatWindows = (ArrayList)alPrivMsgWindowList[alprivMsgs.IndexOf(target)]; switch (type) { case "tag": chat = (Khendys.Controls.ExRichTextBox)chatWindows[0]; chat.SelectionColor = User.tag; chatWindows[0] = chat; break; case "time": chat = (Khendys.Controls.ExRichTextBox)chatWindows[0]; chat.SelectionColor = User.time; chatWindows[0] = chat; break; case "action": chat = (Khendys.Controls.ExRichTextBox)chatWindows[0]; chat.SelectionColor = User.action; chatWindows[0] = chat; break; case "yourself": chat = (Khendys.Controls.ExRichTextBox)chatWindows[0]; chat.SelectionColor = User.yourself; chatWindows[0] = chat; break; case "text": chat = (Khendys.Controls.ExRichTextBox)chatWindows[0]; chat.SelectionColor = User.text; chatWindows[0] = chat; break; case "notice": chat = (Khendys.Controls.ExRichTextBox)chatWindows[0]; chat.SelectionColor = User.notice; chatWindows[0] = chat; break; case "person": chat = (Khendys.Controls.ExRichTextBox)chatWindows[0]; chat.SelectionColor = User.person; chatWindows[0] = chat; break; } chat = (Khendys.Controls.ExRichTextBox)chatWindows[0]; chat.AppendText(text); chatWindows[0] = chat; alPrivMsgWindowList[alprivMsgs.IndexOf(target)] = chatWindows; } } } ScrollChatWindow(); } catch (Exception ex) { User.ErrorLog(ex.ToString()); } }
private void textBoxChatInput_KeyPress(object sender, KeyPressEventArgs e) { try { if (allowInput) { if (e.KeyChar == (char)27) { if (alprivMsgs.Contains(tabControlChatTabs.SelectedTab.Text)) { for (int i = 0; i < tabControlChatTabs.TabPages.Count; i++) { if (tabControlChatTabs.TabPages[i].Text.ToString().Equals(tabControlChatTabs.SelectedTab.Text)) { removeTabPageDelegate = new RemoveTabPage_Delegate(RemoveTabPage_DelegateFunction); IAsyncResult r = BeginInvoke(removeTabPageDelegate, new object[] { tabControlChatTabs.TabPages[i] }); EndInvoke(r); } } } } if (e.KeyChar == (char)13) { if (User.extra != null) { this.Text = Application.Name + " [" + User.server + ":" + User.port.ToString() + ", " + irc.Nickname + "] - " + User.extra.ToString(); } if (textBoxChatInput.Text.Length > 0) { if (textBoxChatInput.Text.StartsWith("/")) { if (textBoxChatInput.Text.StartsWith("/nick ") || textBoxChatInput.Text.StartsWith("/me ") || textBoxChatInput.Text.StartsWith("/msg ") || textBoxChatInput.Text.StartsWith("/query ") || textBoxChatInput.Text.StartsWith("/op ") || textBoxChatInput.Text.Equals("/basic") || textBoxChatInput.Text.Equals("/help") || textBoxChatInput.Text.Equals("/admin") || textBoxChatInput.Text.Equals("/config") || textBoxChatInput.Text.Equals("/close") || textBoxChatInput.Text.Equals("/disconnect") || textBoxChatInput.Text.StartsWith("/own ") || textBoxChatInput.Text.StartsWith("/halfop ") || textBoxChatInput.Text.StartsWith("/protect ") || textBoxChatInput.Text.StartsWith("/voice ") || textBoxChatInput.Text.StartsWith("/ignore ") || textBoxChatInput.Text.Equals("/clear") || textBoxChatInput.Text.StartsWith("/deop ") || textBoxChatInput.Text.StartsWith("/devoice ") || textBoxChatInput.Text.StartsWith("/deown ") || textBoxChatInput.Text.StartsWith("/dehalfop ") || textBoxChatInput.Text.StartsWith("/unprotect ") || textBoxChatInput.Text.StartsWith("/ban ") || textBoxChatInput.Text.StartsWith("/unban ") || textBoxChatInput.Text.StartsWith("/kick ") || textBoxChatInput.Text.StartsWith("/topic ") || textBoxChatInput.Text.Equals("/topic") || textBoxChatInput.Text.StartsWith("/whois ") || textBoxChatInput.Text.Equals("/quit") || textBoxChatInput.Text.Equals("/exit") || textBoxChatInput.Text.StartsWith("/quit ") || textBoxChatInput.Text.StartsWith("/autoscroll ") || textBoxChatInput.Text.StartsWith("/autoconnect ") || textBoxChatInput.Text.StartsWith("/exit ")) { if (textBoxChatInput.Text.Equals("/config")) { ShowConfigHelp(); } if (textBoxChatInput.Text.Equals("/admin")) { ShowAdvancedCommandHelp(); } if (textBoxChatInput.Text.Equals("/help")) { ShowMainHelp(); } if (textBoxChatInput.Text.Equals("/basic")) { ShowBasicCommandHelp(); } if (textBoxChatInput.Text.StartsWith("/autoconnect ")) { string message = textBoxChatInput.Text.Substring(13); if (message.Equals("on")) { menuItemAutoConnect.Checked = true; AppendText(tabControlChatTabs.SelectedTab.Text, "tag", "["); AppendText(tabControlChatTabs.SelectedTab.Text, "time", DateTime.Now.ToShortTimeString().ToString()); AppendText(tabControlChatTabs.SelectedTab.Text, "tag", "] "); AppendText(tabControlChatTabs.SelectedTab.Text, "notice", " -!- Auto Connect has been turned on\n"); } if (message.Equals("off")) { menuItemAutoConnect.Checked = false; AppendText(tabControlChatTabs.SelectedTab.Text, "tag", "["); AppendText(tabControlChatTabs.SelectedTab.Text, "time", DateTime.Now.ToShortTimeString().ToString()); AppendText(tabControlChatTabs.SelectedTab.Text, "tag", "] "); AppendText(tabControlChatTabs.SelectedTab.Text, "notice", " -!- Auto Connect has been turned off\n"); } } if (textBoxChatInput.Text.StartsWith("/autoscroll ")) { string message = textBoxChatInput.Text.Substring(12); if (message.Equals("on")) { menuItemAutoScroll.Checked = true; timerAutoScroll.Enabled = true; ScrollChatWindow(); AppendText(tabControlChatTabs.SelectedTab.Text, "tag", "["); AppendText(tabControlChatTabs.SelectedTab.Text, "time", DateTime.Now.ToShortTimeString().ToString()); AppendText(tabControlChatTabs.SelectedTab.Text, "tag", "] "); AppendText(tabControlChatTabs.SelectedTab.Text, "notice", " -!- Auto Scroll has been turned on\n"); } if (message.Equals("off")) { menuItemAutoScroll.Checked = false; timerAutoScroll.Enabled = false; AppendText(tabControlChatTabs.SelectedTab.Text, "tag", "["); AppendText(tabControlChatTabs.SelectedTab.Text, "time", DateTime.Now.ToShortTimeString().ToString()); AppendText(tabControlChatTabs.SelectedTab.Text, "tag", "] "); AppendText(tabControlChatTabs.SelectedTab.Text, "notice", " -!- Auto Scroll has been turned off\n"); } } if (textBoxChatInput.Text.Equals("/disconnect")) { if (menuItemDisconnect.Enabled) { menuItemDisconnect_Click(sender, e); } } if (textBoxChatInput.Text.Equals("/close")) { if (alprivMsgs.Contains(tabControlChatTabs.SelectedTab.Text)) { for (int i = 0; i < tabControlChatTabs.TabPages.Count; i++) { if (tabControlChatTabs.TabPages[i].Text.ToString().Equals(tabControlChatTabs.SelectedTab.Text)) { removeTabPageDelegate = new RemoveTabPage_Delegate(RemoveTabPage_DelegateFunction); IAsyncResult r = BeginInvoke(removeTabPageDelegate, new object[] { tabControlChatTabs.TabPages[i] }); EndInvoke(r); } } } } if (textBoxChatInput.Text.StartsWith("/quit ") || textBoxChatInput.Text.StartsWith("/exit ")) { mstrQuitMessage = textBoxChatInput.Text.Substring(6); Exit(); } if (textBoxChatInput.Text.Equals("/quit") || textBoxChatInput.Text.Equals("/exit")) { Exit(); } if (textBoxChatInput.Text.StartsWith("/msg ") || textBoxChatInput.Text.StartsWith("/query ")) { string comment = null; string message = null; if (textBoxChatInput.Text.StartsWith("/msg ")) { message = textBoxChatInput.Text.Substring(5); } if (textBoxChatInput.Text.StartsWith("/query ")) { message = textBoxChatInput.Text.Substring(7); } string[] split = message.Split(' '); for (int i = 1; i < split.Length; i++) { comment += split[i].ToString() + " "; } if (comment != null) { comment = comment.TrimStart(' '); } if (!split[0].ToString().Equals(irc.Nickname.ToString())) { if (split[0].ToString().Equals("NickServ")) { split[0] = split[0].ToLower(); } if (listBoxUserList.Items.Contains(split[0].ToString()) || split[0].ToString().Equals("nickserv")) { textBoxChatWindow = new Khendys.Controls.ExRichTextBox(); textBoxChatWindow.BackColor = User.background; textBoxChatWindow.ForeColor = User.text; textBoxChatWindow.ReadOnly = true; textBoxChatWindow.Font = new Font(User.defaultFontFamily, User.defaultFontSize, User.defaultFontStyle, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); tab = new TabPage(split[0].ToString()); if (!alprivMsgs.Contains(split[0].ToString())) { textBoxChatWindow.Dock = System.Windows.Forms.DockStyle.Fill; textBoxChatWindow.Visible = true; tab.Controls.Add(textBoxChatWindow); alprivMsgs.Add(split[0].ToString()); alPrivMsgWindows = new ArrayList(); alPrivMsgWindows.Add(textBoxChatWindow); alPrivMsgWindowList.Add(alPrivMsgWindows); addTabPageDelegate = new AddTabPage_Delegate(AddTabPage_DelegateFunction); IAsyncResult r = BeginInvoke(addTabPageDelegate, new object[] { tab }); EndInvoke(r); tabControlChatTabs.SelectedTab = tab; if (comment != null && comment.Length > 0) { if (split[0].Equals("nickserv")) { irc.Message(SendType.Message, split[0].ToString(), comment.ToString()); } else { irc.Message(SendType.Message, split[0].ToString(), comment.ToString()); } AppendText(tabControlChatTabs.SelectedTab.Text, "yourself", "["); AppendText(tabControlChatTabs.SelectedTab.Text, "yourself", DateTime.Now.ToShortTimeString().ToString()); AppendText(tabControlChatTabs.SelectedTab.Text, "yourself", "] <"); AppendText(tabControlChatTabs.SelectedTab.Text, "yourself", Nickname(irc.Nickname.ToString())); AppendText(tabControlChatTabs.SelectedTab.Text, "yourself", "> "); AppendText(tabControlChatTabs.SelectedTab.Text, "yourself", comment.ToString()); AppendText(tabControlChatTabs.SelectedTab.Text, "text", "\n"); User.Log(tabControlChatTabs.SelectedTab.Text, "[" + DateTime.Now.ToShortTimeString().ToString() + "] <" + Nickname(irc.Nickname.ToString()) + "> " + comment.ToString() + "\n"); } } else { for (int i = 0; i < tabControlChatTabs.TabPages.Count; i++) { if (tabControlChatTabs.TabPages[i].Text.ToString().Equals(split[0])) { tab = tabControlChatTabs.TabPages[i]; } } for (int i = 0; i < tab.Controls.Count; i++) { if (tab.Controls[i].GetType().Name == "ExRichTextBox") { tabControlChatTabs.SelectedTab = tab; if (comment != null && comment.Length > 0) { if (split[0].Equals("nickserv")) { irc.Message(SendType.Message, split[0].ToString(), comment.ToString()); } else { irc.Message(SendType.Message, split[0].ToString(), comment.ToString()); } AppendText(tabControlChatTabs.SelectedTab.Text, "yourself", "["); AppendText(tabControlChatTabs.SelectedTab.Text, "yourself", DateTime.Now.ToShortTimeString().ToString()); AppendText(tabControlChatTabs.SelectedTab.Text, "yourself", "] <"); AppendText(tabControlChatTabs.SelectedTab.Text, "yourself", Nickname(irc.Nickname.ToString())); AppendText(tabControlChatTabs.SelectedTab.Text, "yourself", "> "); AppendText(tabControlChatTabs.SelectedTab.Text, "yourself", comment.ToString()); AppendText(tabControlChatTabs.SelectedTab.Text, "text", "\n"); User.Log(tabControlChatTabs.SelectedTab.Text, "[" + DateTime.Now.ToShortTimeString().ToString() + "] <" + Nickname(irc.Nickname.ToString()) + "> " + comment.ToString() + "\n"); break; } } } } } } } if (textBoxChatInput.Text.StartsWith("/whois ")) { string nickname = textBoxChatInput.Text.Substring(7); if (listBoxUserList.Items.Contains(Nickname(nickname))) { AppendText(tabControlChatTabs.SelectedTab.Text, "tag", "["); AppendText(tabControlChatTabs.SelectedTab.Text, "time", DateTime.Now.ToShortTimeString().ToString()); AppendText(tabControlChatTabs.SelectedTab.Text, "tag", "] "); AppendText(tabControlChatTabs.SelectedTab.Text, "notice", " -!- " + nickname + " is " + irc.GetChannelUser(User.channel, nickname).Ident.ToString() + "@" + irc.GetChannelUser(User.channel, nickname).Host.ToString() + " (" + irc.GetChannelUser(User.channel, nickname).Realname.ToString() + ")\n"); User.Log(tabControlChatTabs.SelectedTab.Text, "[" + DateTime.Now.ToShortTimeString().ToString() + "] " + " -!- " + nickname + " is " + irc.GetChannelUser(User.channel, nickname).Ident.ToString() + "@" + irc.GetChannelUser(User.channel, nickname).Host.ToString() + " (" + irc.GetChannelUser(User.channel, nickname).Realname.ToString() + ")\n"); } } if (textBoxChatInput.Text.StartsWith("/me ")) { AppendText(tabControlChatTabs.SelectedTab.Text, "tag", "["); AppendText(tabControlChatTabs.SelectedTab.Text, "time", DateTime.Now.ToShortTimeString().ToString()); AppendText(tabControlChatTabs.SelectedTab.Text, "tag", "] "); AppendText(tabControlChatTabs.SelectedTab.Text, "action", "* " + irc.Nickname.ToString() + " "); AppendText(tabControlChatTabs.SelectedTab.Text, "action", textBoxChatInput.Text.Substring(4)); AppendText(tabControlChatTabs.SelectedTab.Text, "action", "\n"); irc.Message(SendType.Action, tabControlChatTabs.SelectedTab.Text, textBoxChatInput.Text.Substring(4)); User.Log(tabControlChatTabs.SelectedTab.Text, "[" + DateTime.Now.ToShortTimeString().ToString() + "] * " + irc.Nickname.ToString() + " " + textBoxChatInput.Text.Substring(4) + "\n"); } if (textBoxChatInput.Text.Equals("/topic")) { AppendText(User.channel, "notice", " -!- Topic: " + irc.GetChannel(User.channel).Topic.ToString() + "\n"); User.Log(User.channel, " -!- Topic: " + irc.GetChannel(User.channel).Topic.ToString() + "\n"); } if (textBoxChatInput.Text.Equals("/clear")) { ClearText(); } if (textBoxChatInput.Text.StartsWith("/topic ")) { if (irc.GetChannelUser(User.channel, irc.Nickname).IsOp || irc.GetChannelUser(User.channel, irc.Nickname).IsOwner) { string message = textBoxChatInput.Text.Substring(7); string[] split = message.Split(' '); if (split.Length > 0) { message = message.TrimEnd(' '); AppendText(User.channel, "notice", " -!- " + irc.Nickname.ToString() + " changed the topic to: " + message + "\n"); irc.Topic(User.channel, message); User.Log(User.channel, " -!- " + irc.Nickname.ToString() + " changed the topic to: " + message + "\n"); this.Text = Application.Name + " [" + User.server + ":" + User.port.ToString() + ", " + irc.Nickname + "] - " + message.ToString(); } } else { AppendText(User.channel, "notice", " -!- " + "You need to have operator status or higher in order to set the topic. This is a restriction imposed by " + Application.Name + " in order to protect the topic from being set by non-operators.\n"); User.Log(User.channel, " -!- " + "You need to have operator status or higher in order to set the topic. This is a restriction imposed by " + Application.Name + " in order to protect the topic from being set by non-operators.\n"); } } if (textBoxChatInput.Text.StartsWith("/protect ")) { string message = textBoxChatInput.Text.Substring(4); string[] split = message.Split(' '); if (split.Length == 1) { if (irc.GetChannelUser(User.channel, split[0].ToString()).IsVoice) { irc.Devoice(User.channel, split[0].ToString()); } if (irc.GetChannelUser(User.channel, split[0].ToString()).IsOwner) { irc.DeOwner(User.channel, split[0].ToString()); } if (irc.GetChannelUser(User.channel, split[0].ToString()).IsHalfOp) { irc.DeHalfOp(User.channel, split[0].ToString()); } if (irc.GetChannelUser(User.channel, split[0].ToString()).IsOp) { irc.Deop(User.channel, split[0].ToString()); } irc.Protect(User.channel, split[0].ToString()); } } if (textBoxChatInput.Text.StartsWith("/halfop ")) { string message = textBoxChatInput.Text.Substring(4); string[] split = message.Split(' '); if (split.Length == 1) { if (irc.GetChannelUser(User.channel, split[0].ToString()).IsVoice) { irc.Devoice(User.channel, split[0].ToString()); } if (irc.GetChannelUser(User.channel, split[0].ToString()).IsOwner) { irc.DeOwner(User.channel, split[0].ToString()); } if (irc.GetChannelUser(User.channel, split[0].ToString()).IsOp) { irc.Deop(User.channel, split[0].ToString()); } if (irc.GetChannelUser(User.channel, split[0].ToString()).IsProtected) { irc.DeProtect(User.channel, split[0].ToString()); } irc.HalfOp(User.channel, split[0].ToString()); } } if (textBoxChatInput.Text.StartsWith("/own ")) { string message = textBoxChatInput.Text.Substring(4); string[] split = message.Split(' '); if (split.Length == 1) { if (irc.GetChannelUser(User.channel, split[0].ToString()).IsVoice) { irc.Devoice(User.channel, split[0].ToString()); } if (irc.GetChannelUser(User.channel, split[0].ToString()).IsOp) { irc.Deop(User.channel, split[0].ToString()); } if (irc.GetChannelUser(User.channel, split[0].ToString()).IsHalfOp) { irc.DeHalfOp(User.channel, split[0].ToString()); } if (irc.GetChannelUser(User.channel, split[0].ToString()).IsProtected) { irc.DeProtect(User.channel, split[0].ToString()); } irc.Owner(User.channel, split[0].ToString()); } } if (textBoxChatInput.Text.StartsWith("/op ")) { string message = textBoxChatInput.Text.Substring(4); string[] split = message.Split(' '); if (split.Length == 1) { if (irc.GetChannelUser(User.channel, split[0].ToString()).IsVoice) { irc.Devoice(User.channel, split[0].ToString()); } if (irc.GetChannelUser(User.channel, split[0].ToString()).IsOwner) { irc.DeOwner(User.channel, split[0].ToString()); } if (irc.GetChannelUser(User.channel, split[0].ToString()).IsHalfOp) { irc.DeHalfOp(User.channel, split[0].ToString()); } if (irc.GetChannelUser(User.channel, split[0].ToString()).IsProtected) { irc.DeProtect(User.channel, split[0].ToString()); } irc.Op(User.channel, split[0].ToString()); } } if (textBoxChatInput.Text.StartsWith("/deown ")) { string message = textBoxChatInput.Text.Substring(6); string[] split = message.Split(' '); if (split.Length == 1) { irc.DeOwner(User.channel, split[0].ToString()); } } if (textBoxChatInput.Text.StartsWith("/dehalfop ")) { string message = textBoxChatInput.Text.Substring(6); string[] split = message.Split(' '); if (split.Length == 1) { irc.DeHalfOp(User.channel, split[0].ToString()); } } if (textBoxChatInput.Text.StartsWith("/unprotect ")) { string message = textBoxChatInput.Text.Substring(6); string[] split = message.Split(' '); if (split.Length == 1) { irc.DeProtect(User.channel, split[0].ToString()); } } if (textBoxChatInput.Text.StartsWith("/deop ")) { string message = textBoxChatInput.Text.Substring(6); string[] split = message.Split(' '); if (split.Length == 1) { irc.Deop(User.channel, split[0].ToString()); } } if (textBoxChatInput.Text.StartsWith("/ignore ")) { string user = textBoxChatInput.Text.Substring(8); if (user != User.username) { alIgnoredHosts.Add(irc.GetChannelUser(User.channel, user).Host.ToString()); using (StreamWriter sw = new StreamWriter("ignore", true)) { sw.WriteLine(irc.GetChannelUser(User.channel, user).Host.ToString()); } } } if (textBoxChatInput.Text.StartsWith("/voice ")) { string message = textBoxChatInput.Text.Substring(7); string[] split = message.Split(' '); if (split.Length == 1) { irc.Voice(User.channel, split[0].ToString()); if (irc.GetChannelUser(User.channel, split[0].ToString()).IsOp) { irc.Deop(User.channel, split[0].ToString()); } if (irc.GetChannelUser(User.channel, split[0].ToString()).IsOwner) { irc.DeOwner(User.channel, split[0].ToString()); } if (irc.GetChannelUser(User.channel, split[0].ToString()).IsProtected) { irc.DeProtect(User.channel, split[0].ToString()); } if (irc.GetChannelUser(User.channel, split[0].ToString()).IsHalfOp) { irc.DeHalfOp(User.channel, split[0].ToString()); } } } if (textBoxChatInput.Text.StartsWith("/devoice ")) { string message = textBoxChatInput.Text.Substring(9); string[] split = message.Split(' '); if (split.Length == 1) { irc.Devoice(User.channel, split[0].ToString()); } } if (textBoxChatInput.Text.StartsWith("/ban ")) { string message = textBoxChatInput.Text.Substring(5); string[] split = message.Split(' '); if (split.Length == 1) { if (!irc.GetChannelUser(User.channel, split[0]).IsOwner && !irc.GetChannelUser(User.channel, split[0]).IsOp && !irc.GetChannelUser(User.channel, split[0]).IsHalfOp && !irc.GetChannelUser(User.channel, split[0]).IsProtected) { irc.Ban(User.channel, irc.GetChannelUser(User.channel, split[0].ToString()).Host.ToString()); } else { AppendText(User.channel, "tag", "["); AppendText(User.channel, "time", DateTime.Now.ToShortTimeString().ToString()); AppendText(User.channel, "tag", "] "); AppendText(User.channel, "notice", " -!- Ban failed. " + split[0] + " is a protected user\n"); } } } if (textBoxChatInput.Text.StartsWith("/unban ")) { string message = textBoxChatInput.Text.Substring(7); string[] split = message.Split(' '); if (split.Length == 1) { irc.Unban(User.channel, irc.GetChannelUser(User.channel, split[0].ToString()).Host.ToString()); } } if (textBoxChatInput.Text.StartsWith("/kick ")) { string message = textBoxChatInput.Text.Substring(6); string[] split = message.Split(' '); if (split.Length == 1) { if (!irc.GetChannelUser(User.channel, split[0]).IsOwner && !irc.GetChannelUser(User.channel, split[0]).IsOp && !irc.GetChannelUser(User.channel, split[0]).IsHalfOp && !irc.GetChannelUser(User.channel, split[0]).IsProtected) { irc.Kick(User.channel, split[0]); } else { AppendText(User.channel, "tag", "["); AppendText(User.channel, "time", DateTime.Now.ToShortTimeString().ToString()); AppendText(User.channel, "tag", "] "); AppendText(User.channel, "notice", " -!- Kick failed. " + split[0] + " is a protected user\n"); } } if (split.Length >= 2) { string reason = null; for (int j = 0; j < split.Length; j++) { reason += split[j].ToString() + " "; } reason = reason.TrimEnd(' '); if (!irc.GetChannelUser(User.channel, split[0]).IsOwner && !irc.GetChannelUser(User.channel, split[0]).IsOp && !irc.GetChannelUser(User.channel, split[0]).IsHalfOp && !irc.GetChannelUser(User.channel, split[0]).IsProtected) { irc.Kick(User.channel, split[0].ToString(), reason.ToString()); } else { AppendText(User.channel, "tag", "["); AppendText(User.channel, "time", DateTime.Now.ToShortTimeString().ToString()); AppendText(User.channel, "tag", "] "); AppendText(User.channel, "notice", " -!- Kick failed. " + split[0] + " is a protected user\n"); } } } if (textBoxChatInput.Text.StartsWith("/nick ")) { string message = textBoxChatInput.Text.Substring(6); string[] split = message.Split(' '); User.username = split[0]; irc.Nick(split[0].ToString()); this.Text = Application.Name + " [" + User.server + ":" + User.port.ToString() + ", " + split[0].ToString() + "] - " + irc.GetChannel(User.channel).Topic.ToString(); } } } else { AppendText(tabControlChatTabs.SelectedTab.Text, "yourself", "["); AppendText(tabControlChatTabs.SelectedTab.Text, "yourself", DateTime.Now.ToShortTimeString().ToString()); AppendText(tabControlChatTabs.SelectedTab.Text, "yourself", "] <"); AppendText(tabControlChatTabs.SelectedTab.Text, "yourself", Nickname(irc.Nickname.ToString())); AppendText(tabControlChatTabs.SelectedTab.Text, "yourself", "> "); AppendText(tabControlChatTabs.SelectedTab.Text, "text", textBoxChatInput.Text + "\n"); irc.Message(SendType.Message, tabControlChatTabs.SelectedTab.Text, textBoxChatInput.Text); User.Log(tabControlChatTabs.SelectedTab.Text, "[" + DateTime.Now.ToShortTimeString().ToString() + "] <" + Nickname(irc.Nickname.ToString()) + "> " + textBoxChatInput.Text + "\n"); } } textBoxChatInput.Clear(); } } else { if (e.KeyChar == (char)13) { if (textBoxChatInput.Text != "") { if (textBoxChatInput.Text.StartsWith("/")) { if (textBoxChatInput.Text.StartsWith("/server ")) { string message = textBoxChatInput.Text.Substring(8); User.server = message; Microsoft.Win32.RegistryKey key = Microsoft.Win32.Registry.CurrentUser; key = key.CreateSubKey("SOFTWARE\\" + Application.Name); key.SetValue("server", User.server.ToString()); AppendText(tabControlChatTabs.SelectedTab.Text, "tag", "["); AppendText(tabControlChatTabs.SelectedTab.Text, "time", DateTime.Now.ToShortTimeString().ToString()); AppendText(tabControlChatTabs.SelectedTab.Text, "tag", "] "); AppendText(tabControlChatTabs.SelectedTab.Text, "notice", " -!- Server address has been set to " + message + "\n"); } if (textBoxChatInput.Text.StartsWith("/port ")) { string message = textBoxChatInput.Text.Substring(6); try { User.port = Convert.ToInt32(message); Microsoft.Win32.RegistryKey key = Microsoft.Win32.Registry.CurrentUser; key = key.CreateSubKey("SOFTWARE\\" + Application.Name); key.SetValue("port", User.port); AppendText(tabControlChatTabs.SelectedTab.Text, "tag", "["); AppendText(tabControlChatTabs.SelectedTab.Text, "time", DateTime.Now.ToShortTimeString().ToString()); AppendText(tabControlChatTabs.SelectedTab.Text, "tag", "] "); AppendText(tabControlChatTabs.SelectedTab.Text, "notice", " -!- Server port has been set to " + message + "\n"); } catch (System.FormatException) { AppendText(tabControlChatTabs.SelectedTab.Text, "tag", "["); AppendText(tabControlChatTabs.SelectedTab.Text, "time", DateTime.Now.ToShortTimeString().ToString()); AppendText(tabControlChatTabs.SelectedTab.Text, "tag", "] "); AppendText(tabControlChatTabs.SelectedTab.Text, "notice", " -!- Server port must be a number\n"); } } if (textBoxChatInput.Text.StartsWith("/channel ")) { string message = textBoxChatInput.Text.Substring(9); User.channel = message; Microsoft.Win32.RegistryKey key = Microsoft.Win32.Registry.CurrentUser; key = key.CreateSubKey("SOFTWARE\\" + Application.Name); key.SetValue("channel", User.channel.ToString()); tabControlChatTabs.TabPages[0].Text = User.channel; AppendText(tabControlChatTabs.SelectedTab.Text, "tag", "["); AppendText(tabControlChatTabs.SelectedTab.Text, "time", DateTime.Now.ToShortTimeString().ToString()); AppendText(tabControlChatTabs.SelectedTab.Text, "tag", "] "); AppendText(tabControlChatTabs.SelectedTab.Text, "notice", " -!- Channel name has been set to " + message + "\n"); } if (textBoxChatInput.Text.Equals("/config")) { ShowConfigHelp(); } if (textBoxChatInput.Text.Equals("/admin")) { ShowAdvancedCommandHelp(); } if (textBoxChatInput.Text.Equals("/help")) { ShowMainHelp(); } if (textBoxChatInput.Text.Equals("/basic")) { ShowBasicCommandHelp(); } if (textBoxChatInput.Text.StartsWith("/autoconnect ")) { string message = textBoxChatInput.Text.Substring(13); if (message.Equals("on")) { menuItemAutoConnect.Checked = true; AppendText(tabControlChatTabs.SelectedTab.Text, "tag", "["); AppendText(tabControlChatTabs.SelectedTab.Text, "time", DateTime.Now.ToShortTimeString().ToString()); AppendText(tabControlChatTabs.SelectedTab.Text, "tag", "] "); AppendText(tabControlChatTabs.SelectedTab.Text, "notice", " -!- Auto Connect has been turned on\n"); } if (message.Equals("off")) { menuItemAutoConnect.Checked = false; AppendText(tabControlChatTabs.SelectedTab.Text, "tag", "["); AppendText(tabControlChatTabs.SelectedTab.Text, "time", DateTime.Now.ToShortTimeString().ToString()); AppendText(tabControlChatTabs.SelectedTab.Text, "tag", "] "); AppendText(tabControlChatTabs.SelectedTab.Text, "notice", " -!- Auto Connect has been turned off\n"); } } if (textBoxChatInput.Text.StartsWith("/autoscroll ")) { string message = textBoxChatInput.Text.Substring(12); if (message.Equals("on")) { menuItemAutoScroll.Checked = true; timerAutoScroll.Enabled = true; ScrollChatWindow(); AppendText(tabControlChatTabs.SelectedTab.Text, "tag", "["); AppendText(tabControlChatTabs.SelectedTab.Text, "time", DateTime.Now.ToShortTimeString().ToString()); AppendText(tabControlChatTabs.SelectedTab.Text, "tag", "] "); AppendText(tabControlChatTabs.SelectedTab.Text, "notice", " -!- Auto Scroll has been turned on\n"); } if (message.Equals("off")) { menuItemAutoScroll.Checked = false; timerAutoScroll.Enabled = false; AppendText(tabControlChatTabs.SelectedTab.Text, "tag", "["); AppendText(tabControlChatTabs.SelectedTab.Text, "time", DateTime.Now.ToShortTimeString().ToString()); AppendText(tabControlChatTabs.SelectedTab.Text, "tag", "] "); AppendText(tabControlChatTabs.SelectedTab.Text, "notice", " -!- Auto Scroll has been turned off\n"); } } if (textBoxChatInput.Text.StartsWith("/nick ")) { string message = textBoxChatInput.Text.Substring(6); string[] split = message.Split(' '); AppendText(User.channel, "tag", "["); AppendText(User.channel, "time", DateTime.Now.ToShortTimeString().ToString()); AppendText(User.channel, "tag", "] "); AppendText(User.channel, "notice", " -!- " + User.username.ToString() + " is now known as " + split[0].ToString() + "\n"); User.username = split[0]; this.Text = Application.Name + " [" + User.server + ":" + User.port.ToString() + ", " + User.username + "]"; } if (textBoxChatInput.Text.StartsWith("/me ")) { AppendText(tabControlChatTabs.SelectedTab.Text, "tag", "["); AppendText(tabControlChatTabs.SelectedTab.Text, "time", DateTime.Now.ToShortTimeString().ToString()); AppendText(tabControlChatTabs.SelectedTab.Text, "tag", "] "); AppendText(tabControlChatTabs.SelectedTab.Text, "action", "* " + User.username.ToString() + " "); AppendText(tabControlChatTabs.SelectedTab.Text, "action", textBoxChatInput.Text.Substring(4)); AppendText(tabControlChatTabs.SelectedTab.Text, "action", "\n"); } if (textBoxChatInput.Text.Equals("/connect")) { if (menuItemConnect.Enabled) { menuItemConnect_Click(sender, e); } } if (textBoxChatInput.Text.Equals("/disconnect")) { if (menuItemDisconnect.Enabled) { menuItemDisconnect_Click(sender, e); } } if (textBoxChatInput.Text.Equals("/clear")) { ClearText(); } if (textBoxChatInput.Text.Equals("/quit") || textBoxChatInput.Text.Equals("/exit")) { Exit(); } } else { AppendText(tabControlChatTabs.SelectedTab.Text, "yourself", "["); AppendText(tabControlChatTabs.SelectedTab.Text, "yourself", DateTime.Now.ToShortTimeString().ToString()); AppendText(tabControlChatTabs.SelectedTab.Text, "yourself", "] (offline) <"); AppendText(tabControlChatTabs.SelectedTab.Text, "yourself", User.username.ToString()); AppendText(tabControlChatTabs.SelectedTab.Text, "yourself", "> "); AppendText(tabControlChatTabs.SelectedTab.Text, "yourself", textBoxChatInput.Text); AppendText(tabControlChatTabs.SelectedTab.Text, "text", "\n"); } } textBoxChatInput.Clear(); } } } catch (Exception ex) { User.ErrorLog(ex.ToString()); } }
private void OnQueryMessage_DelegateFunction(Data ircdata) { try { if (!alIgnoredHosts.Contains(irc.GetChannelUser(User.channel, ircdata.Nick).Host)) { if (listBoxUserList.Items.Contains(Nickname(ircdata.Nick.ToString()))) { tab = new TabPage(ircdata.Nick); if (!alprivMsgs.Contains(ircdata.Nick.ToString())) { textBoxChatWindow = new Khendys.Controls.ExRichTextBox(); textBoxChatWindow.BackColor = User.background; textBoxChatWindow.ForeColor = User.text; textBoxChatWindow.ReadOnly = true; textBoxChatWindow.Font = new Font(User.defaultFontFamily, User.defaultFontSize, User.defaultFontStyle, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); textBoxChatWindow.Dock = System.Windows.Forms.DockStyle.Fill; textBoxChatWindow.Visible = true; tab.Controls.Add(textBoxChatWindow); alprivMsgs.Add(ircdata.Nick.ToString()); alPrivMsgWindows = new ArrayList(); alPrivMsgWindows.Add(textBoxChatWindow); alPrivMsgWindowList.Add(alPrivMsgWindows); string nickname = ircdata.Nick; AppendText(tab.Text, "tag", "["); AppendText(tab.Text, "time", DateTime.Now.ToShortTimeString().ToString()); AppendText(tab.Text, "tag", "] "); AppendText(tab.Text, "notice", " -!- " + nickname + " is " + irc.GetChannelUser(User.channel, nickname).Ident.ToString() + "@" + irc.GetChannelUser(User.channel, nickname).Host.ToString() + " (" + irc.GetChannelUser(User.channel, nickname).Realname.ToString() + ")\n"); addTabPageDelegate = new AddTabPage_Delegate(AddTabPage_DelegateFunction); IAsyncResult r = BeginInvoke(addTabPageDelegate, new object[] { tab }); EndInvoke(r); OnQueryMessage_DelegateFunction(ircdata); } else { for (int i = 0; i < tabControlChatTabs.TabPages.Count; i++) { if (tabControlChatTabs.TabPages[i].Text.ToString().Equals(ircdata.Nick.ToString())) { tab = tabControlChatTabs.TabPages[i]; AppendText(tab.Text, "tag", "["); AppendText(tab.Text, "time", DateTime.Now.ToShortTimeString().ToString()); AppendText(tab.Text, "tag", "] <"); AppendText(tab.Text, "person", Nickname(ircdata.Nick.ToString())); AppendText(tab.Text, "tag", "> "); AppendText(tab.Text, "person", ircdata.Message.ToString()); AppendText(tab.Text, "text", "\n"); User.Log(tab.Text, "[" + DateTime.Now.ToShortTimeString().ToString() + "] <" + ircdata.Nick.ToString() + "> " + ircdata.Message.ToString() + "\n"); alPrivMsgAlert.Add(i); } } tabControlChatTabs.Refresh(); for (int i = 0; i < tab.Controls.Count; i++) { if (tab.Controls[i].GetType().Name == "ExRichTextBox") { AppendText(tab.Controls[i].Text, "tag", "["); AppendText(tab.Controls[i].Text, "time", DateTime.Now.ToShortTimeString().ToString()); AppendText(tab.Controls[i].Text, "tag", "] <"); AppendText(tab.Controls[i].Text, "person", ircdata.Nick.ToString()); AppendText(tab.Controls[i].Text, "tag", "> "); AppendText(tab.Controls[i].Text, "person", ircdata.Message.ToString()); AppendText(tab.Controls[i].Text, "text", "\n"); User.Log(tab.Controls[i].Text, "[" + DateTime.Now.ToShortTimeString().ToString() + "] <" + ircdata.Nick.ToString() + "> " + ircdata.Message.ToString() + "\n"); } } } ShowChatWindow(); } } } catch (Exception ex) { User.ErrorLog(ex.ToString()); } }
private void listBoxUsers_DoubleClick(object sender, System.EventArgs e) { try { if (listBoxUserList.SelectedItem.ToString() != null) { string user = listBoxUserList.SelectedItem.ToString().TrimStart(new char[] { '@', '+', '~', '&', '%' }); if (!alIgnoredHosts.Contains(irc.GetChannelUser(User.channel, user).Host)) { if (!user.Equals(irc.Nickname.ToString())) { textBoxChatWindow = new Khendys.Controls.ExRichTextBox(); textBoxChatWindow.BackColor = User.background; textBoxChatWindow.ForeColor = User.text; textBoxChatWindow.ReadOnly = true; textBoxChatWindow.Font = new Font(User.defaultFontFamily, User.defaultFontSize, User.defaultFontStyle, System.Drawing.GraphicsUnit.Point, ((System.Byte)(0))); tab = new TabPage(user.ToString()); if (!alprivMsgs.Contains(user.ToString())) { textBoxChatWindow.Dock = System.Windows.Forms.DockStyle.Fill; textBoxChatWindow.Visible = true; tab.Controls.Add(textBoxChatWindow); alprivMsgs.Add(user.ToString()); alPrivMsgWindows = new ArrayList(); alPrivMsgWindows.Add(textBoxChatWindow); alPrivMsgWindowList.Add(alPrivMsgWindows); addTabPageDelegate = new AddTabPage_Delegate(AddTabPage_DelegateFunction); IAsyncResult r = BeginInvoke(addTabPageDelegate, new object[] { tab }); EndInvoke(r); tabControlChatTabs.SelectedTab = tab; string nickname = user; AppendText(tab.Text, "tag", "["); AppendText(tab.Text, "time", DateTime.Now.ToShortTimeString().ToString()); AppendText(tab.Text, "tag", "] "); AppendText(tab.Text, "notice", " -!- " + nickname + " is " + irc.GetChannelUser(User.channel, nickname).Ident.ToString() + "@" + irc.GetChannelUser(User.channel, nickname).Host.ToString() + " (" + irc.GetChannelUser(User.channel, nickname).Realname.ToString() + ")\n"); } else { for (int i = 0; i < tabControlChatTabs.TabPages.Count; i++) { if (tabControlChatTabs.TabPages[i].Text.ToString().Equals(user)) { tab = tabControlChatTabs.TabPages[i]; } } for (int i = 0; i < tab.Controls.Count; i++) { if (tab.Controls[i].GetType().Name == "ExRichTextBox") { tabControlChatTabs.SelectedTab = tab; } } } } } } } catch (Exception ex) { User.ErrorLog(ex.ToString()); } }