Skip to content
This repository has been archived by the owner on Feb 12, 2023. It is now read-only.

Commit

Permalink
fix(core): Ignore online connection status
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
Diadlo committed Mar 8, 2017
1 parent 9c48245 commit ea50eaa
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions src/core/core.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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*>(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*>(core)->friendStatusChanged(friendId, friendStatus);
static_cast<Core*>(core)->checkLastOnline(friendId);
CoreFile::onConnectionStatusChanged(static_cast<Core*>(core), friendId,
friendStatus != Status::Offline);
CoreFile::onConnectionStatusChanged(static_cast<Core*>(core), friendId,
friendStatus != Status::Offline);
}
}

void Core::onGroupInvite(Tox*, uint32_t friendId, TOX_CONFERENCE_TYPE type, const uint8_t* data,
Expand Down

0 comments on commit ea50eaa

Please sign in to comment.