summaryrefslogtreecommitdiff
path: root/plugins/CloudFile/src/services.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2018-04-06 00:00:43 +0300
committerGeorge Hazan <ghazan@miranda.im>2018-04-06 00:00:43 +0300
commitde898be6a2857dababe3eaa2bfb394a9ea92ecbe (patch)
tree69543eead49b6038d88e14cfc4f4856ca27a1cee /plugins/CloudFile/src/services.cpp
parent35e2289786a7f1542573d1a58ebc971970ea981c (diff)
CloudFile: no need to create fake protocol instances just for search
Diffstat (limited to 'plugins/CloudFile/src/services.cpp')
-rw-r--r--plugins/CloudFile/src/services.cpp15
1 files changed, 11 insertions, 4 deletions
diff --git a/plugins/CloudFile/src/services.cpp b/plugins/CloudFile/src/services.cpp
index 0b9e062b09..28cda47967 100644
--- a/plugins/CloudFile/src/services.cpp
+++ b/plugins/CloudFile/src/services.cpp
@@ -7,6 +7,15 @@ static int CompareServices(const CCloudService *p1, const CCloudService *p2)
LIST<CCloudService> Services(10, CompareServices);
+CCloudService* FindService(const char *szProto)
+{
+ for (auto &it : Services)
+ if (!mir_strcmp(it->GetAccountName(), szProto))
+ return it;
+
+ return nullptr;
+}
+
static INT_PTR GetService(WPARAM wParam, LPARAM lParam)
{
ptrA accountName(mir_strdup((char*)wParam));
@@ -15,8 +24,7 @@ static INT_PTR GetService(WPARAM wParam, LPARAM lParam)
if (accountName == nullptr)
return 2;
- CCloudServiceSearch search(accountName);
- CCloudService *service = Services.find(&search);
+ CCloudService *service = FindService(accountName);
if (service == nullptr)
return 3;
@@ -58,8 +66,7 @@ INT_PTR Upload(WPARAM wParam, LPARAM lParam)
if (accountName == nullptr)
return 2;
- CCloudServiceSearch search(uploadData->accountName);
- CCloudService *service = Services.find(&search);
+ CCloudService *service = FindService(uploadData->accountName);
if (service == nullptr)
return 3;