KittehOrg / KittehIRCClientLib

An IRC client library in Java
https://kitteh.dev/kicl/
MIT License
146 stars 35 forks source link

The length of the message is too short. #293

Closed R3ALW1NNER closed 3 years ago

R3ALW1NNER commented 3 years ago
    private void sendRawLine(@NonNull String message, boolean priority, boolean avoidDuplicates) {
        Sanity.safeMessageCheck(message);
        if (!message.isEmpty() && (message.length() > **((message.charAt(0) == '@') ? 1022 : 510))**) {
            throw new IllegalArgumentException("Message too long: " + message.length());
        }
        synchronized (this.messageSendingLock) {
            if (priority) {
                this.messageSendingImmediate.queue(message);
            } else if (!avoidDuplicates || !this.messageSendingScheduled.contains(message)) {
                this.messageSendingScheduled.queue(message);
            }
        }
    }

The message is too short to be sent. I think it would be better to have an option to adjust the length.

The incoming message is also 4KB. The transmission message should also be at least 4KB.

mbax commented 3 years ago

Hello! Thanks for this report. I wanted to write a reply before I get the chance to really dive into it, but I'm leaving the notification left unread so I hopefully don't forget this before the weekend.

Definitely seems to be too short, but I'm not sure 4kb is actually the client to server limit, because servers can additionally send server-originating tags while the client only can send client tags. I'll go dig out that spec later and patch it in 😁

mbax commented 3 years ago

Reference: https://ircv3.net/specs/extensions/message-tags#size-limit

Updating to allow outgoing messages matching these limits. This will first see release in 7.4.0

https://github.com/KittehOrg/KittehIRCClientLib/commit/37a7b48d0115361ad3af3f052d8aa8609a2bde29

Thanks again for creating the issue 😄

mbax commented 3 years ago

As a follow-up, 7.4.0 is now released and published on maven central though it might take a bit for caches to see it there.

R3ALW1NNER commented 3 years ago

Thank you for your prompt attention!