mIRC Home    About    Download    Register    News    Help

Print Thread
Messages split too short #269710 20/12/21 10:19 PM
Joined: Jan 2004
Posts: 1,653
maroon Offline OP
Hoopy frood
OP Offline
Hoopy frood
Joined: Jan 2004
Posts: 1,653
The 'split long messages' feature in options/irc/messages is much more aggressive than it needs to be, in that it splits messages that are nowhere near the length where they would need to be chopped in order to prevent them from getting truncated.

I know the length of a message starts at 512, but is immediately decreased by 2 because a $crlf need to be part of that 512, and a too-long string gets chopped short in order to have that trailing $crlf be characters 511 and 512. In addition to that, the raw message seen by everyone else looks like:

:sendernick!userid@hostname PRIVMSG #channelname :this is the message everyone sees

... so the max length of a channel message gets reduced by several dozen characters of overhead beyond the message everyone sees in channel. I created this /testmsglimit alias to verify that I can warn myself if I'm creating a message that's going to be long enough to fit without being chopped. I know it's not perfect since it doesn't support codepoints 128+ and wouldn't handle situations where a non-standard server allows the userid to be longer than 10, and in normal situations it's going to chop preceding a word instead of slicing it right down the middle.

//testmsglimit $left($str(1234567890,55),462) $+ x

In my test channel, with the 'split long messages' option not checked, the combination of my address and the length of the channelname resulted in being able to 'say' a string of 462 numbers and still having other people in channel being able to see the final 'x'. It works as long as the alias shows %tot not exceeding 510.

However, when I then checked the box for splitting long messages, and repeated the above command, then there was a long section of text which was chopped into a 2nd message. I had to change the 462 down to 402 in order to get a shorter message that would not be split in half.

The same thing happens in query windows as in channel messages. As long as 'split long messages' is not checked, my message is not chopped short if the alias doesn't show %tot being larger than 510. But as soon as I check that option, messages are split at much shorter lengths and lower values for %tot, somewhere around 60 below that 510.

When I tested the effect that 'split long message' has on a /notice, I discovered that those aren't being split into multiple messages by checking that option. I'm not sure it's a good idea to start splitting notices, partly because the aggressive short-split would cause problems.

Code
alias testmsglimit {
  var -s %overhead $calc(1+ $len($address($me,5)) +1 + $len(privmsg) +1 + $len($active) + 1 + 1)
  var -s %tot $len($1-) + %overhead
  if (%tot > 510) echo -a won't fit
  say $1-
}

Re: Messages split too short [Re: maroon] #269711 21/12/21 12:36 AM
Joined: Dec 2002
Posts: 5,034
Khaled Offline
Hoopy frood
Offline
Hoopy frood
Joined: Dec 2002
Posts: 5,034
Thanks for your bug report. This has indeed been discussed before. The current behaviour is by design and is necessarily conservative to take several factors into account regarding message length.