From 020323a39b43152782541fd3897e3d2f6c72cfd1 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 22 Dec 2015 17:13:27 +0000 Subject: Dropbox: - contact menu to verify PF1_IMSEND flag to disable it for protocols that don't support sending IMs; - code cleaning; - version bump git-svn-id: http://svn.miranda-ng.org/main/trunk@15930 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Dropbox/src/dropbox_commands.cpp | 33 +++++++++++--------------------- 1 file changed, 11 insertions(+), 22 deletions(-) (limited to 'plugins/Dropbox/src/dropbox_commands.cpp') diff --git a/plugins/Dropbox/src/dropbox_commands.cpp b/plugins/Dropbox/src/dropbox_commands.cpp index 83852b85aa..19b6baeb62 100644 --- a/plugins/Dropbox/src/dropbox_commands.cpp +++ b/plugins/Dropbox/src/dropbox_commands.cpp @@ -29,15 +29,13 @@ void CDropbox::CommandContent(void *arg) GetMetadataRequest request(token, encodedPath); NLHR_PTR response(request.Send(param->instance->hNetlibConnection)); - if (response == NULL || response->resultCode != HTTP_STATUS_OK) - { + if (response == NULL || response->resultCode != HTTP_STATUS_OK) { ProtoBroadcastAck(MODULE, param->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, param->hProcess, 0); return; } JSONNode root = JSONNode::parse(response->pData); - if (root.empty()) - { + if (root.empty()) { ProtoBroadcastAck(MODULE, param->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, param->hProcess, 0); return; } @@ -46,14 +44,11 @@ void CDropbox::CommandContent(void *arg) bool isDir = root.at("is_dir").as_bool(); if (!isDir) message.AppendFormat("\"%s\" %s", encodedPath, T2Utf(TranslateT("is file"))); - else - { + else { JSONNode content = root.at("contents").as_array(); - for (size_t i = 0; i < content.size(); i++) - { + for (size_t i = 0; i < content.size(); i++) { JSONNode item = content[i]; - if (item.empty()) - { + if (item.empty()) { if (i == 0) message.AppendFormat("\"%s\" %s", encodedPath, T2Utf(TranslateT("is empty"))); break; @@ -73,8 +68,7 @@ void CDropbox::CommandShare(void *arg) CommandParam *param = (CommandParam*)arg; char *path = (char*)param->data; - if (path == NULL) - { + if (path == NULL) { CMStringA error(FORMAT, T2Utf(TranslateT("\"%s\" command has invalid parameter.\nUse \"/help\" for more info.")), "/share"); ProtoBroadcastAck(MODULE, param->hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, param->hProcess, 0); CallContactService(param->instance->GetDefaultContact(), PSR_MESSAGE, 0, (LPARAM)error.GetBuffer()); @@ -88,15 +82,13 @@ void CDropbox::CommandShare(void *arg) ShareRequest request(token, encodedPath, useShortUrl); NLHR_PTR response(request.Send(param->instance->hNetlibConnection)); - if (response == NULL || response->resultCode != HTTP_STATUS_OK) - { + if (response == NULL || response->resultCode != HTTP_STATUS_OK) { ProtoBroadcastAck(MODULE, param->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, param->hProcess, 0); return; } JSONNode root = JSONNode::parse(response->pData); - if (root.empty()) - { + if (root.empty()) { ProtoBroadcastAck(MODULE, param->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, param->hProcess, 0); return; } @@ -111,8 +103,7 @@ void CDropbox::CommandDelete(void *arg) CommandParam *param = (CommandParam*)arg; char *path = (char*)param->data; - if (path == NULL) - { + if (path == NULL) { CMStringA error(FORMAT, T2Utf(TranslateT("\"%s\" command has invalid parameter.\nUse \"/help\" for more info.")), "/delete"); ProtoBroadcastAck(MODULE, param->hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, param->hProcess, 0); CallContactService(param->instance->GetDefaultContact(), PSR_MESSAGE, 0, (LPARAM)error.GetBuffer()); @@ -124,15 +115,13 @@ void CDropbox::CommandDelete(void *arg) DeleteRequest request(token, encodedPath); NLHR_PTR response(request.Send(param->instance->hNetlibConnection)); - if (response == NULL || response->resultCode != HTTP_STATUS_OK) - { + if (response == NULL || response->resultCode != HTTP_STATUS_OK) { ProtoBroadcastAck(MODULE, param->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, param->hProcess, 0); return; } JSONNode root = JSONNode::parse(response->pData); - if (root.empty()) - { + if (root.empty()) { ProtoBroadcastAck(MODULE, param->hContact, ACKTYPE_MESSAGE, ACKRESULT_FAILED, param->hProcess, 0); return; } -- cgit v1.2.3