mirror of
https://github.com/deavmi/birchwood
synced 2024-09-20 15:02:53 +02:00
Client
- 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:
parent
256369abc5
commit
11dbd1a96f
@ -652,11 +652,20 @@ public class Client : Thread
|
|||||||
private void sendMessage(Message message)
|
private void sendMessage(Message message)
|
||||||
{
|
{
|
||||||
/* Encode the 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 */
|
/* Enqueue the message to the send queue */
|
||||||
sender.sq(encodedMessage);
|
sender.sq(encodedMessage);
|
||||||
}
|
}
|
||||||
|
/* If above then throw an exception */
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw new BirchwoodException(BirchwoodException.ErrorType.COMMAND_TOO_LONG);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Disconnect from the IRC server gracefully
|
* Disconnect from the IRC server gracefully
|
||||||
|
@ -13,7 +13,8 @@ public class BirchwoodException : Exception
|
|||||||
EMPTY_PARAMS,
|
EMPTY_PARAMS,
|
||||||
INVALID_CHANNEL_NAME,
|
INVALID_CHANNEL_NAME,
|
||||||
INVALID_NICK_NAME,
|
INVALID_NICK_NAME,
|
||||||
ILLEGAL_CHARACTERS
|
ILLEGAL_CHARACTERS,
|
||||||
|
COMMAND_TOO_LONG
|
||||||
}
|
}
|
||||||
|
|
||||||
private ErrorType errType;
|
private ErrorType errType;
|
||||||
|
Loading…
Reference in New Issue
Block a user