From 8d0758286e5d0220647355a218a4c94f70591e6f Mon Sep 17 00:00:00 2001 From: aunsane Date: Sun, 11 Mar 2018 22:59:22 +0300 Subject: CloudFile: Dropbox OAuth with miranda-ng redirect uri --- plugins/CloudFile/src/events.cpp | 56 +++++++++++++++++++--------------------- 1 file changed, 27 insertions(+), 29 deletions(-) (limited to 'plugins/CloudFile/src/events.cpp') diff --git a/plugins/CloudFile/src/events.cpp b/plugins/CloudFile/src/events.cpp index 0812f3f5cf..869413978c 100644 --- a/plugins/CloudFile/src/events.cpp +++ b/plugins/CloudFile/src/events.cpp @@ -1,28 +1,6 @@ #include "stdafx.h" -int OnModulesLoaded(WPARAM, LPARAM) -{ - - //InitializeMenus(); - - // options - HookEvent(ME_OPT_INITIALISE, OnOptionsInitialized); - - // srfile - for (auto &service : Services) - HookEventObj(ME_FILEDLG_CANCELED, OnFileDialogCanceled, service); - - HookEvent(ME_CLIST_PREBUILDCONTACTMENU, OnPrebuildContactMenu); - - HookEvent(ME_MSG_WINDOWEVENT, OnSrmmWindowOpened); - HookEvent(ME_MSG_BUTTONPRESSED, OnSrmmButtonPressed); - - HookTemporaryEvent(ME_MSG_TOOLBARLOADED, OnSrmmToolbarLoaded); - - return 0; -} - -int OnProtoAck(WPARAM, LPARAM lParam) +static int OnProtoAck(WPARAM, LPARAM lParam) { ACKDATA *ack = (ACKDATA*)lParam; @@ -46,13 +24,33 @@ int OnProtoAck(WPARAM, LPARAM lParam) return 0; } -int OnFileDialogCanceled(void* obj, WPARAM hContact, LPARAM) +static int OnFileDialogCanceled(WPARAM hContact, LPARAM) { - CCloudService *service = (CCloudService*)obj; + for (auto &service : Services) { + auto it = service->InterceptedContacts.find(hContact); + if (it != service->InterceptedContacts.end()) + service->InterceptedContacts.erase(it); + } + return 0; +} + +int OnModulesLoaded(WPARAM, LPARAM) +{ + + HookEvent(ME_PROTO_ACK, OnProtoAck); - auto it = service->InterceptedContacts.find(hContact); - if (it != service->InterceptedContacts.end()) - service->InterceptedContacts.erase(it); + // options + HookEvent(ME_OPT_INITIALISE, OnOptionsInitialized); + + // srfile + HookEvent(ME_FILEDLG_CANCELED, OnFileDialogCanceled); + + HookEvent(ME_CLIST_PREBUILDCONTACTMENU, OnPrebuildContactMenu); + + HookEvent(ME_MSG_WINDOWEVENT, OnSrmmWindowOpened); + HookEvent(ME_MSG_BUTTONPRESSED, OnSrmmButtonPressed); + + HookTemporaryEvent(ME_MSG_TOOLBARLOADED, OnSrmmToolbarLoaded); return 0; -} +} \ No newline at end of file -- cgit v1.2.3