Skip to content

Commit f48efd6

Browse files
committed
Additional block length limitations on actions
1 parent 9da94c7 commit f48efd6

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/client.js

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -451,10 +451,16 @@ IrcClient.prototype.action = function(target, message) {
451451
// Maximum length of target + message we can send to the IRC server is 500 characters
452452
// but we need to leave extra room for the sender prefix so the entire message can
453453
// be sent from the IRCd to the target without being truncated.
454-
var blocks = truncateString(message, this.options.message_max_length);
454+
455+
// The block length here is the max, but without the non-content characters:
456+
// the command name, the space, and the two SOH chars
457+
458+
var commandName = 'ACTION';
459+
var blockLength = this.options.message_max_length - (commandName.length + 3);
460+
var blocks = truncateString(message, blockLength);
455461

456462
blocks.forEach(function(block) {
457-
that.ctcpRequest(target, 'ACTION', block);
463+
that.ctcpRequest(target, commandName, block);
458464
});
459465

460466
return blocks;

0 commit comments

Comments
 (0)