2 Channels names are strings (beginning with a '&' or '#' character) of
3 length up to 200 characters. Apart from the the requirement that the
4 first character being either '&' or '#'; the only restriction on a
5 channel name is that it may not contain any spaces (' '), a control G
6 (^G or ASCII 7), or a comma (',' which is used as a list item
7 separator by the protocol).
10 using System.Collections;
12 namespace TechBot.IRCLibrary
17 public enum IrcChannelType
29 public class IrcChannel
31 #region Private fields
33 private IrcClient owner;
35 private IrcChannelType type = IrcChannelType.Public;
36 private ArrayList users = new ArrayList();
40 #region Public properties
43 /// Owner of this channel.
45 public IrcClient Owner
54 /// Name of channel (no leading #).
67 public IrcChannelType Type
76 /// Users in this channel.
78 public ArrayList Users
91 /// <param name="owner">Owner of this channel.</param>
92 /// <param name="name">Name of channel.</param>
93 public IrcChannel(IrcClient owner, string name)
97 throw new ArgumentNullException("owner", "Owner cannot be null.");
101 throw new ArgumentNullException("name", "Name cannot be null.");
110 /// <param name="nickname">Nickname of user (no decorations).</param>
111 /// <returns>User or null if not found.</returns>
112 public IrcUser LocateUser(string nickname)
114 foreach (IrcUser user in Users)
116 /* FIXME: There are special cases for nickname comparison */
117 if (nickname.ToLower().Equals(user.Nickname.ToLower()))
126 /// Talk to the channel.
128 /// <param name="text">Text to send to the channel.</param>
129 public void Talk(string text)
131 owner.SendMessage(new IrcMessage(IRC.PRIVMSG,
132 String.Format("#{0} :{1}",