1
0
mirror of https://github.com/deavmi/birchwood synced 2024-09-20 11:22:53 +02:00

Merge branch 'master' into bugfix/shutdown

This commit is contained in:
Tristan B. Velloza Kildaire 2023-06-28 08:34:06 +02:00
commit 725672dfa7

View File

@ -427,14 +427,24 @@ public class Client : Thread
* *
* Params: * Params:
* channel = the channel to leave * channel = the channel to leave
* Throws:
* `BirchwoodException` if the channel name
* is invalid
*/ */
public void leaveChannel(string channel) public void leaveChannel(string channel)
{ {
// TODO: Add check for valid and non-empty channel names /* Ensure the channel name contains only valid characters */
if(isValidText(channel))
/* Leave the channel */ {
Message leaveMessage = new Message("", "PART", channel); /* Leave the channel */
sendMessage(leaveMessage); 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 else
{ {
//TODO: Invalid channel name
throw new BirchwoodException(ErrorType.INVALID_CHANNEL_NAME); throw new BirchwoodException(ErrorType.INVALID_CHANNEL_NAME);
} }
} }
else else
{ {
//TODO: Illegal characters
throw new BirchwoodException(ErrorType.ILLEGAL_CHARACTERS); throw new BirchwoodException(ErrorType.ILLEGAL_CHARACTERS);
} }
} }