static public void JoinAction(Message message) { if (message.Nick == ContextCollection.Server.Client.Nickname) { ContextCollection.Add(new IrcChannel(message.ParamsArray[1])); } else { var ctx = ContextCollection.GetByName(message.ParamsArray[1]); if (ctx != null) { ((IrcChannel)ctx).Users.Add(message.Nick); ctx.WriteLine(RTF.ColourString(message.Nick + " (" + message.Ident + "@" + message.Host + ") has joined.", IrcColor.Orange)); Program.MainWindow.UpdateUsersList(); } } }
static public void CloseCommand(string _params) { if (ContextCollection.Current is IrcServer) { ContextCollection.Current.WriteLine("You cannot close the server context!"); } else { var ctxToClose = ContextCollection.Current; if (ctxToClose is IrcChannel) { PartCommand(ctxToClose.Name); } ContextCollection.Current = ContextCollection.Server; ContextCollection.Remove(ctxToClose); Program.MainWindow.UpdateContext(); } }
static public void PartAction(Message message) { if (message.Nick == ContextCollection.Server.Client.Nickname) { ContextCollection.Remove(ContextCollection.GetByName(message.ParamsArray[1])); } else { var ctx = ContextCollection.GetByName(message.ParamsArray[1]); if (ctx != null) { ((IrcChannel)ctx).Users.Remove(message.Nick); ctx.WriteLine(RTF.ColourString(message.Nick + " has left.", IrcColor.Orange)); Program.MainWindow.UpdateUsersList(); } } }
static public void QueryCommand(string _params) { Match m = Regex.Match(_params.Trim(), @"^([A-Za-z0-9_\-\[\]\\^{}|`]+)$"); if (m.Groups[1] == null || m.Groups[1].Value.Length == 0) { ContextCollection.Current.WriteLine("Usage: /query [<nickname>]"); return; } var ctx = ContextCollection.GetByName(m.Groups[1].Value); if (ctx == null) { IrcQuery query = new IrcQuery(m.Groups[1].Value); ContextCollection.Add(query); } else { ContextCollection.Current = ctx; Program.MainWindow.UpdateContext(); } }
private void eChannelsList_SelectedIndexChanged(object sender, EventArgs e) { ContextCollection.Current = ContextCollection.GetByIndex(eChannelsList.SelectedIndex); UpdateContext(); ActiveControl = eTextInput; }