summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authoraunsane <aunsane@gmail.com>2018-03-25 21:19:17 +0300
committeraunsane <aunsane@gmail.com>2018-03-25 21:19:34 +0300
commit5f47c26a8581305abe9b4d9cda646f9f0dc09805 (patch)
tree3dc20dbb3118101d3c5792680e985b2a78d9d4d8 /plugins
parent3583f79d974d805aa67ba8b1feb49a4974c2e4cd (diff)
CloudFile: show error if authorization goes wrong
Diffstat (limited to 'plugins')
-rw-r--r--plugins/CloudFile/src/Services/dropbox_service.cpp12
-rw-r--r--plugins/CloudFile/src/Services/google_service.cpp11
-rw-r--r--plugins/CloudFile/src/Services/microsoft_service.cpp11
-rw-r--r--plugins/CloudFile/src/Services/yandex_service.cpp11
4 files changed, 28 insertions, 17 deletions
diff --git a/plugins/CloudFile/src/Services/dropbox_service.cpp b/plugins/CloudFile/src/Services/dropbox_service.cpp
index 4e308e1612..a9c902e13a 100644
--- a/plugins/CloudFile/src/Services/dropbox_service.cpp
+++ b/plugins/CloudFile/src/Services/dropbox_service.cpp
@@ -65,28 +65,30 @@ unsigned CDropboxService::RequestAccessTokenThread(void *owner, void *param)
if (response == nullptr || response->resultCode != HTTP_CODE_OK) {
Netlib_Logf(service->m_hConnection, "%s: %s", service->GetAccountName(), service->HttpStatusToError());
- //ShowNotification(TranslateT("server does not respond"), MB_ICONERROR);
+ ShowNotification(TranslateT("Server does not respond"), MB_ICONERROR);
+ EndDialog(hwndDlg, 0);
return 0;
}
JSONNode root = JSONNode::parse(response->pData);
if (root.empty()) {
Netlib_Logf(service->m_hConnection, "%s: %s", service->GetAccountName(), service->HttpStatusToError(response->resultCode));
- //ShowNotification((wchar_t*)error_description, MB_ICONERROR);
+ ShowNotification(TranslateT("Server does not respond"), MB_ICONERROR);
+ EndDialog(hwndDlg, 0);
return 0;
}
JSONNode node = root.at("error_description");
if (!node.isnull()) {
- ptrW error_description(mir_a2u_cp(node.as_string().c_str(), CP_UTF8));
+ CMStringW error_description = node.as_mstring();
Netlib_Logf(service->m_hConnection, "%s: %s", service->GetAccountName(), service->HttpStatusToError(response->resultCode));
- //ShowNotification((wchar_t*)error_description, MB_ICONERROR);
+ ShowNotification(error_description, MB_ICONERROR);
+ EndDialog(hwndDlg, 0);
return 0;
}
node = root.at("access_token");
db_set_s(NULL, service->GetAccountName(), "TokenSecret", node.as_string().c_str());
- //ProtoBroadcastAck(MODULE, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)ID_STATUS_OFFLINE, (WPARAM)ID_STATUS_ONLINE);
SetDlgItemTextA(hwndDlg, IDC_OAUTH_CODE, "");
diff --git a/plugins/CloudFile/src/Services/google_service.cpp b/plugins/CloudFile/src/Services/google_service.cpp
index 42c08b6cc8..6a40d3ec46 100644
--- a/plugins/CloudFile/src/Services/google_service.cpp
+++ b/plugins/CloudFile/src/Services/google_service.cpp
@@ -90,22 +90,25 @@ unsigned CGDriveService::RequestAccessTokenThread(void *owner, void *param)
: service->HttpStatusToError(response ? response->resultCode : 0);
Netlib_Logf(service->m_hConnection, "%s: %s", service->GetAccountName(), error);
- //ShowNotification(TranslateT("server does not respond"), MB_ICONERROR);
+ ShowNotification(TranslateT("Server does not respond"), MB_ICONERROR);
+ EndDialog(hwndDlg, 0);
return 0;
}
JSONNode root = JSONNode::parse(response->pData);
if (root.empty()) {
Netlib_Logf(service->m_hConnection, "%s: %s", service->GetAccountName(), service->HttpStatusToError(response->resultCode));
- //ShowNotification(TranslateT("server does not respond"), MB_ICONERROR);
+ ShowNotification(TranslateT("Server does not respond"), MB_ICONERROR);
+ EndDialog(hwndDlg, 0);
return 0;
}
JSONNode node = root.at("error_description");
if (!node.isnull()) {
- ptrW error_description(mir_a2u_cp(node.as_string().c_str(), CP_UTF8));
+ CMStringW error_description = node.as_mstring();
Netlib_Logf(service->m_hConnection, "%s: %s", service->GetAccountName(), service->HttpStatusToError(response->resultCode));
- //ShowNotification((wchar_t*)error_description, MB_ICONERROR);
+ ShowNotification(error_description, MB_ICONERROR);
+ EndDialog(hwndDlg, 0);
return 0;
}
diff --git a/plugins/CloudFile/src/Services/microsoft_service.cpp b/plugins/CloudFile/src/Services/microsoft_service.cpp
index 94892d7a41..3f5ebeab4d 100644
--- a/plugins/CloudFile/src/Services/microsoft_service.cpp
+++ b/plugins/CloudFile/src/Services/microsoft_service.cpp
@@ -91,22 +91,25 @@ unsigned COneDriveService::RequestAccessTokenThread(void *owner, void *param)
: service->HttpStatusToError(response->resultCode);
Netlib_Logf(service->m_hConnection, "%s: %s", service->GetAccountName(), error);
- //ShowNotification(TranslateT("server does not respond"), MB_ICONERROR);
+ ShowNotification(TranslateT("Server does not respond"), MB_ICONERROR);
+ EndDialog(hwndDlg, 0);
return 0;
}
JSONNode root = JSONNode::parse(response->pData);
if (root.empty()) {
Netlib_Logf(service->m_hConnection, "%s: %s", service->GetAccountName(), service->HttpStatusToError(response->resultCode));
- //ShowNotification(TranslateT("server does not respond"), MB_ICONERROR);
+ ShowNotification(TranslateT("Server does not respond"), MB_ICONERROR);
+ EndDialog(hwndDlg, 0);
return 0;
}
JSONNode node = root.at("error_description");
if (!node.isnull()) {
- ptrW error_description(mir_a2u_cp(node.as_string().c_str(), CP_UTF8));
+ CMStringW error_description = node.as_mstring();
Netlib_Logf(service->m_hConnection, "%s: %s", service->GetAccountName(), service->HttpStatusToError(response->resultCode));
- //ShowNotification((wchar_t*)error_description, MB_ICONERROR);
+ ShowNotification(error_description, MB_ICONERROR);
+ EndDialog(hwndDlg, 0);
return 0;
}
diff --git a/plugins/CloudFile/src/Services/yandex_service.cpp b/plugins/CloudFile/src/Services/yandex_service.cpp
index 6e471d18f9..97ce0eda46 100644
--- a/plugins/CloudFile/src/Services/yandex_service.cpp
+++ b/plugins/CloudFile/src/Services/yandex_service.cpp
@@ -93,22 +93,25 @@ unsigned CYandexService::RequestAccessTokenThread(void *owner, void *param)
: service->HttpStatusToError(response->resultCode);
Netlib_Logf(service->m_hConnection, "%s: %s", service->GetAccountName(), error);
- //ShowNotification(TranslateT("server does not respond"), MB_ICONERROR);
+ ShowNotification(TranslateT("Server does not respond"), MB_ICONERROR);
+ EndDialog(hwndDlg, 0);
return 0;
}
JSONNode root = JSONNode::parse(response->pData);
if (root.empty()) {
Netlib_Logf(service->m_hConnection, "%s: %s", service->GetAccountName(), service->HttpStatusToError(response->resultCode));
- //ShowNotification(TranslateT("server does not respond"), MB_ICONERROR);
+ ShowNotification(TranslateT("Server does not respond"), MB_ICONERROR);
+ EndDialog(hwndDlg, 0);
return 0;
}
JSONNode node = root.at("error_description");
if (!node.isnull()) {
- ptrW error_description(mir_a2u_cp(node.as_string().c_str(), CP_UTF8));
+ CMStringW error_description = node.as_mstring();
Netlib_Logf(service->m_hConnection, "%s: %s", service->GetAccountName(), service->HttpStatusToError(response->resultCode));
- //ShowNotification((wchar_t*)error_description, MB_ICONERROR);
+ ShowNotification(error_description, MB_ICONERROR);
+ EndDialog(hwndDlg, 0);
return 0;
}