From ea50eaaef742141ec2023050d5d1ee8719583333 Mon Sep 17 00:00:00 2001 From: Diadlo Date: Sun, 26 Feb 2017 02:34:03 +0300 Subject: [PATCH] fix(core): Ignore online connection status Fix #4010. qTox use status system, where offline is one of the status, but toxcore use two different meaning: 'connection' and 'user status'. To correct qTox status handling we should ignore online connection status. --- src/core/core.cpp | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/core/core.cpp b/src/core/core.cpp index fb22391c3..d2d7d7583 100644 --- a/src/core/core.cpp +++ b/src/core/core.cpp @@ -475,11 +475,13 @@ void Core::onUserStatusChanged(Tox* /* tox*/, uint32_t friendId, TOX_USER_STATUS void Core::onConnectionStatusChanged(Tox* /* tox*/, uint32_t friendId, TOX_CONNECTION status, void* core) { Status friendStatus = status != TOX_CONNECTION_NONE ? Status::Online : Status::Offline; - emit static_cast(core)->friendStatusChanged(friendId, friendStatus); - if (friendStatus == Status::Offline) + // Ignore Online because it will be emited from onUserStatusChanged + if (friendStatus == Status::Offline) { + emit static_cast(core)->friendStatusChanged(friendId, friendStatus); static_cast(core)->checkLastOnline(friendId); - CoreFile::onConnectionStatusChanged(static_cast(core), friendId, - friendStatus != Status::Offline); + CoreFile::onConnectionStatusChanged(static_cast(core), friendId, + friendStatus != Status::Offline); + } } void Core::onGroupInvite(Tox*, uint32_t friendId, TOX_CONFERENCE_TYPE type, const uint8_t* data,