mIRC Homepage

Incoming message length

Posted By: drum

Incoming message length - 09/07/20 04:08 AM

Hello! Long time no post! wink

I have been using mIRC to connect to Twitch's IRC chatbot interface and have noticed that mIRC will truncate incoming messages that are longer than 1025 bytes -- which includes any IRCv3 message tags that are present. Twitch in some cases can send messages that are longer than this since they use message tags to store a lot of metadata.

I was looking over the IRCv3 message tags spec ( https://ircv3.net/specs/extensions/message-tags ) and noticed that it says the following:

The size limit for message tags is 8191 bytes, including the leading '@' (0x40) and trailing space ' ' (0x20) characters. The size limit for the rest of the message remains unchanged at 512 bytes.

Is there a particular reason that incoming messages are being truncated at 1025 bytes? Could the limit be raised? I understand a supported message length greater than $maxlenl would probably be a bad idea, but could it perhaps be raised to something like 4096? Would that cause any issues?

Posted By: Khaled

Re: Incoming message length - 09/07/20 11:45 AM

Thanks for your bug report. I have not been able to reproduce this issue so far.

Can you provide an example that reproduces this issue?

Your example would need to be a step by step method that I can follow to cause a server to send mIRC a line longer than 1024 characters.

Alternatively, you can simulate incoming messages using /parseline, for example:

test {
  var %text = A long line of text
  echo text len: $len(%text)
  parseline -itqp :nick!user@host PRIVMSG $me : $+ %text
Posted By: drum

Re: Incoming message length - 10/07/20 01:22 AM

I wasn't able to reproduce the issue using /parseline either.

Here's how you can reproduce the issue on a fresh mIRC install:

alias start {
  server -f irc.chat.twitch.tv +6697 blah -i $+(justinfan,$rand(0,9),$rand(0,9),$rand(0,9),$rand(0,9),$rand(0,9),$rand(0,9))
  server -fm irc.chat.twitch.tv +6697 oauth:zbfeqk3n6tsyw60q7ssd40i1f0531r -i mirctest

on *:CONNECT:{
  if ($me != mirctest) {
    debug @debug
    raw CAP REQ :twitch.tv/tags
    join #mirctest

alias test { scon 2 msg #mirctest $str($+(<3,$chr(32)),130) }

alias test2 { scon 2 msg #mirctest $str($+(<3,$chr(32)),90) }

alias test3 { scon 2 msg #mirctest $str($+(<3,$chr(32)),40) }

  • Type /start to connect.
  • Type /test to receive a message that truncates in the middle of the message tags (doesn't even get to the PRIVMSG command).
  • Type /test2 to receive a message that truncates in the middle of the message text.
  • Type /test3 to receive a normal message (no truncation).

Note that this script uses an oauth token to authenticate to a Twitch account named mirctest (created exclusively for this purpose) so that it can send messages. The first connection can only receive messages.
Posted By: Khaled

Re: Incoming message length - 10/07/20 08:41 AM

Thanks for the test script. I have not tested it yet, however, is it possible that the server itself is not sending the full line?

If you type /debug on to enable debugging to a debug.log file, this will log incoming server lines, up to a maximum of $maxlenl length, which is currently 8192 characters.
Posted By: FroggieDaFrog

Re: Incoming message length - 10/07/20 11:28 AM

This is not the fault of mIRC; it is twitch chopping the message. You can produce the same results, drum using their websocket interface:

1. Open a new tab
2. hit f12
3. click the "network" tab
4. navigate to twitch.tv/mirctest
5. select the irc websocket in the network tab
6. send various sized messages and watch the return frames twitch sends back
Posted By: drum

Re: Incoming message length - 10/07/20 02:54 PM

I'm not seeing any chopped message on the browser side:

[Linked Image from i.imgur.com]

Notice that the highlighted message in blue is 1658 bytes in length. Here is the same message received by mIRC as viewed in a /debug window:

[Linked Image from i.imgur.com]

Notice in the /debug window, it chops after ",375-37" whereas this clearly keeps going in the browser version (seen at the bottom of the first image).

This message is the one generated by typing /test with the example script I gave.
Posted By: drum

Re: Incoming message length - 10/07/20 03:16 PM

I have confirmed that the server is sending the full line both with Wireshark and with the method Froggie just mentioned.
Posted By: Khaled

Re: Incoming message length - 10/07/20 04:59 PM

Thanks for the feedback and test script. I was able to reproduce the issue. This issue has been fixed for the next version.
Posted By: drum

Re: Incoming message length - 10/07/20 10:43 PM

Excellent, thank you!
© 2021 mIRC Discussion Forums