From 2041c4ed0d7d0dfc7a4035451e5d12c1fd45c6aa Mon Sep 17 00:00:00 2001 From: Alexander Lantsev Date: Fri, 15 May 2015 19:35:37 +0000 Subject: Dropbox: fixed contact status git-svn-id: http://svn.miranda-ng.org/main/trunk@13608 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Dropbox/src/dropbox.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) (limited to 'plugins') diff --git a/plugins/Dropbox/src/dropbox.cpp b/plugins/Dropbox/src/dropbox.cpp index a370c7e559..9ef7f27a64 100644 --- a/plugins/Dropbox/src/dropbox.cpp +++ b/plugins/Dropbox/src/dropbox.cpp @@ -47,13 +47,11 @@ MCONTACT CDropbox::GetDefaultContact() db_set_s(NULL, MODULE, "Nick", MODULE); db_set_s(hDefaultContact, MODULE, "Nick", MODULE); db_set_ws(hDefaultContact, "CList", "MyHandle", L"Dropbox"); - - int status = db_get_w(hDefaultContact, MODULE, "Status", ID_STATUS_OFFLINE); - if (HasAccessToken() && status == ID_STATUS_OFFLINE) - db_set_w(hDefaultContact, MODULE, "Status", ID_STATUS_ONLINE); } } + db_set_w(hDefaultContact, MODULE, "Status", HasAccessToken() ? ID_STATUS_ONLINE : ID_STATUS_OFFLINE); + return hDefaultContact; } @@ -139,7 +137,7 @@ void CDropbox::DestroyAccessToken() db_unset(NULL, MODULE, "TokenSecret"); MCONTACT hContact = CDropbox::GetDefaultContact(); if (hContact) - if (db_get_w(hContact, MODULE, "Status", ID_STATUS_ONLINE) == ID_STATUS_ONLINE) + if (db_get_w(hContact, MODULE, "Status", ID_STATUS_ONLINE) != ID_STATUS_OFFLINE) db_set_w(hContact, MODULE, "Status", ID_STATUS_OFFLINE); ProtoBroadcastAck(MODULE, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)ID_STATUS_ONLINE, (WPARAM)ID_STATUS_OFFLINE); @@ -194,7 +192,7 @@ UINT CDropbox::RequestAccessTokenAsync(void *owner, void *param) MCONTACT hContact = instance->GetDefaultContact(); if (hContact) { - if (db_get_w(hContact, MODULE, "Status", ID_STATUS_OFFLINE) == ID_STATUS_OFFLINE) + if (db_get_w(hContact, MODULE, "Status", ID_STATUS_OFFLINE) != ID_STATUS_ONLINE) db_set_w(hContact, MODULE, "Status", ID_STATUS_ONLINE); } -- cgit v1.2.3