1
0
mirror of https://github.com/qTox/qTox.git synced 2024-03-22 14:00:36 +08:00

Signal broken file transfers

This commit is contained in:
tux3 2015-04-25 17:12:49 +02:00
parent c6e60c4c77
commit cdb2bad7c3
No known key found for this signature in database
GPG Key ID: 7E086DD661263264
3 changed files with 14 additions and 0 deletions

View File

@ -484,6 +484,7 @@ void Core::onConnectionStatusChanged(Tox*/* tox*/, uint32_t friendId, TOX_CONNEC
emit static_cast<Core*>(core)->friendStatusChanged(friendId, friendStatus);
if (friendStatus == Status::Offline)
static_cast<Core*>(core)->checkLastOnline(friendId);
CoreFile::onConnectionStatusChanged(static_cast<Core*>(core), friendId, friendStatus != Status::Offline);
}
void Core::onGroupAction(Tox*, int groupnumber, int peernumber, const uint8_t *action, uint16_t length, void* _core)

View File

@ -389,3 +389,15 @@ void CoreFile::onFileRecvChunkCallback(Tox *tox, uint32_t friendId, uint32_t fil
if (file->fileKind != TOX_FILE_KIND_AVATAR)
emit static_cast<Core*>(core)->fileTransferInfo(*file);
}
void CoreFile::onConnectionStatusChanged(Core* core, uint32_t friendId, bool online)
{
ToxFile::FileStatus status = online ? ToxFile::TRANSMITTING : ToxFile::BROKEN;
for (uint64_t key : fileMap.keys())
{
if (key>>32 != friendId)
continue;
fileMap[key].status = status;
emit core->fileTransferBrokenUnbroken(fileMap[key], !online);
}
}

View File

@ -46,6 +46,7 @@ private:
uint64_t pos, size_t length, void *core);
static void onFileRecvChunkCallback(Tox *tox, uint32_t friendId, uint32_t fileId, uint64_t position,
const uint8_t *data, size_t length, void *core);
static void onConnectionStatusChanged(Core* core, uint32_t friendId, bool online);
private:
static QMutex fileSendMutex;