diff options
Diffstat (limited to 'protocols/CloudFile')
28 files changed, 185 insertions, 213 deletions
diff --git a/protocols/CloudFile/CloudFile.vcxproj.filters b/protocols/CloudFile/CloudFile.vcxproj.filters index 4f60203086..eb32aef869 100644 --- a/protocols/CloudFile/CloudFile.vcxproj.filters +++ b/protocols/CloudFile/CloudFile.vcxproj.filters @@ -59,30 +59,6 @@ </ClCompile> </ItemGroup> <ItemGroup> - <ClInclude Include="src\Services\dropbox_api.h"> - <Filter>Header Files</Filter> - </ClInclude> - <ClInclude Include="src\Services\dropbox_service.h"> - <Filter>Header Files</Filter> - </ClInclude> - <ClInclude Include="src\Services\google_api.h"> - <Filter>Header Files</Filter> - </ClInclude> - <ClInclude Include="src\Services\google_service.h"> - <Filter>Header Files</Filter> - </ClInclude> - <ClInclude Include="src\Services\microsoft_api.h"> - <Filter>Header Files</Filter> - </ClInclude> - <ClInclude Include="src\Services\microsoft_service.h"> - <Filter>Header Files</Filter> - </ClInclude> - <ClInclude Include="src\Services\yandex_api.h"> - <Filter>Header Files</Filter> - </ClInclude> - <ClInclude Include="src\Services\yandex_service.h"> - <Filter>Header Files</Filter> - </ClInclude> <ClInclude Include="src\stdafx.h"> <Filter>Header Files</Filter> </ClInclude> @@ -107,6 +83,30 @@ <ClInclude Include="src\resource.h"> <Filter>Header Files</Filter> </ClInclude> + <ClInclude Include="src\Services\dropbox_service.h"> + <Filter>Header Files\Services</Filter> + </ClInclude> + <ClInclude Include="src\Services\dropbox_api.h"> + <Filter>Header Files\Services</Filter> + </ClInclude> + <ClInclude Include="src\Services\google_service.h"> + <Filter>Header Files\Services</Filter> + </ClInclude> + <ClInclude Include="src\Services\google_api.h"> + <Filter>Header Files\Services</Filter> + </ClInclude> + <ClInclude Include="src\Services\microsoft_api.h"> + <Filter>Header Files\Services</Filter> + </ClInclude> + <ClInclude Include="src\Services\microsoft_service.h"> + <Filter>Header Files\Services</Filter> + </ClInclude> + <ClInclude Include="src\Services\yandex_service.h"> + <Filter>Header Files\Services</Filter> + </ClInclude> + <ClInclude Include="src\Services\yandex_api.h"> + <Filter>Header Files\Services</Filter> + </ClInclude> </ItemGroup> <ItemGroup> <ResourceCompile Include="res\resource.rc"> diff --git a/protocols/CloudFile/res/dropbox.ico b/protocols/CloudFile/res/dropbox.ico Binary files differindex 8a286d7f32..09d2721244 100644 --- a/protocols/CloudFile/res/dropbox.ico +++ b/protocols/CloudFile/res/dropbox.ico diff --git a/protocols/CloudFile/res/gdrive.ico b/protocols/CloudFile/res/gdrive.ico Binary files differindex a34123e95b..3655f72583 100644 --- a/protocols/CloudFile/res/gdrive.ico +++ b/protocols/CloudFile/res/gdrive.ico diff --git a/protocols/CloudFile/res/onedrive.ico b/protocols/CloudFile/res/onedrive.ico Binary files differindex 502cee9bb7..94c8ab8240 100644 --- a/protocols/CloudFile/res/onedrive.ico +++ b/protocols/CloudFile/res/onedrive.ico diff --git a/protocols/CloudFile/res/upload.ico b/protocols/CloudFile/res/upload.ico Binary files differindex b51e87ed35..09f224a20e 100644 --- a/protocols/CloudFile/res/upload.ico +++ b/protocols/CloudFile/res/upload.ico diff --git a/protocols/CloudFile/res/yadisk.ico b/protocols/CloudFile/res/yadisk.ico Binary files differindex b3a5ac69b4..31d802c51f 100644 --- a/protocols/CloudFile/res/yadisk.ico +++ b/protocols/CloudFile/res/yadisk.ico diff --git a/protocols/CloudFile/src/Services/dropbox_service.cpp b/protocols/CloudFile/src/Services/dropbox_service.cpp index 92b00fc493..3bcefc8c77 100644 --- a/protocols/CloudFile/src/Services/dropbox_service.cpp +++ b/protocols/CloudFile/src/Services/dropbox_service.cpp @@ -23,16 +23,7 @@ CDropboxService::CDropboxService(const char *protoName, const wchar_t *userName) PROTO_INTERFACE* CDropboxService::Init(const char *moduleName, const wchar_t *userName) { - CDropboxService *proto = new CDropboxService(moduleName, userName); - Services.insert(proto); - return proto; -} - -int CDropboxService::UnInit(PROTO_INTERFACE *proto) -{ - Services.remove((CDropboxService *)proto); - delete proto; - return 0; + return new CDropboxService(moduleName, userName); } const char* CDropboxService::GetModuleName() const @@ -76,10 +67,10 @@ void CDropboxService::RequestAccessTokenThread(void *param) GetDlgItemTextA(hwndDlg, IDC_OAUTH_CODE, requestToken, _countof(requestToken)); DropboxAPI::GetAccessTokenRequest request(requestToken); - NLHR_PTR response(request.Send(m_hConnection)); + NLHR_PTR response(request.Send(m_hNetlibUser)); if (response == nullptr || response->resultCode != HTTP_CODE_OK) { - Netlib_Logf(m_hConnection, "%s: %s", GetAccountName(), HttpStatusToError()); + Netlib_Logf(m_hNetlibUser, "%s: %s", m_szModuleName, HttpStatusToError()); ShowNotification(TranslateT("Server does not respond"), MB_ICONERROR); EndDialog(hwndDlg, 0); return; @@ -87,7 +78,7 @@ void CDropboxService::RequestAccessTokenThread(void *param) JSONNode root = JSONNode::parse(response->body); if (root.empty()) { - Netlib_Logf(m_hConnection, "%s: %s", GetAccountName(), HttpStatusToError(response->resultCode)); + Netlib_Logf(m_hNetlibUser, "%s: %s", m_szModuleName, HttpStatusToError(response->resultCode)); ShowNotification(TranslateT("Server does not respond"), MB_ICONERROR); EndDialog(hwndDlg, 0); return; @@ -96,14 +87,14 @@ void CDropboxService::RequestAccessTokenThread(void *param) JSONNode node = root.at("error_description"); if (!node.isnull()) { CMStringW error_description = node.as_mstring(); - Netlib_Logf(m_hConnection, "%s: %s", GetAccountName(), HttpStatusToError(response->resultCode)); + Netlib_Logf(m_hNetlibUser, "%s: %s", m_szModuleName, HttpStatusToError(response->resultCode)); ShowNotification(error_description, MB_ICONERROR); EndDialog(hwndDlg, 0); return; } node = root.at("access_token"); - db_set_s(0, GetAccountName(), "TokenSecret", node.as_string().c_str()); + db_set_s(0, m_szModuleName, "TokenSecret", node.as_string().c_str()); SetDlgItemTextA(hwndDlg, IDC_OAUTH_CODE, ""); @@ -114,7 +105,7 @@ void CDropboxService::RevokeAccessTokenThread(void *) { ptrA token(getStringA("TokenSecret")); DropboxAPI::RevokeAccessTokenRequest request(token); - NLHR_PTR response(request.Send(m_hConnection)); + NLHR_PTR response(request.Send(m_hNetlibUser)); delSetting("ExpiresIn"); delSetting("TokenSecret"); @@ -135,7 +126,7 @@ auto CDropboxService::UploadFile(const char *data, size_t size, const std::strin ptrA token(getStringA("TokenSecret")); uint8_t strategy = g_plugin.getByte("ConflictStrategy", OnConflict::REPLACE); DropboxAPI::UploadFileRequest request(token, path.c_str(), data, size, (OnConflict)strategy); - NLHR_PTR response(request.Send(m_hConnection)); + NLHR_PTR response(request.Send(m_hNetlibUser)); JSONNode root = GetJsonResponse(response); return root["path_lower"].as_string(); @@ -145,7 +136,7 @@ auto CDropboxService::CreateUploadSession(const char *chunk, size_t chunkSize) { ptrA token(getStringA("TokenSecret")); DropboxAPI::CreateUploadSessionRequest request(token, chunk, chunkSize); - NLHR_PTR response(request.Send(m_hConnection)); + NLHR_PTR response(request.Send(m_hNetlibUser)); JSONNode root = GetJsonResponse(response); return root["session_id"].as_string(); @@ -155,7 +146,7 @@ void CDropboxService::UploadFileChunk(const std::string &sessionId, const char * { ptrA token(getStringA("TokenSecret")); DropboxAPI::UploadFileChunkRequest request(token, sessionId.c_str(), offset, chunk, chunkSize); - NLHR_PTR response(request.Send(m_hConnection)); + NLHR_PTR response(request.Send(m_hNetlibUser)); HandleHttpError(response); } @@ -164,7 +155,7 @@ auto CDropboxService::CommitUploadSession(const std::string &sessionId, const ch ptrA token(getStringA("TokenSecret")); uint8_t strategy = g_plugin.getByte("ConflictStrategy", OnConflict::REPLACE); DropboxAPI::CommitUploadSessionRequest request(token, sessionId.c_str(), offset, path.c_str(), data, size, (OnConflict)strategy); - NLHR_PTR response(request.Send(m_hConnection)); + NLHR_PTR response(request.Send(m_hNetlibUser)); JSONNode root = GetJsonResponse(response); return root["path_lower"].as_string(); @@ -174,7 +165,7 @@ void CDropboxService::CreateFolder(const std::string &path) { ptrA token(getStringA("TokenSecret")); DropboxAPI::CreateFolderRequest request(token, path.c_str()); - NLHR_PTR response(request.Send(m_hConnection)); + NLHR_PTR response(request.Send(m_hNetlibUser)); if (response == nullptr) throw Exception(HttpStatusToError()); @@ -196,7 +187,7 @@ auto CDropboxService::CreateSharedLink(const std::string &path) { ptrA token(getStringA("TokenSecret")); DropboxAPI::CreateSharedLinkRequest shareRequest(token, path.c_str()); - NLHR_PTR response(shareRequest.Send(m_hConnection)); + NLHR_PTR response(shareRequest.Send(m_hNetlibUser)); if (response && HTTP_CODE_SUCCESS(response->resultCode)) { JSONNode root = GetJsonResponse(response); @@ -221,7 +212,7 @@ auto CDropboxService::CreateSharedLink(const std::string &path) throw Exception(tag.c_str()); DropboxAPI::GetSharedLinkRequest getRequest(token, path.c_str()); - response = getRequest.Send(m_hConnection); + response = getRequest.Send(m_hNetlibUser); root = GetJsonResponse(response); diff --git a/protocols/CloudFile/src/Services/dropbox_service.h b/protocols/CloudFile/src/Services/dropbox_service.h index 5166a9c17c..61b04f357c 100644 --- a/protocols/CloudFile/src/Services/dropbox_service.h +++ b/protocols/CloudFile/src/Services/dropbox_service.h @@ -22,7 +22,6 @@ public: CDropboxService(const char *protoName, const wchar_t *userName); static PROTO_INTERFACE* Init(const char *szModuleName, const wchar_t *szUserName); - static int UnInit(PROTO_INTERFACE *); const char* GetModuleName() const override; diff --git a/protocols/CloudFile/src/Services/google_service.cpp b/protocols/CloudFile/src/Services/google_service.cpp index fea2c3b2b4..2da3212b88 100644 --- a/protocols/CloudFile/src/Services/google_service.cpp +++ b/protocols/CloudFile/src/Services/google_service.cpp @@ -24,16 +24,7 @@ CGDriveService::CGDriveService(const char *protoName, const wchar_t *userName) : PROTO_INTERFACE* CGDriveService::Init(const char *moduleName, const wchar_t *userName) { - CGDriveService *proto = new CGDriveService(moduleName, userName); - Services.insert(proto); - return proto; -} - -int CGDriveService::UnInit(PROTO_INTERFACE *proto) -{ - Services.remove((CGDriveService*)proto); - delete proto; - return 0; + return new CGDriveService(moduleName, userName); } const char* CGDriveService::GetModuleName() const @@ -62,7 +53,7 @@ void CGDriveService::Login(HWND owner) ptrA refreshToken(getStringA("RefreshToken")); if (token && refreshToken && refreshToken[0]) { GDriveAPI::RefreshTokenRequest request(refreshToken); - NLHR_PTR response(request.Send(m_hConnection)); + NLHR_PTR response(request.Send(m_hNetlibUser)); JSONNode root = GetJsonResponse(response); @@ -97,14 +88,14 @@ void CGDriveService::RequestAccessTokenThread(void *param) GetDlgItemTextA(hwndDlg, IDC_OAUTH_CODE, requestToken, _countof(requestToken)); GDriveAPI::GetAccessTokenRequest request(requestToken); - NLHR_PTR response(request.Send(m_hConnection)); + NLHR_PTR response(request.Send(m_hNetlibUser)); if (response == nullptr || response->resultCode != HTTP_CODE_OK) { const char *error = response && response->body.GetLength() ? response->body : HttpStatusToError(response ? response->resultCode : 0); - Netlib_Logf(m_hConnection, "%s: %s", GetAccountName(), error); + Netlib_Logf(m_hNetlibUser, "%s: %s", m_szModuleName, error); ShowNotification(TranslateT("Server does not respond"), MB_ICONERROR); EndDialog(hwndDlg, 0); return; @@ -112,7 +103,7 @@ void CGDriveService::RequestAccessTokenThread(void *param) JSONNode root = JSONNode::parse(response->body); if (root.empty()) { - Netlib_Logf(m_hConnection, "%s: %s", GetAccountName(), HttpStatusToError(response->resultCode)); + Netlib_Logf(m_hNetlibUser, "%s: %s", m_szModuleName, HttpStatusToError(response->resultCode)); ShowNotification(TranslateT("Server does not respond"), MB_ICONERROR); EndDialog(hwndDlg, 0); return; @@ -121,21 +112,21 @@ void CGDriveService::RequestAccessTokenThread(void *param) JSONNode node = root.at("error_description"); if (!node.isnull()) { CMStringW error_description = node.as_mstring(); - Netlib_Logf(m_hConnection, "%s: %s", GetAccountName(), HttpStatusToError(response->resultCode)); + Netlib_Logf(m_hNetlibUser, "%s: %s", m_szModuleName, HttpStatusToError(response->resultCode)); ShowNotification(error_description, MB_ICONERROR); EndDialog(hwndDlg, 0); return; } node = root.at("access_token"); - db_set_s(0, GetAccountName(), "TokenSecret", node.as_string().c_str()); + db_set_s(0, m_szModuleName, "TokenSecret", node.as_string().c_str()); node = root.at("expires_in"); time_t expiresIn = time(0) + node.as_int(); - db_set_dw(0, GetAccountName(), "ExpiresIn", expiresIn); + db_set_dw(0, m_szModuleName, "ExpiresIn", expiresIn); node = root.at("refresh_token"); - db_set_s(0, GetAccountName(), "RefreshToken", node.as_string().c_str()); + db_set_s(0, m_szModuleName, "RefreshToken", node.as_string().c_str()); SetDlgItemTextA(hwndDlg, IDC_OAUTH_CODE, ""); @@ -144,9 +135,9 @@ void CGDriveService::RequestAccessTokenThread(void *param) void CGDriveService::RevokeAccessTokenThread(void*) { - ptrA token(db_get_sa(0, GetAccountName(), "TokenSecret")); + ptrA token(db_get_sa(0, m_szModuleName, "TokenSecret")); GDriveAPI::RevokeAccessTokenRequest request(token); - NLHR_PTR response(request.Send(m_hConnection)); + NLHR_PTR response(request.Send(m_hNetlibUser)); delSetting("ExpiresIn"); delSetting("TokenSecret"); @@ -166,7 +157,7 @@ auto CGDriveService::UploadFile(const std::string &parentId, const std::string & { ptrA token(getStringA("TokenSecret")); GDriveAPI::UploadFileRequest request(token, parentId.c_str(), fileName.c_str(), data, size); - NLHR_PTR response(request.Send(m_hConnection)); + NLHR_PTR response(request.Send(m_hNetlibUser)); JSONNode root = GetJsonResponse(response); return root["id"].as_string(); } @@ -175,7 +166,7 @@ auto CGDriveService::CreateUploadSession(const std::string &parentId, const std: { ptrA token(getStringA("TokenSecret")); GDriveAPI::CreateUploadSessionRequest request(token, parentId.c_str(), fileName.c_str()); - NLHR_PTR response(request.Send(m_hConnection)); + NLHR_PTR response(request.Send(m_hNetlibUser)); HandleHttpError(response); @@ -190,7 +181,7 @@ auto CGDriveService::CreateUploadSession(const std::string &parentId, const std: auto CGDriveService::UploadFileChunk(const std::string &uploadUri, const char *chunk, size_t chunkSize, uint64_t offset, uint64_t fileSize) { GDriveAPI::UploadFileChunkRequest request(uploadUri.c_str(), chunk, chunkSize, offset, fileSize); - NLHR_PTR response(request.Send(m_hConnection)); + NLHR_PTR response(request.Send(m_hNetlibUser)); if (response->resultCode == HTTP_CODE_PERMANENT_REDIRECT) return std::string(); @@ -211,7 +202,7 @@ auto CGDriveService::CreateFolder(const std::string &parentId, const std::string { ptrA token(getStringA("TokenSecret")); GDriveAPI::GetFolderRequest getFolderRequest(token, parentId.c_str(), name.c_str()); - NLHR_PTR response(getFolderRequest.Send(m_hConnection)); + NLHR_PTR response(getFolderRequest.Send(m_hNetlibUser)); JSONNode root = GetJsonResponse(response); JSONNode files = root["files"].as_array(); @@ -219,7 +210,7 @@ auto CGDriveService::CreateFolder(const std::string &parentId, const std::string return files[(size_t)0]["id"].as_string(); GDriveAPI::CreateFolderRequest createFolderRequest(token, parentId.c_str(), name.c_str()); - response = createFolderRequest.Send(m_hConnection); + response = createFolderRequest.Send(m_hNetlibUser); root = GetJsonResponse(response); return root["id"].as_string(); @@ -229,7 +220,7 @@ auto CGDriveService::CreateSharedLink(const std::string &itemId) { ptrA token(getStringA("TokenSecret")); GDriveAPI::GrantPermissionsRequest request(token, itemId.c_str()); - NLHR_PTR response(request.Send(m_hConnection)); + NLHR_PTR response(request.Send(m_hNetlibUser)); HandleHttpError(response); diff --git a/protocols/CloudFile/src/Services/google_service.h b/protocols/CloudFile/src/Services/google_service.h index 7133ab9a52..1d0c09b159 100644 --- a/protocols/CloudFile/src/Services/google_service.h +++ b/protocols/CloudFile/src/Services/google_service.h @@ -21,7 +21,6 @@ public: CGDriveService(const char *protoName, const wchar_t *userName); static PROTO_INTERFACE* Init(const char *szModuleName, const wchar_t *szUserName); - static int UnInit(PROTO_INTERFACE*); const char* GetModuleName() const override; diff --git a/protocols/CloudFile/src/Services/microsoft_service.cpp b/protocols/CloudFile/src/Services/microsoft_service.cpp index 17115235cd..d444b4133a 100644 --- a/protocols/CloudFile/src/Services/microsoft_service.cpp +++ b/protocols/CloudFile/src/Services/microsoft_service.cpp @@ -23,16 +23,7 @@ COneDriveService::COneDriveService(const char *protoName, const wchar_t *userNam PROTO_INTERFACE* COneDriveService::Init(const char *moduleName, const wchar_t *userName) { - COneDriveService *proto = new COneDriveService(moduleName, userName); - Services.insert(proto); - return proto; -} - -int COneDriveService::UnInit(PROTO_INTERFACE *proto) -{ - Services.remove((COneDriveService *)proto); - delete proto; - return 0; + return new COneDriveService(moduleName, userName); } const char* COneDriveService::GetModuleName() const @@ -60,12 +51,12 @@ void COneDriveService::Login(HWND owner) ptrA refreshToken(getStringA("RefreshToken")); if (refreshToken && refreshToken[0]) { OneDriveAPI::RefreshTokenRequest request(refreshToken); - NLHR_PTR response(request.Send(m_hConnection)); + NLHR_PTR response(request.Send(m_hNetlibUser)); JSONNode root = GetJsonResponse(response); JSONNode node = root.at("access_token"); - db_set_s(0, GetAccountName(), "TokenSecret", node.as_string().c_str()); + db_set_s(0, m_szModuleName, "TokenSecret", node.as_string().c_str()); node = root.at("expires_in"); time_t expiresIn = time(0) + node.as_int(); @@ -97,14 +88,14 @@ void COneDriveService::RequestAccessTokenThread(void *param) GetDlgItemTextA(hwndDlg, IDC_OAUTH_CODE, requestToken, _countof(requestToken)); OneDriveAPI::GetAccessTokenRequest request(requestToken); - NLHR_PTR response(request.Send(m_hConnection)); + NLHR_PTR response(request.Send(m_hNetlibUser)); if (response == nullptr || response->resultCode != HTTP_CODE_OK) { const char *error = response->body.GetLength() ? response->body : HttpStatusToError(response->resultCode); - Netlib_Logf(m_hConnection, "%s: %s", GetAccountName(), error); + Netlib_Logf(m_hNetlibUser, "%s: %s", m_szModuleName, error); ShowNotification(TranslateT("Server does not respond"), MB_ICONERROR); EndDialog(hwndDlg, 0); return; @@ -112,7 +103,7 @@ void COneDriveService::RequestAccessTokenThread(void *param) JSONNode root = JSONNode::parse(response->body); if (root.empty()) { - Netlib_Logf(m_hConnection, "%s: %s", GetAccountName(), HttpStatusToError(response->resultCode)); + Netlib_Logf(m_hNetlibUser, "%s: %s", m_szModuleName, HttpStatusToError(response->resultCode)); ShowNotification(TranslateT("Server does not respond"), MB_ICONERROR); EndDialog(hwndDlg, 0); return; @@ -121,7 +112,7 @@ void COneDriveService::RequestAccessTokenThread(void *param) JSONNode node = root.at("error_description"); if (!node.isnull()) { CMStringW error_description = node.as_mstring(); - Netlib_Logf(m_hConnection, "%s: %s", GetAccountName(), HttpStatusToError(response->resultCode)); + Netlib_Logf(m_hNetlibUser, "%s: %s", m_szModuleName, HttpStatusToError(response->resultCode)); ShowNotification(error_description, MB_ICONERROR); EndDialog(hwndDlg, 0); return; @@ -158,7 +149,7 @@ auto COneDriveService::UploadFile(const std::string &parentId, const std::string OneDriveAPI::UploadFileRequest *request = !parentId.empty() ? new OneDriveAPI::UploadFileRequest(token, parentId.c_str(), fileName.c_str(), data, size, (OnConflict)strategy) : new OneDriveAPI::UploadFileRequest(token, fileName.c_str(), data, size, (OnConflict)strategy); - NLHR_PTR response(request->Send(m_hConnection)); + NLHR_PTR response(request->Send(m_hNetlibUser)); delete request; JSONNode root = GetJsonResponse(response); @@ -172,7 +163,7 @@ auto COneDriveService::CreateUploadSession(const std::string &parentId, const st OneDriveAPI::CreateUploadSessionRequest *request = !parentId.empty() ? new OneDriveAPI::CreateUploadSessionRequest(token, parentId.c_str(), fileName.c_str(), (OnConflict)strategy) : new OneDriveAPI::CreateUploadSessionRequest(token, fileName.c_str(), (OnConflict)strategy); - NLHR_PTR response(request->Send(m_hConnection)); + NLHR_PTR response(request->Send(m_hNetlibUser)); delete request; JSONNode root = GetJsonResponse(response); @@ -182,7 +173,7 @@ auto COneDriveService::CreateUploadSession(const std::string &parentId, const st auto COneDriveService::UploadFileChunk(const std::string &uploadUri, const char *chunk, size_t chunkSize, uint64_t offset, uint64_t fileSize) { OneDriveAPI::UploadFileChunkRequest request(uploadUri.c_str(), chunk, chunkSize, offset, fileSize); - NLHR_PTR response(request.Send(m_hConnection)); + NLHR_PTR response(request.Send(m_hNetlibUser)); HandleHttpError(response); @@ -203,7 +194,7 @@ auto COneDriveService::CreateFolder(const std::string &path) { ptrA token(getStringA("TokenSecret")); OneDriveAPI::CreateFolderRequest request(token, path.c_str()); - NLHR_PTR response(request.Send(m_hConnection)); + NLHR_PTR response(request.Send(m_hNetlibUser)); JSONNode root = GetJsonResponse(response); return root["id"].as_string(); @@ -213,7 +204,7 @@ auto COneDriveService::CreateSharedLink(const std::string &itemId) { ptrA token(getStringA("TokenSecret")); OneDriveAPI::CreateSharedLinkRequest request(token, itemId.c_str()); - NLHR_PTR response(request.Send(m_hConnection)); + NLHR_PTR response(request.Send(m_hNetlibUser)); JSONNode root = GetJsonResponse(response); return root["link"]["webUrl"].as_string(); diff --git a/protocols/CloudFile/src/Services/microsoft_service.h b/protocols/CloudFile/src/Services/microsoft_service.h index b8fe3c2bde..02c631f442 100644 --- a/protocols/CloudFile/src/Services/microsoft_service.h +++ b/protocols/CloudFile/src/Services/microsoft_service.h @@ -20,7 +20,6 @@ public: COneDriveService(const char *protoName, const wchar_t *userName); static PROTO_INTERFACE* Init(const char *szModuleName, const wchar_t *szUserName); - static int UnInit(PROTO_INTERFACE *); const char* GetModuleName() const override; diff --git a/protocols/CloudFile/src/Services/yandex_service.cpp b/protocols/CloudFile/src/Services/yandex_service.cpp index e252eed161..a8ee11e9f2 100644 --- a/protocols/CloudFile/src/Services/yandex_service.cpp +++ b/protocols/CloudFile/src/Services/yandex_service.cpp @@ -23,16 +23,7 @@ CYandexService::CYandexService(const char *protoName, const wchar_t *userName) : PROTO_INTERFACE* CYandexService::Init(const char *moduleName, const wchar_t *userName) { - CYandexService *proto = new CYandexService(moduleName, userName); - Services.insert(proto); - return proto; -} - -int CYandexService::UnInit(PROTO_INTERFACE *proto) -{ - Services.remove((CYandexService*)proto); - delete proto; - return 0; + return new CYandexService(moduleName, userName); } const char* CYandexService::GetModuleName() const @@ -61,7 +52,7 @@ void CYandexService::Login(HWND owner) ptrA refreshToken(getStringA("RefreshToken")); if (token && refreshToken && refreshToken[0]) { YandexAPI::RefreshTokenRequest request(refreshToken); - NLHR_PTR response(request.Send(m_hConnection)); + NLHR_PTR response(request.Send(m_hNetlibUser)); JSONNode root = GetJsonResponse(response); @@ -99,12 +90,12 @@ void CYandexService::RequestAccessTokenThread(void *param) GetDlgItemTextA(hwndDlg, IDC_OAUTH_CODE, requestToken, _countof(requestToken)); YandexAPI::GetAccessTokenRequest request(requestToken); - NLHR_PTR response(request.Send(m_hConnection)); + NLHR_PTR response(request.Send(m_hNetlibUser)); if (response == nullptr || response->resultCode != HTTP_CODE_OK) { if (response) { const char *error = response->body.GetLength() ? response->body : HttpStatusToError(response->resultCode); - Netlib_Logf(m_hConnection, "%s: %s", GetAccountName(), error); + Netlib_Logf(m_hNetlibUser, "%s: %s", m_szModuleName, error); } ShowNotification(TranslateT("Server does not respond"), MB_ICONERROR); EndDialog(hwndDlg, 0); @@ -113,7 +104,7 @@ void CYandexService::RequestAccessTokenThread(void *param) JSONNode root = JSONNode::parse(response->body); if (root.empty()) { - Netlib_Logf(m_hConnection, "%s: %s", GetAccountName(), HttpStatusToError(response->resultCode)); + Netlib_Logf(m_hNetlibUser, "%s: %s", m_szModuleName, HttpStatusToError(response->resultCode)); ShowNotification(TranslateT("Server does not respond"), MB_ICONERROR); EndDialog(hwndDlg, 0); return; @@ -122,7 +113,7 @@ void CYandexService::RequestAccessTokenThread(void *param) JSONNode node = root.at("error_description"); if (!node.isnull()) { CMStringW error_description = node.as_mstring(); - Netlib_Logf(m_hConnection, "%s: %s", GetAccountName(), HttpStatusToError(response->resultCode)); + Netlib_Logf(m_hNetlibUser, "%s: %s", m_szModuleName, HttpStatusToError(response->resultCode)); ShowNotification(error_description, MB_ICONERROR); EndDialog(hwndDlg, 0); return; @@ -145,9 +136,9 @@ void CYandexService::RequestAccessTokenThread(void *param) void CYandexService::RevokeAccessTokenThread(void*) { - ptrA token(db_get_sa(0, GetAccountName(), "TokenSecret")); + ptrA token(db_get_sa(0, m_szModuleName, "TokenSecret")); YandexAPI::RevokeAccessTokenRequest request(token); - NLHR_PTR response(request.Send(m_hConnection)); + NLHR_PTR response(request.Send(m_hNetlibUser)); delSetting("ExpiresIn"); delSetting("TokenSecret"); @@ -168,7 +159,7 @@ auto CYandexService::CreateUploadSession(const std::string &path) ptrA token(getStringA("TokenSecret")); uint8_t strategy = g_plugin.getByte("ConflictStrategy", OnConflict::REPLACE); YandexAPI::GetUploadUrlRequest request(token, path.c_str(), (OnConflict)strategy); - NLHR_PTR response(request.Send(m_hConnection)); + NLHR_PTR response(request.Send(m_hNetlibUser)); JSONNode root = GetJsonResponse(response); return root["href"].as_string(); @@ -177,7 +168,7 @@ auto CYandexService::CreateUploadSession(const std::string &path) void CYandexService::UploadFile(const std::string &uploadUri, const char *data, size_t size) { YandexAPI::UploadFileRequest request(uploadUri.c_str(), data, size); - NLHR_PTR response(request.Send(m_hConnection)); + NLHR_PTR response(request.Send(m_hNetlibUser)); HandleHttpError(response); @@ -190,7 +181,7 @@ void CYandexService::UploadFile(const std::string &uploadUri, const char *data, void CYandexService::UploadFileChunk(const std::string &uploadUri, const char *chunk, size_t chunkSize, uint64_t offset, uint64_t fileSize) { YandexAPI::UploadFileChunkRequest request(uploadUri.c_str(), chunk, chunkSize, offset, fileSize); - NLHR_PTR response(request.Send(m_hConnection)); + NLHR_PTR response(request.Send(m_hNetlibUser)); HandleHttpError(response); @@ -205,7 +196,7 @@ void CYandexService::CreateFolder(const std::string &path) { ptrA token(getStringA("TokenSecret")); YandexAPI::CreateFolderRequest request(token, path.c_str()); - NLHR_PTR response(request.Send(m_hConnection)); + NLHR_PTR response(request.Send(m_hNetlibUser)); if (HTTP_CODE_SUCCESS(response->resultCode)) { GetJsonResponse(response); @@ -224,12 +215,12 @@ auto CYandexService::CreateSharedLink(const std::string &path) { ptrA token(getStringA("TokenSecret")); YandexAPI::PublishRequest publishRequest(token, path.c_str()); - NLHR_PTR response(publishRequest.Send(m_hConnection)); + NLHR_PTR response(publishRequest.Send(m_hNetlibUser)); GetJsonResponse(response); YandexAPI::GetResourcesRequest resourcesRequest(token, path.c_str()); - response = resourcesRequest.Send(m_hConnection); + response = resourcesRequest.Send(m_hNetlibUser); JSONNode root = GetJsonResponse(response); return root["public_url"].as_string(); diff --git a/protocols/CloudFile/src/Services/yandex_service.h b/protocols/CloudFile/src/Services/yandex_service.h index c83a49f22c..c6566667d1 100644 --- a/protocols/CloudFile/src/Services/yandex_service.h +++ b/protocols/CloudFile/src/Services/yandex_service.h @@ -21,7 +21,6 @@ public: CYandexService(const char *protoName, const wchar_t *userName); static PROTO_INTERFACE* Init(const char *szModuleName, const wchar_t *szUserName); - static int UnInit(PROTO_INTERFACE *); const char* GetModuleName() const override; diff --git a/protocols/CloudFile/src/cloud_file.cpp b/protocols/CloudFile/src/cloud_file.cpp index 772b42ae36..3be07d2f68 100644 --- a/protocols/CloudFile/src/cloud_file.cpp +++ b/protocols/CloudFile/src/cloud_file.cpp @@ -8,41 +8,38 @@ CCloudService::CCloudService(const char *protoName, const wchar_t *userName, HPL nlu.flags = NUF_OUTGOING | NUF_HTTPCONNS | NUF_UNICODE; nlu.szSettingsModule = (char*)protoName; nlu.szDescriptiveName.w = (wchar_t*)userName; - m_hConnection = Netlib_RegisterUser(&nlu); + m_hNetlibUser = Netlib_RegisterUser(&nlu); + + CreateProtoService(PS_UPLOAD, &CCloudService::UploadMenuCommand); + + g_arServices.insert(this); } CCloudService::~CCloudService() { - Netlib_CloseHandle(m_hConnection); - m_hConnection = nullptr; -} + if (!Miranda_IsTerminated()) + InitializeMenus(); -HPLUGIN CCloudService::GetId() const -{ - return m_pPlugin; + Netlib_CloseHandle(m_hNetlibUser); + m_hNetlibUser = nullptr; } -const char* CCloudService::GetAccountName() const +void CCloudService::OnModulesLoaded() { - return m_szModuleName; + InitializeMenus(); } -const wchar_t* CCloudService::GetUserName() const +HPLUGIN CCloudService::GetId() const { - return m_tszUserName; + return m_pPlugin; } INT_PTR CCloudService::GetCaps(int type, MCONTACT) { - switch (type) { - case PFLAGNUM_1: + if (type == PFLAGNUM_1) return PF1_FILESEND; - case PFLAGNUM_2: - case PFLAGNUM_5: - return PF2_NONE; - default: - return 0; - } + + return 0; } int CCloudService::FileCancel(MCONTACT, HANDLE hTransfer) @@ -186,4 +183,17 @@ UINT CCloudService::Upload(CCloudService *service, FileTransferParam *ftp) ftp->SetStatus(ACKRESULT_SUCCESS); return ACKRESULT_SUCCESS; -}
\ No newline at end of file +} + +int CCloudService::UnInit(PROTO_INTERFACE *proto) +{ + g_arServices.remove((CCloudService *)proto); + delete proto; + return 0; +} + +INT_PTR CCloudService::UploadMenuCommand(WPARAM hContact, LPARAM) +{ + OpenUploadDialog(hContact); + return 0; +} diff --git a/protocols/CloudFile/src/cloud_file.h b/protocols/CloudFile/src/cloud_file.h index 4a5b91da72..ca08335b02 100644 --- a/protocols/CloudFile/src/cloud_file.h +++ b/protocols/CloudFile/src/cloud_file.h @@ -8,11 +8,12 @@ enum OnConflict REPLACE, }; +#define PS_UPLOAD "/Upload" + class CCloudService : public PROTO<CCloudService> { protected: HPLUGIN m_pPlugin; - HNETLIBUSER m_hConnection; // utils std::string PreparePath(const std::string &path) const; @@ -28,6 +29,8 @@ protected: JSONNode GetJsonResponse(MHttpResponse *response); + INT_PTR __cdecl UploadMenuCommand(WPARAM, LPARAM); + virtual void Upload(FileTransferParam *ftp) = 0; public: @@ -43,8 +46,6 @@ public: HPLUGIN GetId() const; virtual const char* GetModuleName() const = 0; - const char* GetAccountName() const; - const wchar_t* GetUserName() const; virtual int GetIconId() const = 0; @@ -54,7 +55,8 @@ public: void OpenUploadDialog(MCONTACT hContact); + static int UnInit(PROTO_INTERFACE *); static UINT Upload(CCloudService *service, FileTransferParam *ftp); }; -#endif //_CLOUD_SERVICE_H_
\ No newline at end of file +#endif //_CLOUD_SERVICE_H_ diff --git a/protocols/CloudFile/src/events.cpp b/protocols/CloudFile/src/events.cpp index 8f254bdaa8..31f47f2abd 100644 --- a/protocols/CloudFile/src/events.cpp +++ b/protocols/CloudFile/src/events.cpp @@ -26,7 +26,7 @@ static int OnProtoAck(WPARAM, LPARAM lParam) static int OnFileDialogCanceled(WPARAM hContact, LPARAM) { - for (auto &service : Services) { + for (auto &service : g_arServices) { auto it = service->InterceptedContacts.find(hContact); if (it != service->InterceptedContacts.end()) service->InterceptedContacts.erase(it); @@ -37,10 +37,8 @@ static int OnFileDialogCanceled(WPARAM hContact, LPARAM) int OnModulesLoaded(WPARAM, LPARAM) { HookEvent(ME_PROTO_ACK, OnProtoAck); - - // srfile HookEvent(ME_FILEDLG_CANCELED, OnFileDialogCanceled); HookTemporaryEvent(ME_MSG_TOOLBARLOADED, OnSrmmToolbarLoaded); return 0; -}
\ No newline at end of file +} diff --git a/protocols/CloudFile/src/main.cpp b/protocols/CloudFile/src/main.cpp index cf43d16dcd..e2a8d82bd8 100644 --- a/protocols/CloudFile/src/main.cpp +++ b/protocols/CloudFile/src/main.cpp @@ -36,7 +36,6 @@ int CMPlugin::Load() HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded); InitializeIcons(); - InitializeMenus(); InitializeServices(); return 0; } diff --git a/protocols/CloudFile/src/menus.cpp b/protocols/CloudFile/src/menus.cpp index 33fe369406..38a12c6798 100644 --- a/protocols/CloudFile/src/menus.cpp +++ b/protocols/CloudFile/src/menus.cpp @@ -1,48 +1,51 @@ #include "stdafx.h" -HGENMENU hContactMenu; - -static INT_PTR UploadMenuCommand(void *obj, WPARAM hContact, LPARAM) -{ - CCloudService *service = (CCloudService*)obj; - service->OpenUploadDialog(hContact); - return 0; -} +static HGENMENU hContactMenu; void InitializeMenus() { + if (hContactMenu) + Menu_RemoveItem(hContactMenu); + + // no money, no honey + if (g_arServices.getCount() == 0) + return; + CMenuItem mi(&g_plugin); SET_UID(mi, 0x93d4495b, 0x259b, 0x4fba, 0xbc, 0x14, 0xf9, 0x46, 0x2c, 0xda, 0xfc, 0x6d); - mi.name.a = LPGEN("Upload to..."); - - ptrA defaultService(g_plugin.getStringA("DefaultService")); - if (defaultService) { - CCloudService *service = FindService(defaultService); - if (service) { - mi.name.a = LPGEN("Upload"); - mi.pszService = MODULENAME "/Default/Upload"; - CreateServiceFunctionObj(mi.pszService, UploadMenuCommand, service); - } - } - mi.position = -2000019999; - mi.hIcon = g_plugin.getIcon(IDI_UPLOAD); - hContactMenu = Menu_AddContactMenuItem(&mi); -} -void CCloudService::OnModulesLoaded() -{ - CMenuItem mi(GetId()); - mi.root = hContactMenu; - CMStringA serviceName(FORMAT, "/%s/Upload", GetAccountName()); - mi.pszService = serviceName.GetBuffer(); - mi.flags = CMIF_SYSTEM | CMIF_UNICODE; - mi.name.w = (wchar_t*)GetUserName(); - mi.position = Services.getCount(); - mi.hIcolibItem = g_plugin.getIconHandle(GetIconId()); - Menu_AddContactMenuItem(&mi); - - CreateServiceFunctionObj(mi.pszService, UploadMenuCommand, this); + CMStringA szService; + if (g_arServices.getCount() == 1) { + auto *S = g_arServices[0]; + + szService.Format("%s%s", S->m_szModuleName, PS_UPLOAD); + CMStringW wszTitle(FORMAT, L"%s %s", TranslateT("Upload to"), S->m_tszUserName); + mi.flags |= CMIF_UNICODE; + mi.pszService = szService; + mi.name.w = wszTitle.GetBuffer(); + mi.hIcolibItem = g_plugin.getIconHandle(S->GetIconId()); + hContactMenu = Menu_AddContactMenuItem(&mi); + } + else { + mi.hIcolibItem = g_plugin.getIconHandle(IDI_UPLOAD); + mi.name.a = LPGEN("Upload to..."); + hContactMenu = Menu_AddContactMenuItem(&mi); + + int i = 1000; + for (auto &S : g_arServices) { + szService.Format("%s%s", S->m_szModuleName, PS_UPLOAD); + + CMenuItem mi2(S->GetId()); + mi2.root = hContactMenu; + mi2.flags = CMIF_SYSTEM | CMIF_UNICODE; + mi2.name.w = S->m_tszUserName; + mi2.position = i++; + mi2.pszService = szService; + mi2.hIcolibItem = g_plugin.getIconHandle(S->GetIconId()); + Menu_AddContactMenuItem(&mi2); + } + } } int OnPrebuildContactMenu(WPARAM hContact, LPARAM) diff --git a/protocols/CloudFile/src/oauth.cpp b/protocols/CloudFile/src/oauth.cpp index fb243d67e4..0986368742 100644 --- a/protocols/CloudFile/src/oauth.cpp +++ b/protocols/CloudFile/src/oauth.cpp @@ -14,7 +14,7 @@ bool COAuthDlg::OnInitDialog() CCtrlLabel &ctrl = *(CCtrlLabel*)FindControl(IDC_AUTH_TEXT); ptrW format(ctrl.GetText()); wchar_t text[MAX_PATH]; - mir_snwprintf(text, (const wchar_t*)format, m_service->GetUserName()); + mir_snwprintf(text, (const wchar_t*)format, m_service->m_tszUserName); ctrl.SetText(text); return true; } diff --git a/protocols/CloudFile/src/options.cpp b/protocols/CloudFile/src/options.cpp index f50168005e..0418d8ed7e 100644 --- a/protocols/CloudFile/src/options.cpp +++ b/protocols/CloudFile/src/options.cpp @@ -25,9 +25,9 @@ bool COptionsMainDlg::OnInitDialog() int iItem = m_defaultService.AddString(TranslateT("None")); m_defaultService.SetCurSel(iItem); - for (auto &service : Services) { - iItem = m_defaultService.AddString(mir_wstrdup(service->GetUserName()), (LPARAM)service); - if (!mir_strcmpi(service->GetAccountName(), defaultService)) + for (auto &service : g_arServices) { + iItem = m_defaultService.AddString(mir_wstrdup(service->m_tszUserName), (LPARAM)service); + if (!mir_strcmpi(service->m_szModuleName, defaultService)) m_defaultService.SetCurSel(iItem); } @@ -57,7 +57,7 @@ bool COptionsMainDlg::OnApply() { CCloudService *service = (CCloudService*)m_defaultService.GetCurData(); if (service) - g_plugin.setString("DefaultService", service->GetAccountName()); + g_plugin.setString("DefaultService", service->m_szModuleName); else g_plugin.delSetting("DefaultService"); diff --git a/protocols/CloudFile/src/services.cpp b/protocols/CloudFile/src/services.cpp index f568f2f68c..386fdd26cc 100644 --- a/protocols/CloudFile/src/services.cpp +++ b/protocols/CloudFile/src/services.cpp @@ -2,15 +2,15 @@ static int CompareServices(const CCloudService *p1, const CCloudService *p2) { - return mir_strcmp(p1->GetAccountName(), p2->GetAccountName()); + return mir_strcmp(p1->m_szModuleName, p2->m_szModuleName); } -LIST<CCloudService> Services(10, CompareServices); +LIST<CCloudService> g_arServices(10, CompareServices); CCloudService* FindService(const char *szProto) { - for (auto &it : Services) - if (!mir_strcmp(it->GetAccountName(), szProto)) + for (auto &it : g_arServices) + if (!mir_strcmp(it->m_szModuleName, szProto)) return it; return nullptr; @@ -32,9 +32,8 @@ static INT_PTR GetService(WPARAM wParam, LPARAM lParam) if (service == nullptr) return 3; - info->accountName = service->GetAccountName(); - info->userName = service->GetUserName(); - + info->accountName = service->m_szModuleName; + info->userName = service->m_tszUserName; return 0; } @@ -44,9 +43,9 @@ static INT_PTR EnumServices(WPARAM wParam, LPARAM lParam) enumCFServiceFunc enumFunc = (enumCFServiceFunc)wParam; void *param = (void*)lParam; - for (auto &service : Services) { - info.accountName = service->GetAccountName(); - info.userName = service->GetUserName(); + for (auto &service : g_arServices) { + info.accountName = service->m_szModuleName; + info.userName = service->m_tszUserName; int res = enumFunc(&info, param); if (res != 0) return res; diff --git a/protocols/CloudFile/src/srmm.cpp b/protocols/CloudFile/src/srmm.cpp index 558b86fdd4..79d012c7cb 100644 --- a/protocols/CloudFile/src/srmm.cpp +++ b/protocols/CloudFile/src/srmm.cpp @@ -51,14 +51,14 @@ int OnSrmmButtonPressed(WPARAM, LPARAM lParam) } HMENU hMenu = CreatePopupMenu(); - for (auto &it : Services) - AppendMenu(hMenu, MF_STRING, Services.indexOf(&it) + 1, TranslateW(it->GetUserName())); + for (auto &it : g_arServices) + AppendMenu(hMenu, MF_STRING, g_arServices.indexOf(&it) + 1, TranslateW(it->m_tszUserName)); int pos = TrackPopupMenu(hMenu, TPM_RETURNCMD, cbc->pt.x, cbc->pt.y, 0, cbc->hwndFrom, nullptr); DestroyMenu(hMenu); if (pos > 0) { - CCloudService *service = Services[pos - 1]; + CCloudService *service = g_arServices[pos - 1]; service->OpenUploadDialog(cbc->hContact); } diff --git a/protocols/CloudFile/src/stdafx.cxx b/protocols/CloudFile/src/stdafx.cxx index d837dedb4d..29ce8c4913 100644 --- a/protocols/CloudFile/src/stdafx.cxx +++ b/protocols/CloudFile/src/stdafx.cxx @@ -1,5 +1,5 @@ /*
-Copyright (C) 2012-24 Miranda NG team (https://miranda-ng.org)
+Copyright (C) 2012-25 Miranda NG team (https://miranda-ng.org)
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License
diff --git a/protocols/CloudFile/src/stdafx.h b/protocols/CloudFile/src/stdafx.h index 4490d2c23d..4ede95c74e 100644 --- a/protocols/CloudFile/src/stdafx.h +++ b/protocols/CloudFile/src/stdafx.h @@ -69,11 +69,13 @@ public: // services #include "cloud_file.h" #include "oauth.h" + #include "Services\dropbox_service.h" #include "Services\google_service.h" #include "Services\microsoft_service.h" #include "Services\yandex_service.h" -extern LIST<CCloudService> Services; + +extern LIST<CCloudService> g_arServices; void InitializeServices(); // events @@ -83,7 +85,6 @@ int OnModulesLoaded(WPARAM, LPARAM); void InitializeIcons(); // menus -extern HGENMENU hContactMenu; void InitializeMenus(); int OnPrebuildContactMenu(WPARAM, LPARAM); diff --git a/protocols/CloudFile/src/transfers.cpp b/protocols/CloudFile/src/transfers.cpp index 5236e0c9f0..6b40e9cc62 100644 --- a/protocols/CloudFile/src/transfers.cpp +++ b/protocols/CloudFile/src/transfers.cpp @@ -5,7 +5,7 @@ LIST<FileTransferParam> Transfers(1, HandleKeySortT); INT_PTR SendFileInterceptor(WPARAM, LPARAM lParam) { CCSDATA *pccsd = (CCSDATA*)lParam; - for (auto &service : Services) { + for (auto &service : g_arServices) { auto it = service->InterceptedContacts.find(pccsd->hContact); if (it == service->InterceptedContacts.end()) continue; diff --git a/protocols/CloudFile/src/utils.cpp b/protocols/CloudFile/src/utils.cpp index 755746f197..2e917ce0c9 100644 --- a/protocols/CloudFile/src/utils.cpp +++ b/protocols/CloudFile/src/utils.cpp @@ -27,7 +27,7 @@ MEVENT AddEventToDb(MCONTACT hContact, uint16_t type, uint32_t flags, uint32_t c { DBEVENTINFO dbei = {}; dbei.szModule = MODULENAME; - dbei.timestamp = time(0); + dbei.iTimestamp = time(0); dbei.eventType = type; dbei.cbBlob = cbBlob; dbei.pBlob = pBlob; @@ -56,7 +56,7 @@ bool CanSendToContact(MCONTACT hContact) if (!isProtoOnline) return false; - bool isContactOnline = Contact::GetStatus(hContact) > ID_STATUS_OFFLINE; + bool isContactOnline = Contact::GetStatus(hContact, proto) > ID_STATUS_OFFLINE; if (isContactOnline) return true; diff --git a/protocols/CloudFile/src/version.h b/protocols/CloudFile/src/version.h index 31d4df4137..d3f7b6badc 100644 --- a/protocols/CloudFile/src/version.h +++ b/protocols/CloudFile/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 0
-#define __MINOR_VERSION 11
+#define __MINOR_VERSION 12
#define __RELEASE_NUM 0
-#define __BUILD_NUM 6
+#define __BUILD_NUM 1
#include <stdver.h>
@@ -10,4 +10,4 @@ #define __DESCRIPTION "Allows you to transfer files via cloud services."
#define __AUTHOR "Miranda NG team"
#define __AUTHORWEB "https://miranda-ng.org/p/CloudFile"
-#define __COPYRIGHT "© 2017-24 Miranda NG team"
+#define __COPYRIGHT "© 2017-25 Miranda NG team"
|