void iparse_oKickEvent(object sender, KickEventArgs e) { TreeNode thisTN = null; ChanMessageList cml; if (e.KickedNick == tbNick.Text) { foreach (TreeNode tnn in tvChans.Nodes) { if (tnn.Text == ircCore1.ServerName) { thisTN = tnn; } } if (ChannelList.TryGetValue(e.From, out cml)) { cml.IsJoined = false; cml.KickReason = e.KickerUser + " Kicked " + tbNick.Text + " -- " + e.Reason; } foreach (TreeNode tn2 in thisTN.Nodes) { if (tn2.Text == e.From) { tn2.ForeColor = Color.LightGray; } } } }
void iparse_JoinEvent(object sender, JoinEventArgs e) { ChanMessageList cml; place = 53; string scChannel = StripPND(e.Channel); if (!ChannelList.TryGetValue(scChannel, out cml)) { cml = new ChanMessageList(); ChannelList.Add(scChannel, cml); } cml.AddName(e); if (scChannel == selectedChannel) { lbChanUsers.Items.Clear(); lbChanUsers.BeginUpdate(); foreach (string s in cml.nicks) { lbChanUsers.Items.Add(s); } lbChanUsers.EndUpdate(); } }
void iparse_oModeEvent(object sender, ModeEventArgs e) { if (e.User != null && e.User.Nick != tbNick.Text) //this pertains to the client nick only { return; } ChanMessageList cml; if (ChannelList.TryGetValue(e.Channel, out cml)) { cml.Modes = e.Mode; } if (selectedChannel == e.Channel) { lblModes.Text = e.Mode; } }
void iparse_oPrivMsgEvent(object sender, PrivMsgEventArgs e) { ChanMessageList cml; List <string> nll = dc.GetNickList(); if (!nll.Contains(e.User.Nick.ToLower())) { return; //Return when no accepted nicks are found. We don't want private messages from users we don't know. } if (!ChannelList.TryGetValue("priv_=!" + e.User.Nick, out cml)) { cml = new ChanMessageList(); ChannelList.Add("priv_=!" + e.User.Nick, cml); } else { cml.AddPrivMsg(e); cml.LastUpdate = DateTime.Now; btnPrivMsg.Visible = true; } }
void iparse_oTopicEvent(object sendere, TopicEventArgs e) { //First get channel from channellist. //then set the topic. place = 5; ChanMessageList cml; string scChannel = StripPND(e.Channel); if (!ChannelList.TryGetValue(scChannel, out cml)) { cml = new ChanMessageList(); ChannelList.Add(scChannel, cml); } if (e.Topic.Length == 0) { cml.Topic = "Topic not set."; } else { cml.Topic = e.Topic; } cml.TopicUser = e.User; if (selectedChannel == scChannel) { if (e.User != null) { rtbTopic.Text = e.User.Nick + "\n"; } rtbTopic.Clear(); rtbTopic.AppendText(e.Topic); } //throw new NotImplementedException(); }
//IrcalBot ibot; private void icore_ProgressChanged(object sender, ProgressChangedEventArgs e) { place = -1; if (e.UserState is List <Message> ) { mList = (List <Message>)e.UserState; } else { return; } place = -2; try { int icnt = mList.Count; if (sbmc == null) { sbmc = new SBMessage(); } //if (ibot == null) // ibot = new IrcalBot(ircCore1); //ibot.pushmessage(mList); for (int i = 0; i < icnt; i++) { place = 49; m = (Message)mList[i]; place = 52; // //:[email protected] PRIVMSG #HamRadio :test //sbmc.SendSBM(m.message); if (m.message.Contains("PRIVMSG")) { place = 53; iparse.MainParser(m.message); PrivMsgEventArgs pme = iparse.pmargs; PrivMsgEventArgs nPME = new PrivMsgEventArgs(); pme.Copy(ref nPME); ChanMessageList cml; place = 54; string scChannel = StripPND(nPME.From); sbmc.SendSBM(m.message, scChannel); MessageQueue.Add(m.message); if (!ChannelList.TryGetValue(scChannel, out cml)) { cml = new ChanMessageList(); ChannelList.Add(nPME.From, cml); } if (ChannelList.TryGetValue(scChannel, out cml)) { cml.AddPrivMsg(nPME); if (!cml.nicks.Contains(nPME.User.Nick)) { cml.nicks.Add(nPME.User.Nick); } //Only add text to window if channel is selected. if (selectedChannel == scChannel.ToLower()) { AppendText(nPME, true); rtbTopic.SelectAll(); rtbTopic.SelectionAlignment = HorizontalAlignment.Right; ScrollToBottom(rtbBox); } oNotify.CheckName(nPME.User.Nick); oNotify.CheckChannel(ircCore1.ServerName, scChannel, nPME); cml.LastUpdate = DateTime.Now; } place = 88; } else { iparse.MainParser(m.message); if (!iparse.parsed) { string msg = m.message.Trim(); if (msg.Length > 0) { if (msg.StartsWith("PING")) { break; } rtbGeneral.AppendText(msg + retval); rtbGeneral.Select(rtbGeneral.Text.Length, 0); } } } //if (m.Direction == "parse") //{ // place = 71; // iparse.MainParser(m.message.Split(new char[] { ' ' })); //} } place = 72; mList.RemoveRange(0, mList.Count); place = 73; } catch (Exception ex) { rtbGeneral.AppendText("ERROR:place" + place.ToString() + ex.Message); // MessageBox.Show(ex.Message + " err: place = "+ place.ToString()); } }