示例#1
0
        void iparse_oForwardEvent(object sender, ForwardEventArgs e)
        {
            //Here we need to be careful because we are forwarding a channel that was supposedly joined.
            //so we need to remove the joined channel and modify it
            string source = StripPND(e.sourceChannel);
            string target = StripPND(e.targetChannel);

            if (!ChannelList.ContainsKey(source))
            {
                return;
            }
            if (ChannelList.ContainsKey(target)) //we only need to do this once.
            {
                return;
            }
            ChannelList.Remove(source);

            TreeNode thisTN = null;

            foreach (TreeNode tnn in tvChans.Nodes)
            {
                if (tnn.Text == ircCore1.ServerName)
                {
                    thisTN = tnn;
                }
            }
            TreeNode ttn = new TreeNode();

            ttn.Text = target;
            ChanMessageList cml = new ChanMessageList();

            ttn.Tag = cml;
            thisTN.Nodes.Add(ttn);
            ChannelList.Add(target, cml);

            foreach (TreeNode tn2 in thisTN.Nodes)
            {
                if (tn2.Text == source)
                {
                    tn2.Remove();
                }
            }
        }
示例#2
0
        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;
            }
        }
示例#3
0
        private void AddChannelList()
        {
            TreeNode thisTN = null;

            foreach (TreeNode tnn in tvChans.Nodes)
            {
                if (tnn.Text == ircCore1.ServerName)
                {
                    thisTN = tnn;
                }
            }
            if (thisTN == null)
            {
                return;
            }
            foreach (TreeNode chanNode in thisTN.Nodes)
            {
                ircCore1.SendRaw("JOIN #" + chanNode.Text);
                ChanMessageList cml = new ChanMessageList();
                cml.Channel = chanNode.Text;
                ChannelList.Add(chanNode.Text, cml);
            }
        }
示例#4
0
        void iparse_oNameCompleteEvent(object sender, NameReplyEventArgs e)
        {
            ChanMessageList cml;

            place = 52;
            string scChannel = StripPND(e.Channel);

            if (!ChannelList.TryGetValue(scChannel, out cml))
            {
                cml = new ChanMessageList();
                ChannelList.Add(scChannel, cml);
            }
            cml.AddNames(e);
            if (scChannel == selectedChannel)
            {
                lbChanUsers.Items.Clear();
                lbChanUsers.BeginUpdate();
                foreach (string s in cml.nicks)
                {
                    lbChanUsers.Items.Add(s);
                }
                lbChanUsers.EndUpdate();
            }
        }
示例#5
0
        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();
        }
示例#6
0
        //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());
            }
        }