Ejemplo n.º 1
0
        private void ChannelModeHandler(object sender, EventArgs e)
        {
            ToolStripMenuItem item = sender as ToolStripMenuItem;
            ChannelMode       mode = item.Tag as ChannelMode;

            switch (mode.Letter)
            {
            case 'b':
                bans.Clear();
                ChannelMode("+b");
                break;

            case 'e':
                exempts.Clear();
                ChannelMode("+e");
                break;

            case 'I':
                invite.Clear();
                ChannelMode("+I");
                break;

            case 'k':
                if (!item.Checked)
                {
                    StringEnterDialog diag = new StringEnterDialog(Resources.SetPassword);
                    if (diag.ShowDialog() == DialogResult.OK && diag.PrintedText.Length > 0)
                    {
                        ChannelMode("+k", diag.PrintedText);
                    }
                }
                else
                {
                    ChannelMode("-k", this.password);
                }
                break;

            case 'l':
                if (!item.Checked)
                {
                    InputNumDialog diag = new InputNumDialog(Resources.EnterLimit);
                    if (diag.ShowDialog() == DialogResult.OK && diag.Value > 0)
                    {
                        ChannelMode("+l", diag.Value.ToString());
                    }
                }
                else
                {
                    ChannelMode("-l");
                }
                break;

            default:
                ChannelMode((!item.Checked ? "+" : "-") + mode.Letter);
                break;
            }
        }
Ejemplo n.º 2
0
        private void BanWords(object sender, EventArgs e)
        {
            IChannelUser[] toBan;
            lock (this.dgvUsers.SyncRoot)
            {
                toBan = this.dgvUsers.LVSelectedItems;
            }
            var diag = new StringEnterDialog(Resources.EnterWords);

            if (diag.ShowDialog() == DialogResult.OK)
            {
                string comment = diag.PrintedText;
                foreach (var user in toBan)
                {
                    MyCmd(this, String.Format("/MODE {0} +b {1} :{2}", this.winName, user.NickName, comment));
                }
            }
        }
Ejemplo n.º 3
0
        private void KickBanWords(object sender, EventArgs e)
        {
            if (MyCmd == null)
            {
                return;
            }

            var toBan = this.dgvUsers.LVSelectedItems;

            using (var diag = new StringEnterDialog(Resources.EnterWords))
            {
                if (diag.ShowDialog() == DialogResult.OK)
                {
                    string comment = diag.PrintedText;
                    foreach (var user in toBan)
                    {
                        MyCmd(this, String.Format("/KICK {0} {1} :{2}", this.winName, user.NickName, comment));
                        MyCmd(this, String.Format("/MODE {0} +b {1} :{2}", this.winName, user.NickName, comment));
                    }
                }
            }
        }