From 7dc70bf64550ca53c45e42786877711a1a7b7a30 Mon Sep 17 00:00:00 2001 From: nooperation Date: Sun, 2 Aug 2015 17:32:54 -0400 Subject: [PATCH] Updated IRC plugin - second pass Two pass changes: * Restructured GUI * Restructured code * Added ability for IRC plugin to communicate with Chat, group conference, and IM windows. --- .../Radegast.Plugin.IRC/Radegast.Plugin.IRC.csproj | 23 +- .../Radegast.Plugin.IRC/RelayConsole.Designer.cs | 65 +++-- plugins/Radegast.Plugin.IRC/RelayConsole.cs | 284 ++++++++++++++------- 3 files changed, 246 insertions(+), 126 deletions(-) diff --git a/plugins/Radegast.Plugin.IRC/Radegast.Plugin.IRC.csproj b/plugins/Radegast.Plugin.IRC/Radegast.Plugin.IRC.csproj index a952372..b175621 100644 --- a/plugins/Radegast.Plugin.IRC/Radegast.Plugin.IRC.csproj +++ b/plugins/Radegast.Plugin.IRC/Radegast.Plugin.IRC.csproj @@ -34,34 +34,17 @@ true - - true - full - false - ..\..\bin\Debug\ - DEBUG;TRACE - prompt - 4 - - - pdbonly - true - ..\..\bin\Release\ - TRACE - prompt - 4 - true - ..\..\bin\Debug\ - DEBUG;TRACE + ..\..\bin\ + TRACE;DEBUG;SMARTHREADPOOL_REF;VISUAL_STUDIO full x86 prompt ..\..\bin\ - TRACE + TRACE;SMARTHREADPOOL_REF;VISUAL_STUDIO true pdbonly x86 diff --git a/plugins/Radegast.Plugin.IRC/RelayConsole.Designer.cs b/plugins/Radegast.Plugin.IRC/RelayConsole.Designer.cs index 5329c8f..2294237 100644 --- a/plugins/Radegast.Plugin.IRC/RelayConsole.Designer.cs +++ b/plugins/Radegast.Plugin.IRC/RelayConsole.Designer.cs @@ -45,6 +45,8 @@ this.scChat = new System.Windows.Forms.SplitContainer(); this.rtbChatText = new Radegast.RRichTextBox(); this.Participants = new Radegast.ListViewNoFlicker(); + this.label5 = new System.Windows.Forms.Label(); + this.cbSource = new System.Windows.Forms.ComboBox(); this.pnlChatLine.SuspendLayout(); this.pnlConnectionSettings.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.scChat)).BeginInit(); @@ -58,16 +60,16 @@ this.pnlChatLine.Controls.Add(this.btnSend); this.pnlChatLine.Controls.Add(this.cbxInput); this.pnlChatLine.Dock = System.Windows.Forms.DockStyle.Bottom; - this.pnlChatLine.Location = new System.Drawing.Point(0, 380); + this.pnlChatLine.Location = new System.Drawing.Point(0, 397); this.pnlChatLine.Name = "pnlChatLine"; - this.pnlChatLine.Size = new System.Drawing.Size(705, 27); + this.pnlChatLine.Size = new System.Drawing.Size(754, 27); this.pnlChatLine.TabIndex = 0; // // btnSend // this.btnSend.Anchor = ((System.Windows.Forms.AnchorStyles)((System.Windows.Forms.AnchorStyles.Bottom | System.Windows.Forms.AnchorStyles.Right))); this.btnSend.Enabled = false; - this.btnSend.Location = new System.Drawing.Point(646, 2); + this.btnSend.Location = new System.Drawing.Point(695, 2); this.btnSend.Name = "btnSend"; this.btnSend.Size = new System.Drawing.Size(55, 23); this.btnSend.TabIndex = 2; @@ -81,12 +83,14 @@ | System.Windows.Forms.AnchorStyles.Right))); this.cbxInput.Location = new System.Drawing.Point(3, 3); this.cbxInput.Name = "cbxInput"; - this.cbxInput.Size = new System.Drawing.Size(638, 20); + this.cbxInput.Size = new System.Drawing.Size(687, 20); this.cbxInput.TabIndex = 1; this.cbxInput.KeyDown += new System.Windows.Forms.KeyEventHandler(this.cbxInput_KeyDown); // // pnlConnectionSettings // + this.pnlConnectionSettings.Controls.Add(this.cbSource); + this.pnlConnectionSettings.Controls.Add(this.label5); this.pnlConnectionSettings.Controls.Add(this.btnConnect); this.pnlConnectionSettings.Controls.Add(this.txtChan); this.pnlConnectionSettings.Controls.Add(this.txtNick); @@ -100,7 +104,7 @@ this.pnlConnectionSettings.Dock = System.Windows.Forms.DockStyle.Top; this.pnlConnectionSettings.Location = new System.Drawing.Point(0, 0); this.pnlConnectionSettings.Name = "pnlConnectionSettings"; - this.pnlConnectionSettings.Size = new System.Drawing.Size(705, 30); + this.pnlConnectionSettings.Size = new System.Drawing.Size(754, 32); this.pnlConnectionSettings.TabIndex = 1; // // btnConnect @@ -115,15 +119,16 @@ // // txtChan // - this.txtChan.Location = new System.Drawing.Point(540, 6); + this.txtChan.Location = new System.Drawing.Point(487, 6); this.txtChan.Name = "txtChan"; this.txtChan.Size = new System.Drawing.Size(80, 20); this.txtChan.TabIndex = 4; + this.txtChan.Text = "#"; this.txtChan.Validated += new System.EventHandler(this.txtChan_Validated); // // txtNick // - this.txtNick.Location = new System.Drawing.Point(435, 6); + this.txtNick.Location = new System.Drawing.Point(382, 6); this.txtNick.Name = "txtNick"; this.txtNick.Size = new System.Drawing.Size(61, 20); this.txtNick.TabIndex = 3; @@ -131,11 +136,11 @@ // // txtPort // - this.txtPort.Location = new System.Drawing.Point(333, 6); + this.txtPort.Location = new System.Drawing.Point(301, 6); this.txtPort.Name = "txtPort"; - this.txtPort.Size = new System.Drawing.Size(61, 20); + this.txtPort.Size = new System.Drawing.Size(40, 20); this.txtPort.TabIndex = 2; - this.txtPort.Text = "6667"; + this.txtPort.Text = "66677"; this.txtPort.KeyPress += new System.Windows.Forms.KeyPressEventHandler(this.txtPort_KeyPress); this.txtPort.Validated += new System.EventHandler(this.txtPort_Validated); // @@ -143,7 +148,7 @@ // this.txtServer.Location = new System.Drawing.Point(155, 6); this.txtServer.Name = "txtServer"; - this.txtServer.Size = new System.Drawing.Size(140, 20); + this.txtServer.Size = new System.Drawing.Size(108, 20); this.txtServer.TabIndex = 1; this.txtServer.Text = "irc.freenode.net"; this.txtServer.Validated += new System.EventHandler(this.txtServer_Validated); @@ -151,7 +156,7 @@ // label4 // this.label4.AutoSize = true; - this.label4.Location = new System.Drawing.Point(502, 9); + this.label4.Location = new System.Drawing.Point(449, 9); this.label4.Name = "label4"; this.label4.Size = new System.Drawing.Size(32, 13); this.label4.TabIndex = 0; @@ -160,7 +165,7 @@ // label3 // this.label3.AutoSize = true; - this.label3.Location = new System.Drawing.Point(400, 9); + this.label3.Location = new System.Drawing.Point(347, 9); this.label3.Name = "label3"; this.label3.Size = new System.Drawing.Size(29, 13); this.label3.TabIndex = 0; @@ -169,7 +174,7 @@ // label2 // this.label2.AutoSize = true; - this.label2.Location = new System.Drawing.Point(301, 9); + this.label2.Location = new System.Drawing.Point(269, 9); this.label2.Name = "label2"; this.label2.Size = new System.Drawing.Size(26, 13); this.label2.TabIndex = 0; @@ -199,7 +204,7 @@ // scChat // this.scChat.Dock = System.Windows.Forms.DockStyle.Fill; - this.scChat.Location = new System.Drawing.Point(0, 30); + this.scChat.Location = new System.Drawing.Point(0, 32); this.scChat.Name = "scChat"; // // scChat.Panel1 @@ -210,8 +215,8 @@ // this.scChat.Panel2.Controls.Add(this.Participants); this.scChat.Panel2.Enabled = false; - this.scChat.Size = new System.Drawing.Size(705, 350); - this.scChat.SplitterDistance = 533; + this.scChat.Size = new System.Drawing.Size(754, 365); + this.scChat.SplitterDistance = 569; this.scChat.TabIndex = 2; // // rtbChatText @@ -222,7 +227,7 @@ this.rtbChatText.Location = new System.Drawing.Point(0, 0); this.rtbChatText.Name = "rtbChatText"; this.rtbChatText.ReadOnly = true; - this.rtbChatText.Size = new System.Drawing.Size(533, 350); + this.rtbChatText.Size = new System.Drawing.Size(569, 365); this.rtbChatText.TabIndex = 4; this.rtbChatText.Text = ""; // @@ -235,12 +240,30 @@ this.Participants.MultiSelect = false; this.Participants.Name = "Participants"; this.Participants.ShowGroups = false; - this.Participants.Size = new System.Drawing.Size(168, 350); + this.Participants.Size = new System.Drawing.Size(181, 365); this.Participants.Sorting = System.Windows.Forms.SortOrder.Ascending; this.Participants.TabIndex = 5; this.Participants.UseCompatibleStateImageBehavior = false; this.Participants.View = System.Windows.Forms.View.List; // + // label5 + // + this.label5.AutoSize = true; + this.label5.Location = new System.Drawing.Point(573, 9); + this.label5.Name = "label5"; + this.label5.Size = new System.Drawing.Size(41, 13); + this.label5.TabIndex = 13; + this.label5.Text = "Source"; + // + // cbSource + // + this.cbSource.FormattingEnabled = true; + this.cbSource.Location = new System.Drawing.Point(620, 6); + this.cbSource.Name = "cbSource"; + this.cbSource.Size = new System.Drawing.Size(121, 21); + this.cbSource.TabIndex = 14; + this.cbSource.SelectionChangeCommitted += new System.EventHandler(this.cbSource_SelectionChangeCommitted); + // // RelayConsole // this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 13F); @@ -249,7 +272,7 @@ this.Controls.Add(this.pnlConnectionSettings); this.Controls.Add(this.pnlChatLine); this.Name = "RelayConsole"; - this.Size = new System.Drawing.Size(705, 407); + this.Size = new System.Drawing.Size(754, 424); this.pnlChatLine.ResumeLayout(false); this.pnlChatLine.PerformLayout(); this.pnlConnectionSettings.ResumeLayout(false); @@ -281,5 +304,7 @@ private System.Windows.Forms.TextBox txtChan; private System.Windows.Forms.Label label4; private System.Windows.Forms.Button btnDisconnect; + private System.Windows.Forms.ComboBox cbSource; + private System.Windows.Forms.Label label5; } } diff --git a/plugins/Radegast.Plugin.IRC/RelayConsole.cs b/plugins/Radegast.Plugin.IRC/RelayConsole.cs index 1a6f21e..42b6715 100644 --- a/plugins/Radegast.Plugin.IRC/RelayConsole.cs +++ b/plugins/Radegast.Plugin.IRC/RelayConsole.cs @@ -38,27 +38,73 @@ using System.Threading; using System.Windows.Forms; using Meebey.SmartIrc4net; using OpenMetaverse; +using OpenMetaverse.Packets; using OpenMetaverse.StructuredData; namespace Radegast.Plugin.IRC { public partial class RelayConsole : RadegastTabControl { + enum RelaySourceType + { + Unknown, + Group, + Conference, + Chat, + IM + } + + class RelaySource + { + public RelaySource(string name, RelaySourceType sourcetype, UUID sessionId) + { + Name = name; + SourceType = sourcetype; + SessionId = sessionId; + } + + public override string ToString() + { + return Name; + } + + public static bool operator ==(RelaySource left, RelaySource right) + { + if (ReferenceEquals(left, right)) + return true; + + if (ReferenceEquals(left, null) || ReferenceEquals(right, null)) + return false; + + return left.Name == right.Name && left.SessionId == right.SessionId && left.SourceType == right.SourceType; + } + + public static bool operator !=(RelaySource left, RelaySource right) + { + return !(left == right); + } + + public string Name; + public RelaySourceType SourceType; + public UUID SessionId; + } + public IrcClient irc; TabsConsole TC { get { return instance.TabConsole; } } RichTextBoxPrinter textPrinter; private List chatHistory = new List(); private int chatPointer; - volatile bool connecting = false; - UUID relayGroup; + volatile bool connecting; public OSDMap config; + RelaySource currentSource; + public RelayConsole(RadegastInstance instance) : base(instance) { InitializeComponent(); - Disposed += new EventHandler(RelayConsole_Disposed); + Disposed += RelayConsole_Disposed; textPrinter = new RichTextBoxPrinter(rtbChatText); @@ -79,33 +125,19 @@ namespace Radegast.Plugin.IRC } if (!config.ContainsKey("server")) - { config["server"] = new OSDString("irc.freenode.net"); - } if (!config.ContainsKey("port")) - { config["port"] = new OSDInteger(6667); - } if (!config.ContainsKey("nick")) - { config["nick"] = new OSDString(instance.Client.Self.Name); - } if (!config.ContainsKey("channel")) - { config["channel"] = new OSDString("#"); - } if (!config.ContainsKey("send_delay")) - { config["send_delay"] = new OSDInteger(200); - } if (!config.ContainsKey("auto_reconnect")) - { config["auto_reconnect"] = new OSDBoolean(true); - } if (!config.ContainsKey("ctcp_version")) - { config["ctcp_version"] = new OSDString("Radegast IRC"); - } txtChan.Text = config["channel"].AsString(); txtNick.Text = config["nick"].AsString(); @@ -118,15 +150,16 @@ namespace Radegast.Plugin.IRC irc.CtcpVersion = config["ctcp_version"].AsString(); irc.Encoding = Encoding.UTF8; - TC.OnTabAdded += new TabsConsole.TabCallback(TC_OnTabAdded); - TC.OnTabRemoved += new TabsConsole.TabCallback(TC_OnTabRemoved); - irc.OnError += new ErrorEventHandler(irc_OnError); - irc.OnRawMessage += new IrcEventHandler(irc_OnRawMessage); - irc.OnChannelMessage += new IrcEventHandler(irc_OnChannelMessage); - irc.OnConnected += new EventHandler(irc_OnConnected); - irc.OnDisconnected += new EventHandler(irc_OnDisconnected); + TC.OnTabAdded += TC_OnTabAdded; + TC.OnTabRemoved += TC_OnTabRemoved; + irc.OnError += irc_OnError; + irc.OnRawMessage += irc_OnRawMessage; + irc.OnChannelMessage += irc_OnChannelMessage; + irc.OnConnected += irc_OnConnected; + irc.OnDisconnected += irc_OnDisconnected; - client.Self.IM += new EventHandler(Self_IM); + client.Self.IM += Self_IM; + client.Self.ChatFromSimulator += Self_ChatFromSimulator; UpdateGui(); @@ -135,16 +168,17 @@ namespace Radegast.Plugin.IRC void RelayConsole_Disposed(object sender, EventArgs e) { - client.Self.IM -= new EventHandler(Self_IM); + client.Self.ChatFromSimulator -= Self_ChatFromSimulator; + client.Self.IM -= Self_IM; - TC.OnTabAdded -= new TabsConsole.TabCallback(TC_OnTabAdded); - TC.OnTabRemoved -= new TabsConsole.TabCallback(TC_OnTabRemoved); + TC.OnTabAdded -= TC_OnTabAdded; + TC.OnTabRemoved -= TC_OnTabRemoved; - irc.OnError -= new ErrorEventHandler(irc_OnError); - irc.OnRawMessage -= new IrcEventHandler(irc_OnRawMessage); - irc.OnChannelMessage -= new IrcEventHandler(irc_OnChannelMessage); - irc.OnConnected -= new EventHandler(irc_OnConnected); - irc.OnDisconnected -= new EventHandler(irc_OnDisconnected); + irc.OnError -= irc_OnError; + irc.OnRawMessage -= irc_OnRawMessage; + irc.OnChannelMessage -= irc_OnChannelMessage; + irc.OnConnected -= irc_OnConnected; + irc.OnDisconnected -= irc_OnDisconnected; instance.GlobalSettings.Save(); @@ -162,8 +196,13 @@ namespace Radegast.Plugin.IRC void TC_OnTabAdded(object sender, TabEventArgs e) { - if (e.Tab.Control is GroupIMTabWindow) + if (e.Tab.Control is GroupIMTabWindow || + e.Tab.Control is ConferenceIMTabWindow || + e.Tab.Control is IMTabWindow || + e.Tab.Control is ChatConsole) + { RefreshGroups(); + } } void RefreshGroups() @@ -175,40 +214,48 @@ namespace Radegast.Plugin.IRC return; } - /* - ddGroup.DropDownItems.Clear(); + cbSource.Items.Clear(); bool foundActive = false; foreach (var tab in TC.Tabs) { - if (!(tab.Value.Control is GroupIMTabWindow)) continue; + RelaySourceType sourcetype = RelaySourceType.Unknown; + RelaySource newSource; + + if (tab.Value.Control is GroupIMTabWindow) + sourcetype = RelaySourceType.Group; + else if (tab.Value.Control is ConferenceIMTabWindow) + sourcetype = RelaySourceType.Conference; + else if (tab.Value.Control is IMTabWindow) + sourcetype = RelaySourceType.IM; + else if (tab.Value.Control is ChatConsole) + sourcetype = RelaySourceType.Chat; + else + continue; + + UUID sessionId = UUID.Zero; + UUID.TryParse(tab.Key, out sessionId); - UUID session = new UUID(tab.Key); - if (session == relayGroup) + if (sessionId == UUID.Zero && sourcetype != RelaySourceType.Chat) + continue; + + newSource = new RelaySource(sourcetype + ": " + tab.Value.Label, sourcetype, sessionId); + + if (sourcetype == RelaySourceType.IM) + newSource.SessionId = (tab.Value.Control as IMTabWindow).TargetId; + + if (newSource == currentSource) foundActive = true; - ToolStripButton item = new ToolStripButton(instance.Groups[session].Name, null, groupSelect, session.ToString()); - ddGroup.DropDownItems.Add(item); + cbSource.Items.Add(newSource); } if (!foundActive) { - relayGroup = UUID.Zero; - ddGroup.Text = "Groups (none)"; + currentSource = null; + cbSource.Text = "None"; } - */ - } - - void groupSelect(object sender, EventArgs e) - { - /* - if (sender is ToolStripButton) - { - UUID session = new UUID(((ToolStripButton)sender).Name); - relayGroup = session; - ddGroup.Text = string.Format("Groups ({0})", instance.Groups[session].Name); - }*/ } private void PrintMsg(string fromName, string message) @@ -216,9 +263,7 @@ namespace Radegast.Plugin.IRC if (InvokeRequired) { if (IsHandleCreated) - { BeginInvoke(new MethodInvoker(() => PrintMsg(fromName, message))); - } return; } @@ -262,6 +307,9 @@ namespace Radegast.Plugin.IRC return; } + if (IsDisposed) + return; + bool isConnectedOrConnecting = connecting || irc.IsConnected; btnSend.Enabled = isConnectedOrConnecting; @@ -314,9 +362,8 @@ namespace Radegast.Plugin.IRC } if (irc.IsConnected) - { irc.Disconnect(); - } + UpdateGui(); } @@ -340,7 +387,7 @@ namespace Radegast.Plugin.IRC try { - Thread IRCConnection = new Thread(new ParameterizedThreadStart(IrcThread)); + Thread IRCConnection = new Thread(IrcThread); IRCConnection.Name = "IRC Thread"; IRCConnection.IsBackground = true; int port = 6667; @@ -350,9 +397,8 @@ namespace Radegast.Plugin.IRC catch (Exception ex) { if (irc.IsConnected) - { irc.Disconnect(); - } + PrintMsg("System", "Failed: " + ex.Message); connecting = false; @@ -371,7 +417,9 @@ namespace Radegast.Plugin.IRC void irc_OnRawMessage(object sender, IrcEventArgs e) { - if (e.Data.Type == ReceiveType.Unknown || e.Data.Type == ReceiveType.ChannelMessage) return; + if (e.Data.Type == ReceiveType.Unknown || e.Data.Type == ReceiveType.ChannelMessage) + return; + PrintMsg(e.Data.Nick, e.Data.Type + ": " + e.Data.Message); } @@ -409,46 +457,101 @@ namespace Radegast.Plugin.IRC ThreadPool.QueueUserWorkItem(sync => { PrintMsg(e.Data.Nick, e.Data.Message); - if (relayGroup != UUID.Zero) + if (currentSource != null) { - client.Self.InstantMessageGroup(relayGroup, string.Format("(irc:{2}) {0}: {1}", e.Data.Nick, e.Data.Message, e.Data.Channel)); + string message = string.Format("(irc:{2}) {0}: {1}", e.Data.Nick, e.Data.Message, e.Data.Channel); + + switch (currentSource.SourceType) + { + case RelaySourceType.Group: + case RelaySourceType.Conference: + client.Self.InstantMessageGroup(currentSource.SessionId, message); + break; + case RelaySourceType.Chat: + client.Self.Chat(message, 0, ChatType.Normal); + break; + case RelaySourceType.IM: + client.Self.InstantMessage(currentSource.SessionId, message); + break; + } } } ); } - void Self_IM(object sender, InstantMessageEventArgs e) + private void ProcessMessage(string message, string from) { - if (e.IM.IMSessionID == relayGroup && irc.IsConnected && e.IM.FromAgentID != client.Self.AgentID) + string[] lines = Regex.Split(message, "\n+"); + + for (int l = 0; l < lines.Length; l++) { - string[] lines = Regex.Split(e.IM.Message, "\n+"); + string[] words = lines[l].Split(' '); + string outstr = string.Empty; - for (int l = 0; l < lines.Length; l++) + for (int i = 0; i < words.Length; i++) { - - string[] words = lines[l].Split(' '); - string outstr = string.Empty; - - for (int i = 0; i < words.Length; i++) + outstr += words[i] + " "; + if (outstr.Length > 380) { - outstr += words[i] + " "; - if (outstr.Length > 380) - { - PrintMsg(irc.Nickname, string.Format("{0}: {1}", e.IM.FromAgentName, outstr.Remove(outstr.Length - 1))); - irc.SendMessage(SendType.Message, txtChan.Text, string.Format("{0}: {1}", e.IM.FromAgentName, outstr.Remove(outstr.Length - 1))); - outstr = string.Empty; - } + PrintMsg(irc.Nickname, string.Format("{0}: {1}", from, outstr.Remove(outstr.Length - 1))); + irc.SendMessage(SendType.Message, txtChan.Text, string.Format("{0}: {1}", from, outstr.Remove(outstr.Length - 1))); + outstr = string.Empty; } - PrintMsg(irc.Nickname, string.Format("{0}: {1}", e.IM.FromAgentName, outstr.Remove(outstr.Length - 1))); - irc.SendMessage(SendType.Message, txtChan.Text, string.Format("{0}: {1}", e.IM.FromAgentName, outstr.Remove(outstr.Length - 1))); } + PrintMsg(irc.Nickname, string.Format("{0}: {1}", from, outstr.Remove(outstr.Length - 1))); + irc.SendMessage(SendType.Message, txtChan.Text, string.Format("{0}: {1}", from, outstr.Remove(outstr.Length - 1))); } } + void Self_ChatFromSimulator(object sender, ChatEventArgs e) + { + if (currentSource == null || currentSource.SourceType != RelaySourceType.Chat) + return; + + if (e.SourceID == client.Self.AgentID) + { + if (e.Message.StartsWith("(irc:")) + return; + } + + if (e.Type == ChatType.Normal || e.Type == ChatType.Shout || e.Type == ChatType.Whisper) + ProcessMessage(e.Message, e.FromName); + } + + void Self_IM(object sender, InstantMessageEventArgs e) + { + if (currentSource == null) + return; + + if (!irc.IsConnected) + return; + + if (e.IM.FromAgentID == client.Self.AgentID) + return; + + if (e.IM.Dialog == InstantMessageDialog.MessageFromAgent || e.IM.Dialog == InstantMessageDialog.MessageFromObject) + { + if (e.IM.FromAgentID != currentSource.SessionId) + return; + } + else if (e.IM.Dialog == InstantMessageDialog.SessionSend) + { + if (e.IM.IMSessionID != currentSource.SessionId) + return; + } + else + { + return; + } + + ProcessMessage(e.IM.Message, e.IM.FromAgentName); + } + void SendMsg() { string msg = cbxInput.Text; - if (msg == string.Empty) return; + if (msg == string.Empty) + return; chatHistory.Add(cbxInput.Text); chatPointer = chatHistory.Count; @@ -463,7 +566,9 @@ namespace Radegast.Plugin.IRC void ChatHistoryPrev() { - if (chatPointer == 0) return; + if (chatPointer == 0) + return; + chatPointer--; if (chatHistory.Count > chatPointer) { @@ -475,7 +580,9 @@ namespace Radegast.Plugin.IRC void ChatHistoryNext() { - if (chatPointer == chatHistory.Count) return; + if (chatPointer == chatHistory.Count) + return; + chatPointer++; if (chatPointer == chatHistory.Count) { @@ -542,5 +649,10 @@ namespace Radegast.Plugin.IRC { e.Handled = !char.IsNumber(e.KeyChar); } + + private void cbSource_SelectionChangeCommitted(object sender, EventArgs e) + { + currentSource = cbSource.SelectedItem as RelaySource; + } } } -- 2.11.0