diff --git a/source/birchwood/client/client.d b/source/birchwood/client/client.d index 01e53d1..f8c0d82 100644 --- a/source/birchwood/client/client.d +++ b/source/birchwood/client/client.d @@ -427,14 +427,24 @@ public class Client : Thread * * Params: * channel = the channel to leave + * Throws: + * `BirchwoodException` if the channel name + * is invalid */ public void leaveChannel(string channel) { - // TODO: Add check for valid and non-empty channel names - - /* Leave the channel */ - Message leaveMessage = new Message("", "PART", channel); - sendMessage(leaveMessage); + /* Ensure the channel name contains only valid characters */ + if(isValidText(channel)) + { + /* Leave the channel */ + Message leaveMessage = new Message("", "PART", channel); + sendMessage(leaveMessage); + } + /* If invalid characters were present */ + else + { + throw new BirchwoodException(ErrorType.ILLEGAL_CHARACTERS); + } } /** @@ -645,13 +655,11 @@ public class Client : Thread } else { - //TODO: Invalid channel name throw new BirchwoodException(ErrorType.INVALID_CHANNEL_NAME); } } else { - //TODO: Illegal characters throw new BirchwoodException(ErrorType.ILLEGAL_CHARACTERS); } }