Closed pranomostro closed 7 years ago
toxcore doesn't accept messages with a length of 0. echo
actually writes 1 char: \n
. It is thus a 1 char message for ratox. For each message sent, we trim the trailing \n
, then send the message. In this special case, an initial message which is 1 byte long gets sent as being 0 byte long, triggering the error. We need to perform the lenght check AFTER trimming the line feed in sendfriendtext(). This should be an easy fix.
The following patch fixes this issue by sending the \n
if it's alone. In this case we assume the user wanted to send a single line feed, for example is order to "clean" the screen or something like that.
It's only a proposal as such a behavior means we're treating a single \n
with a special meaning, which might not be a wanted behavior. In such a case, the fix would be totally differnet.
We can use IRC or tox or whatever, I know you don't like github.
I think we should add the special behaviour for \n
, because I would like it to behave
similar to IRC, where an \n
is valid.
Applied your patch.