예제 #1
0
        /// <summary>
        /// Set or unset modes for a channel.
        /// </summary>
        /// <param name="channel">The channel on which to set modes.</param>
        /// <param name="modes">The list modes to set or unset.</param>
        public void Mode(string channel, IEnumerable <IrcChannelMode> modes)
        {
            if (!modes.Any())
            {
                this.Send("MODE", new IrcTarget(channel));
                return;
            }

            var enumerator = modes.GetEnumerator();
            var modeChunk  = new List <IrcChannelMode>();
            int i          = 0;

            while (enumerator.MoveNext())
            {
                modeChunk.Add(enumerator.Current);
                if (++i == 3)
                {
                    this.Send("MODE", new IrcTarget(channel), IrcChannelMode.RenderModes(modeChunk));
                    modeChunk.Clear();
                    i = 0;
                }
            }
            if (modeChunk.Count > 0)
            {
                this.Send("MODE", new IrcTarget(channel), IrcChannelMode.RenderModes(modeChunk));
            }
        }
예제 #2
0
 internal IrcChannelModeEventArgs(IrcMessage message)
     : base(message)
 {
     this.Who     = message.From as IrcPeer;
     this.Channel = message.Parameters.Count > 0 ? new IrcTarget(message.Parameters[0]) : null;
     this.Modes   = message.Parameters.Count > 1 ? IrcChannelMode.ParseModes(message.Parameters.Skip(1)) : null;
 }
예제 #3
0
 /// <summary>
 /// Set or unset modes for a channel.
 /// </summary>
 /// <param name="channel">The channel on which to set modes.</param>
 /// <param name="modeSpec">The mode specification in the format +/-[modes] [parameters].</param>
 /// <remarks>
 /// Examples of the modeSpec parameter:
 ///   +nst
 ///   +i-ns
 ///   -i+l 500
 ///   +bb [email protected] [email protected]
 /// </remarks>
 public void Mode(string channel, string modeSpec)
 {
     this.Mode(channel, IrcChannelMode.ParseModes(modeSpec));
 }