Add support for channel keys

Closes #57
This commit is contained in:
Benjamin Moir 2017-10-05 19:39:42 -03:00 committed by Alexandre Oliveira
parent d1424ba162
commit f380779eba
1 changed files with 8 additions and 3 deletions

View File

@ -74,11 +74,16 @@ namespace ChatSharp
/// <summary>
/// Joins the specified channel.
/// </summary>
public void JoinChannel(string channel)
public void JoinChannel(string channel, string key = null)
{
if (Channels.Contains(channel))
throw new InvalidOperationException("Client is not already present in channel.");
SendRawMessage("JOIN {0}", channel);
throw new InvalidOperationException("Client is already present in channel.");
string joinCmd = string.Format("JOIN {0}", channel);
if (!string.IsNullOrEmpty(key))
joinCmd += string.Format(" {0}", key);
SendRawMessage(joinCmd, channel);
}
/// <summary>