Ejemplo n.º 1
0
 /// <summary>
 /// Request a list of all nicknames on a given channel.
 /// </summary>
 /// <remarks>
 /// Possible Errors
 /// <list type="bullet">
 ///         <item><description>ERR_TOOMANYMATCHES</description></item>
 /// </list>
 /// </remarks>
 /// <param name="channels">One or more channel names.</param>
 /// <example><code>
 /// //Make the request for a single channel
 /// connection.Sender.Names( "#test" );
 /// //Make the request for several channels at once
 /// connection.Sender.Names( "#test","#alpha","#bravo" );
 /// </code></example>
 /// <exception cref="ArgumentException">If any of the channels are not valid.</exception>
 /// <seealso cref="Listener.OnNames"/>
 public void Names(params string[] channels)
 {
     lock (this)
     {
         if (Rfc2812Util.IsValidChannelList(channels))
         {
             Buffer.Append("NAMES");
             Buffer.Append(SPACE);
             Buffer.Append(String.Join(",", channels));
             if (TooLong(Buffer))
             {
                 ClearBuffer();
                 throw new ArgumentException("Channels are too long.");
             }
             Connection.SendCommand(Buffer);
         }
         else
         {
             ClearBuffer();
             throw new ArgumentException("One of the channel names is not valid.");
         }
     }
 }