mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
fix(groups): reduce group message size limit by 50
This commit fixes errors when sending large group messages stemming from inconsistencies in reported/true max message size in c-toxcore Fixes #5760
This commit is contained in:
parent
9099eea04f
commit
6c77d57da8
|
@ -1450,7 +1450,17 @@ QStringList Core::splitMessage(const QString& message)
|
|||
QStringList splittedMsgs;
|
||||
QByteArray ba_message{message.toUtf8()};
|
||||
|
||||
const auto maxLen = tox_max_message_length();
|
||||
/*
|
||||
* TODO: Remove this hack; the reported max message length we receive from c-toxcore
|
||||
* as of 08-02-2019 is inaccurate, causing us to generate too large messages when splitting
|
||||
* them up.
|
||||
*
|
||||
* The inconsistency lies in c-toxcore group.c:2480 using MAX_GROUP_MESSAGE_DATA_LEN to verify
|
||||
* message size is within limit, but tox_max_message_length giving a different size limit to us.
|
||||
*
|
||||
* (uint32_t tox_max_message_length(void); declared in tox.h, unable to see explicit definition)
|
||||
*/
|
||||
const auto maxLen = tox_max_message_length() - 50;
|
||||
|
||||
while (ba_message.size() > maxLen) {
|
||||
int splitPos = ba_message.lastIndexOf('\n', maxLen - 1);
|
||||
|
|
Loading…
Reference in New Issue
Block a user