mirror of
https://github.com/qTox/qTox.git
synced 2024-03-22 14:00:36 +08:00
cleanup
This commit is contained in:
parent
575cac1fc7
commit
76f7df3135
13
core.cpp
13
core.cpp
|
@ -296,7 +296,6 @@ void Core::onConnectionStatusChanged(Tox*/* tox*/, int friendId, uint8_t status,
|
|||
{
|
||||
if (f.friendId == friendId && f.status == ToxFile::TRANSMITTING)
|
||||
{
|
||||
qDebug() << "friendId: set broken";
|
||||
f.status = ToxFile::BROKEN;
|
||||
emit static_cast<Core*>(core)->fileTransferBrokenUnbroken(f, true);
|
||||
}
|
||||
|
@ -305,7 +304,6 @@ void Core::onConnectionStatusChanged(Tox*/* tox*/, int friendId, uint8_t status,
|
|||
{
|
||||
if (f.friendId == friendId && f.status == ToxFile::TRANSMITTING)
|
||||
{
|
||||
qDebug() << "friendId: set broken";
|
||||
f.status = ToxFile::BROKEN;
|
||||
emit static_cast<Core*>(core)->fileTransferBrokenUnbroken(f, true);
|
||||
}
|
||||
|
@ -315,7 +313,8 @@ void Core::onConnectionStatusChanged(Tox*/* tox*/, int friendId, uint8_t status,
|
|||
{
|
||||
if (f.friendId == friendId && f.status == ToxFile::BROKEN)
|
||||
{
|
||||
tox_file_send_control(static_cast<Core*>(core)->tox, friendId, 1, f.fileNum, TOX_FILECONTROL_RESUME_BROKEN, (const uint8_t*)(&f.bytesSent), sizeof(uint64_t));
|
||||
qDebug() << QString("Core::onConnectionStatusChanged: %1: resuming broken filetransfer from position: %2").arg(f.file->fileName()).arg(f.bytesSent);
|
||||
tox_file_send_control(static_cast<Core*>(core)->tox, friendId, 1, f.fileNum, TOX_FILECONTROL_RESUME_BROKEN, reinterpret_cast<const uint8_t*>(&f.bytesSent), sizeof(uint64_t));
|
||||
emit static_cast<Core*>(core)->fileTransferBrokenUnbroken(f, false);
|
||||
}
|
||||
}
|
||||
|
@ -356,7 +355,7 @@ void Core::onFileSendRequestCallback(Tox*, int32_t friendnumber, uint8_t filenum
|
|||
emit static_cast<Core*>(core)->fileReceiveRequested(fileRecvQueue.last());
|
||||
}
|
||||
void Core::onFileControlCallback(Tox* tox, int32_t friendnumber, uint8_t receive_send, uint8_t filenumber,
|
||||
uint8_t control_type, const uint8_t* data, uint16_t, void *core)
|
||||
uint8_t control_type, const uint8_t* data, uint16_t length, void *core)
|
||||
{
|
||||
ToxFile* file{nullptr};
|
||||
if (receive_send == 1)
|
||||
|
@ -451,8 +450,12 @@ void Core::onFileControlCallback(Tox* tox, int32_t friendnumber, uint8_t receive
|
|||
}
|
||||
else if (receive_send == 1 && control_type == TOX_FILECONTROL_RESUME_BROKEN)
|
||||
{
|
||||
if (length != sizeof(uint64_t))
|
||||
return;
|
||||
|
||||
qDebug() << "Core::onFileControlCallback: TOX_FILECONTROL_RESUME_BROKEN";
|
||||
uint64_t resumePos = *(const uint64_t*)(data);
|
||||
|
||||
uint64_t resumePos = *reinterpret_cast<const uint64_t*>(data);
|
||||
|
||||
if (resumePos >= file->filesize)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue
Block a user