Browse Source

fix(core): Fix misuse of toxcore tox_file_send API

pull/5352/head
Mick Sayson 7 years ago
parent
commit
f988177a9b
  1. 7
      src/core/corefile.cpp

7
src/core/corefile.cpp

@ -123,10 +123,11 @@ void CoreFile::sendFile(Core* core, uint32_t friendId, QString filename, QString @@ -123,10 +123,11 @@ void CoreFile::sendFile(Core* core, uint32_t friendId, QString filename, QString
QMutexLocker mlocker(&fileSendMutex);
QByteArray fileName = filename.toUtf8();
TOX_ERR_FILE_SEND sendErr;
uint32_t fileNum = tox_file_send(core->tox.get(), friendId, TOX_FILE_KIND_DATA, filesize,
nullptr, (uint8_t*)fileName.data(), fileName.size(), nullptr);
if (fileNum == std::numeric_limits<uint32_t>::max()) {
qWarning() << "sendFile: Can't create the Tox file sender";
nullptr, (uint8_t*)fileName.data(), fileName.size(), &sendErr);
if (sendErr != TOX_ERR_FILE_SEND_OK) {
qWarning() << "sendFile: Can't create the Tox file sender (" << sendErr << ")";
emit core->fileSendFailed(friendId, filename);
return;
}

Loading…
Cancel
Save