diff options
author | Tobias Weimer <wishmaster51@googlemail.com> | 2015-06-07 20:11:48 +0000 |
---|---|---|
committer | Tobias Weimer <wishmaster51@googlemail.com> | 2015-06-07 20:11:48 +0000 |
commit | 284caa432d31130a2714ce6acb49826d55b8789d (patch) | |
tree | 065c08408d210b915c49ebaa42da6afb9af0414b | |
parent | 8e0c637454c5797a5a9ce02968480a1847676f29 (diff) |
Dropbox switched to NLHR_PTR
git-svn-id: http://svn.miranda-ng.org/main/trunk@14059 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | plugins/Dropbox/src/dropbox.cpp | 6 | ||||
-rw-r--r-- | plugins/Dropbox/src/dropbox_commands.cpp | 6 | ||||
-rw-r--r-- | plugins/Dropbox/src/dropbox_transfers.cpp | 12 | ||||
-rw-r--r-- | plugins/Dropbox/src/http_request.h | 22 |
4 files changed, 12 insertions, 34 deletions
diff --git a/plugins/Dropbox/src/dropbox.cpp b/plugins/Dropbox/src/dropbox.cpp index 75a8f6389e..50be4b39cd 100644 --- a/plugins/Dropbox/src/dropbox.cpp +++ b/plugins/Dropbox/src/dropbox.cpp @@ -66,7 +66,7 @@ void CDropbox::RequestAccountInfo() ptrA token(db_get_sa(NULL, MODULE, "TokenSecret"));
GetAccountInfoRequest request(token);
- NetlibPtr response(request.Send(hNetlibConnection));
+ NLHR_PTR response(request.Send(hNetlibConnection));
HandleHttpResponseError(response);
JSONNode root = JSONNode::parse(response->pData);
@@ -121,7 +121,7 @@ void CDropbox::RequestAccountInfo() void CDropbox::DestroyAccessToken()
{
DisableAccessTokenRequest request;
- NetlibPtr response(request.Send(hNetlibConnection));
+ NLHR_PTR response(request.Send(hNetlibConnection));
db_unset(NULL, MODULE, "TokenSecret");
MCONTACT hContact = CDropbox::GetDefaultContact();
@@ -147,7 +147,7 @@ UINT CDropbox::RequestAccessTokenAsync(void *owner, void *param) GetDlgItemTextA(hwndDlg, IDC_REQUEST_CODE, requestToken, SIZEOF(requestToken));
GetAccessTokenRequest request(requestToken);
- NetlibPtr response(request.Send(instance->hNetlibConnection));
+ NLHR_PTR response(request.Send(instance->hNetlibConnection));
if (response == NULL)
{
diff --git a/plugins/Dropbox/src/dropbox_commands.cpp b/plugins/Dropbox/src/dropbox_commands.cpp index dc4fad8d76..83852b85aa 100644 --- a/plugins/Dropbox/src/dropbox_commands.cpp +++ b/plugins/Dropbox/src/dropbox_commands.cpp @@ -27,7 +27,7 @@ void CDropbox::CommandContent(void *arg) ptrA token(db_get_sa(NULL, MODULE, "TokenSecret"));
ptrA encodedPath(mir_utf8encode(path));
GetMetadataRequest request(token, encodedPath);
- NetlibPtr response(request.Send(param->instance->hNetlibConnection));
+ NLHR_PTR response(request.Send(param->instance->hNetlibConnection));
if (response == NULL || response->resultCode != HTTP_STATUS_OK)
{
@@ -86,7 +86,7 @@ void CDropbox::CommandShare(void *arg) ptrA encodedPath(mir_utf8encode(path));
bool useShortUrl = db_get_b(NULL, MODULE, "UseSortLinks", 1) > 0;
ShareRequest request(token, encodedPath, useShortUrl);
- NetlibPtr response(request.Send(param->instance->hNetlibConnection));
+ NLHR_PTR response(request.Send(param->instance->hNetlibConnection));
if (response == NULL || response->resultCode != HTTP_STATUS_OK)
{
@@ -122,7 +122,7 @@ void CDropbox::CommandDelete(void *arg) ptrA token(db_get_sa(NULL, MODULE, "TokenSecret"));
ptrA encodedPath(mir_utf8encode(path));
DeleteRequest request(token, encodedPath);
- NetlibPtr response(request.Send(param->instance->hNetlibConnection));
+ NLHR_PTR response(request.Send(param->instance->hNetlibConnection));
if (response == NULL || response->resultCode != HTTP_STATUS_OK)
{
diff --git a/plugins/Dropbox/src/dropbox_transfers.cpp b/plugins/Dropbox/src/dropbox_transfers.cpp index e7e5433ff1..865158186d 100644 --- a/plugins/Dropbox/src/dropbox_transfers.cpp +++ b/plugins/Dropbox/src/dropbox_transfers.cpp @@ -5,7 +5,7 @@ void CDropbox::SendFile(const char *path, const char *data, size_t size) ptrA token(db_get_sa(NULL, MODULE, "TokenSecret"));
ptrA encodedPath(mir_utf8encode(path));
UploadFileRequest request(token, encodedPath, data, size);
- NetlibPtr response(request.Send(hNetlibConnection));
+ NLHR_PTR response(request.Send(hNetlibConnection));
HandleHttpResponseError(response);
}
@@ -13,7 +13,7 @@ void CDropbox::SendFileChunkedFirst(const char *data, size_t size, char *uploadI {
ptrA token(db_get_sa(NULL, MODULE, "TokenSecret"));
UploadFileChunkRequest request(token, data, size);
- NetlibPtr response(request.Send(hNetlibConnection));
+ NLHR_PTR response(request.Send(hNetlibConnection));
HandleHttpResponseError(response);
@@ -32,7 +32,7 @@ void CDropbox::SendFileChunkedNext(const char *data, size_t size, const char *up {
ptrA token(db_get_sa(NULL, MODULE, "TokenSecret"));
UploadFileChunkRequest request(token, uploadId, offset, data, size);
- NetlibPtr response(request.Send(hNetlibConnection));
+ NLHR_PTR response(request.Send(hNetlibConnection));
HandleHttpResponseError(response);
@@ -48,7 +48,7 @@ void CDropbox::SendFileChunkedLast(const char *path, const char *uploadId) ptrA token(db_get_sa(NULL, MODULE, "TokenSecret"));
ptrA encodedPath(mir_utf8encode(path));
UploadFileChunkRequest request(token, uploadId, (char*)encodedPath);
- NetlibPtr response(request.Send(hNetlibConnection));
+ NLHR_PTR response(request.Send(hNetlibConnection));
HandleHttpResponseError(response);
}
@@ -57,7 +57,7 @@ void CDropbox::CreateFolder(const char *path) ptrA token(db_get_sa(NULL, MODULE, "TokenSecret"));
ptrA encodedPath(mir_utf8encode(path));
CreateFolderRequest request(token, encodedPath);
- NetlibPtr response(request.Send(hNetlibConnection));
+ NLHR_PTR response(request.Send(hNetlibConnection));
// forder exists on server
if (response->resultCode == HTTP_STATUS_FORBIDDEN)
@@ -72,7 +72,7 @@ void CDropbox::CreateDownloadUrl(const char *path, char *url) ptrA encodedPath(mir_utf8encode(path));
bool useShortUrl = db_get_b(NULL, MODULE, "UseSortLinks", 1) > 0;
ShareRequest request(token, encodedPath, useShortUrl);
- NetlibPtr response(request.Send(hNetlibConnection));
+ NLHR_PTR response(request.Send(hNetlibConnection));
HandleHttpResponseError(response);
diff --git a/plugins/Dropbox/src/http_request.h b/plugins/Dropbox/src/http_request.h index 21c14b456b..6fa8816c93 100644 --- a/plugins/Dropbox/src/http_request.h +++ b/plugins/Dropbox/src/http_request.h @@ -163,26 +163,4 @@ public: }
};
-class NetlibPtr
-{
-protected:
- NETLIBHTTPREQUEST *_p;
-
-public:
- __inline explicit NetlibPtr(NETLIBHTTPREQUEST *p) : _p(p) {}
- __inline NETLIBHTTPREQUEST* operator=(NETLIBHTTPREQUEST *p)
- {
- if (_p)
- CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)(NETLIBHTTPREQUEST*)_p);
- _p = p;
- return _p;
- }
- __inline operator NETLIBHTTPREQUEST*() const { return _p; }
- __inline NETLIBHTTPREQUEST* operator->() const { return _p; }
- __inline ~NetlibPtr()
- {
- CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM)(NETLIBHTTPREQUEST*)this);
- }
-};
-
#endif //_HTTP_REQUEST_H_
\ No newline at end of file |