summaryrefslogtreecommitdiff
path: root/plugins/Dropbox/src/dropbox.cpp
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2015-05-13 18:17:16 +0000
committerAlexander Lantsev <aunsane@gmail.com>2015-05-13 18:17:16 +0000
commitd333cb91eb0fb51faf34772258a5084e95f047d8 (patch)
treeacc62fd676325289711ab054682cb84ea0c7f29e /plugins/Dropbox/src/dropbox.cpp
parentac60e6cd374568da60bf732a8018f94d48ee9dd7 (diff)
Dropbox: added wrappers for instance's services and hooks
git-svn-id: http://svn.miranda-ng.org/main/trunk@13573 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Dropbox/src/dropbox.cpp')
-rw-r--r--plugins/Dropbox/src/dropbox.cpp23
1 files changed, 12 insertions, 11 deletions
diff --git a/plugins/Dropbox/src/dropbox.cpp b/plugins/Dropbox/src/dropbox.cpp
index 18f611cdff..516a30941c 100644
--- a/plugins/Dropbox/src/dropbox.cpp
+++ b/plugins/Dropbox/src/dropbox.cpp
@@ -7,22 +7,22 @@ CDropbox::CDropbox() : transfers(1, HandleKeySortT)
pd.type = PROTOTYPE_VIRTUAL;
CallService(MS_PROTO_REGISTERMODULE, 0, (LPARAM)&pd);
- HookEventObj(ME_PROTO_ACK, OnProtoAck, this);
- HookEventObj(ME_SYSTEM_PRESHUTDOWN, OnPreShutdown, this);
- HookEventObj(ME_SYSTEM_MODULESLOADED, OnModulesLoaded, this);
+ HookEvent(ME_PROTO_ACK, OnProtoAck);
+ HookEvent(ME_SYSTEM_PRESHUTDOWN, OnPreShutdown);
+ HookEventObj(ME_SYSTEM_MODULESLOADED, GlobalEvent<&CDropbox::OnModulesLoaded>, this);
hFileSentEventHook = CreateHookableEvent(ME_DROPBOX_SENT);
- CreateServiceFunctionObj(MS_DROPBOX_SEND_FILE, SendFileToDropbox, this);
+ CreateServiceFunctionObj(MS_DROPBOX_SEND_FILE, GlobalService<&CDropbox::SendFileToDropbox>, this);
CreateProtoServiceFunction(MODULE, PS_GETCAPS, ProtoGetCaps);
CreateProtoServiceFunction(MODULE, PS_GETNAME, ProtoGetName);
CreateProtoServiceFunction(MODULE, PS_LOADICON, ProtoLoadIcon);
- CreateProtoServiceFunctionObj(PS_GETSTATUS, ProtoGetStatus, this);
- CreateProtoServiceFunctionObj(PSS_FILEW, ProtoSendFile, this);
- CreateProtoServiceFunctionObj(PSS_FILECANCEL, ProtoCancelFile, this);
- CreateProtoServiceFunctionObj(PSS_MESSAGE, ProtoSendMessage, this);
- CreateProtoServiceFunctionObj(PSR_MESSAGE, ProtoReceiveMessage, this);
+ CreateProtoServiceFunctionObj(PS_GETSTATUS, GlobalService<&CDropbox::ProtoGetStatus>, this);
+ CreateProtoServiceFunctionObj(PSS_FILEW, GlobalService<&CDropbox::ProtoSendFile>, this);
+ CreateProtoServiceFunctionObj(PSS_FILECANCEL, GlobalService<&CDropbox::ProtoCancelFile>, this);
+ CreateProtoServiceFunctionObj(PSS_MESSAGE, GlobalService<&CDropbox::ProtoSendMessage>, this);
+ CreateProtoServiceFunction(MODULE, PSR_MESSAGE, ProtoReceiveMessage);
InitializeMenus();
@@ -85,11 +85,11 @@ void CDropbox::RequestAccountInfo()
if (node)
{
ptrW display_name = ptrW(json_as_string(node));
- TCHAR *sep = wcsrchr(display_name, L' ');
+ TCHAR *sep = _tcsrchr(display_name, L' ');
if (sep)
{
db_set_ws(hContact, MODULE, "LastName", sep + 1);
- display_name[wcslen(display_name) - wcslen(sep)] = '\0';
+ display_name[mir_tstrlen(display_name) - mir_tstrlen(sep)] = '\0';
db_set_ws(hContact, MODULE, "FirstName", display_name);
}
else
@@ -187,6 +187,7 @@ UINT CDropbox::RequestAccessTokenAsync(void *owner, void *param)
JSONNODE *node = json_get(root, "access_token");
ptrA access_token = ptrA(mir_u2a(json_as_string(node)));
db_set_s(NULL, MODULE, "TokenSecret", access_token);
+ ProtoBroadcastAck(MODULE, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)ID_STATUS_OFFLINE, (WPARAM)ID_STATUS_ONLINE);
MCONTACT hContact = instance->GetDefaultContact();
if (hContact)