Exemplo n.º 1
0
        private void Session_ChannelModeChanged(object sender, IrcChannelModeEventArgs e)
        {
            if (!this.IsServer && this.Target.Equals(e.Channel))
            {
                if (e.Who != null)
                {
                    this.Write("Mode", string.Format("{0} set mode: {1}", e.Who.Nickname,
                                                     string.Join(" ", IrcChannelMode.RenderModes(e.Modes))));

                    _channelModes = (from m in e.Modes.Where((newMode) => newMode.Parameter == null && newMode.Set).
                                     Select((newMode) => newMode.Mode).Union(_channelModes).Distinct()
                                     where !e.Modes.Any((newMode) => !newMode.Set && newMode.Mode == m)
                                     select m).ToArray();
                }
                else
                {
                    _channelModes = (from m in e.Modes
                                     where m.Set && m.Parameter == null
                                     select m.Mode).ToArray();
                }
                this.SetTitle();
                foreach (var mode in e.Modes)
                {
                    _nickList.ProcessMode(mode);
                }
            }
        }
Exemplo n.º 2
0
        public void ProcessMode(IrcChannelMode mode)
        {
            var mask = ChannelLevel.Normal;

            switch (mode.Mode)
            {
            case 'o':
                mask = ChannelLevel.Op;
                break;

            case 'h':
                mask = ChannelLevel.HalfOp;
                break;

            case 'v':
                mask = ChannelLevel.Voice;
                break;
            }

            if (mask != ChannelLevel.Normal && this.Contains(mode.Parameter))
            {
                var item = this[mode.Parameter];
                if (item != null)
                {
                    item.Level = mode.Set ? item.Level | mask : item.Level & ~mask;
                    var idx = this.IndexOf(item);
                    this.RefreshItem(idx);
                }
            }
        }
Exemplo n.º 3
0
        private void ProcessMode(IrcChannelMode mode)
        {
            var mask = ChannelLevel.Normal;

            switch (mode.Mode)
            {
            case 'o':
                mask = ChannelLevel.Op;
                break;

            case 'h':
                mask = ChannelLevel.HalfOp;
                break;

            case 'v':
                mask = ChannelLevel.Voice;
                break;
            }

            if (mask != ChannelLevel.Normal)
            {
                var cn = this.GetNick(mode.Parameter);
                if (cn != null)
                {
                    var level = mode.Set ? cn.Level | mask : cn.Level & ~mask;
                    this.AddNick(level, cn.Nickname);
                }
            }
        }
Exemplo n.º 4
0
        /*/ Constructors /*/

        /// <summary>
        /// Initializes a new instance of the <see cref="IrcChannelModeValue"/> class.
        /// </summary>
        /// <param name="mode">Channel mode.</param>
        /// <param name="value">Associated value.</param>
        public IrcChannelModeValue(IrcChannelMode mode, string?value)
        {
            this.Mode  = mode;
            this.Value = value;
        }