1
0
mirror of https://github.com/deavmi/birchwood synced 2024-09-20 13:22:52 +02:00
- Fixed compilation error by adding missing `encodeMessage(string)` call
- If the encoded message (CRLF included) is over 512 bytes then throw an exception

Exceptions

- Added new `ErrorType` enum member
This commit is contained in:
Tristan B. Velloza Kildaire 2023-03-15 08:24:56 +02:00
parent 256369abc5
commit 11dbd1a96f
2 changed files with 14 additions and 4 deletions

View File

@ -652,11 +652,20 @@ public class Client : Thread
private void sendMessage(Message message)
{
/* Encode the message */
ubyte[] encodedMessage = message.encode();
ubyte[] encodedMessage = encodeMessage(message.encode());
/* If the message is 512 bytes or less then send */
if(encodedMessage.length <= 512)
{
/* Enqueue the message to the send queue */
sender.sq(encodedMessage);
}
/* If above then throw an exception */
else
{
throw new BirchwoodException(BirchwoodException.ErrorType.COMMAND_TOO_LONG);
}
}
/**
* Disconnect from the IRC server gracefully

View File

@ -13,7 +13,8 @@ public class BirchwoodException : Exception
EMPTY_PARAMS,
INVALID_CHANNEL_NAME,
INVALID_NICK_NAME,
ILLEGAL_CHARACTERS
ILLEGAL_CHARACTERS,
COMMAND_TOO_LONG
}
private ErrorType errType;