summaryrefslogtreecommitdiff
path: root/plugins/Dropbox
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2016-12-01 19:33:16 +0300
committerGeorge Hazan <ghazan@miranda.im>2016-12-01 19:33:35 +0300
commit06fc3d811d71a44b92d45e1263e5fb0099a7304e (patch)
treecbcdafbcddacab601a6d47321ec09aac5d5e5c0c /plugins/Dropbox
parentbd408d296ccfa16dba379f3820a2007ff6963a6a (diff)
toolbar icons processing code moved to mir_app
Diffstat (limited to 'plugins/Dropbox')
-rw-r--r--plugins/Dropbox/src/dropbox.cpp1
-rw-r--r--plugins/Dropbox/src/dropbox.h1
-rw-r--r--plugins/Dropbox/src/dropbox_events.cpp45
-rw-r--r--plugins/Dropbox/src/dropbox_options.cpp5
4 files changed, 16 insertions, 36 deletions
diff --git a/plugins/Dropbox/src/dropbox.cpp b/plugins/Dropbox/src/dropbox.cpp
index de21e2613c..74dd9acee9 100644
--- a/plugins/Dropbox/src/dropbox.cpp
+++ b/plugins/Dropbox/src/dropbox.cpp
@@ -3,7 +3,6 @@
CDropbox::CDropbox() : transfers(1, HandleKeySortT)
{
HookEvent(ME_PROTO_ACK, OnProtoAck);
- HookEvent(ME_SYSTEM_PRESHUTDOWN, OnPreShutdown);
HookEventObj(ME_SYSTEM_MODULESLOADED, GlobalEvent<&CDropbox::OnModulesLoaded>, this);
hUploadedEventHook = CreateHookableEvent(ME_DROPBOX_UPLOADED);
diff --git a/plugins/Dropbox/src/dropbox.h b/plugins/Dropbox/src/dropbox.h
index 5c1efa5d08..577bd190fc 100644
--- a/plugins/Dropbox/src/dropbox.h
+++ b/plugins/Dropbox/src/dropbox.h
@@ -41,7 +41,6 @@ private:
// hooks
static int OnProtoAck(WPARAM wParam, LPARAM lParam);
- static int OnPreShutdown(WPARAM wParam, LPARAM lParam);
int OnModulesLoaded(WPARAM wParam, LPARAM lParam);
int OnContactDeleted(WPARAM wParam, LPARAM lParam);
int OnOptionsInitialized(WPARAM wParam, LPARAM lParam);
diff --git a/plugins/Dropbox/src/dropbox_events.cpp b/plugins/Dropbox/src/dropbox_events.cpp
index 61a5b7203b..6e07cd1713 100644
--- a/plugins/Dropbox/src/dropbox_events.cpp
+++ b/plugins/Dropbox/src/dropbox_events.cpp
@@ -21,33 +21,16 @@ int CDropbox::OnModulesLoaded(WPARAM, LPARAM)
WORD status = ProtoGetStatus(0, 0);
ProtoBroadcastAck(MODULE, NULL, ACKTYPE_STATUS, ACKRESULT_SUCCESS, (HANDLE)ID_STATUS_OFFLINE, status);
- if (ServiceExists(MS_BB_ADDBUTTON)) {
- BBButton bbd = { sizeof(bbd) };
- bbd.pszModuleName = MODULE;
-
- bbd.bbbFlags = BBBF_ISIMBUTTON | BBBF_ISCHATBUTTON | BBBF_ISRSIDEBUTTON;
- bbd.pwszTooltip = TranslateT("Upload files to Dropbox");
- bbd.hIcon = GetIconHandleByName("upload");
- bbd.dwButtonID = BBB_ID_FILE_SEND;
- bbd.dwDefPos = 100 + bbd.dwButtonID;
- CallService(MS_BB_ADDBUTTON, 0, (LPARAM)&bbd);
-
- HookEventObj(ME_MSG_BUTTONPRESSED, GlobalEvent<&CDropbox::OnTabSrmmButtonPressed>, this);
- }
-
- return 0;
-}
-
-int CDropbox::OnPreShutdown(WPARAM, LPARAM)
-{
- if (ServiceExists(MS_BB_ADDBUTTON)) {
- BBButton bbd = { sizeof(bbd) };
- bbd.pszModuleName = MODULE;
-
- bbd.dwButtonID = BBB_ID_FILE_SEND;
- CallService(MS_BB_REMOVEBUTTON, 0, (LPARAM)&bbd);
- }
-
+ BBButton bbd = {};
+ bbd.pszModuleName = MODULE;
+ bbd.bbbFlags = BBBF_ISIMBUTTON | BBBF_ISCHATBUTTON | BBBF_ISRSIDEBUTTON;
+ bbd.pwszTooltip = TranslateT("Upload files to Dropbox");
+ bbd.hIcon = GetIconHandleByName("upload");
+ bbd.dwButtonID = BBB_ID_FILE_SEND;
+ bbd.dwDefPos = 100 + bbd.dwButtonID;
+ Srmm_AddButton(&bbd);
+
+ HookEventObj(ME_MSG_BUTTONPRESSED, GlobalEvent<&CDropbox::OnTabSrmmButtonPressed>, this);
return 0;
}
@@ -70,7 +53,7 @@ int CDropbox::OnSrmmWindowOpened(WPARAM, LPARAM lParam)
WORD status = db_get_w(ev->hContact, proto, "Status", ID_STATUS_OFFLINE);
bool canSendOffline = (CallProtoService(proto, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_IMSENDOFFLINE) > 0;
- BBButton bbd = { sizeof(bbd) };
+ BBButton bbd = {};
bbd.pszModuleName = MODULE;
bbd.dwButtonID = BBB_ID_FILE_SEND;
bbd.bbbFlags = BBSF_RELEASED;
@@ -79,7 +62,7 @@ int CDropbox::OnSrmmWindowOpened(WPARAM, LPARAM lParam)
else if (!isProtoOnline || (status == ID_STATUS_OFFLINE && !canSendOffline))
bbd.bbbFlags = BBSF_DISABLED;
- CallService(MS_BB_SETBUTTONSTATE, ev->hContact, (LPARAM)&bbd);
+ Srmm_SetButtonState(ev->hContact, &bbd);
}
return 0;
@@ -132,7 +115,7 @@ int CDropbox::OnProtoAck(WPARAM, LPARAM lParam)
msgw.cbSize = sizeof(msgw);
if (!CallService(MS_MSG_GETWINDOWDATA, (WPARAM)&msgwi, (LPARAM)&msgw) && msgw.uState & MSG_WINDOW_STATE_EXISTS) {
- BBButton bbd = { sizeof(bbd) };
+ BBButton bbd = {};
bbd.pszModuleName = MODULE;
bbd.dwButtonID = BBB_ID_FILE_SEND;
bbd.bbbFlags = BBSF_RELEASED;
@@ -140,7 +123,7 @@ int CDropbox::OnProtoAck(WPARAM, LPARAM lParam)
if (status == ID_STATUS_OFFLINE && !canSendOffline)
bbd.bbbFlags = BBSF_DISABLED;
- CallService(MS_BB_SETBUTTONSTATE, hContact, (LPARAM)&bbd);
+ Srmm_SetButtonState(hContact, &bbd);
}
}
}
diff --git a/plugins/Dropbox/src/dropbox_options.cpp b/plugins/Dropbox/src/dropbox_options.cpp
index 142a22b407..8403890397 100644
--- a/plugins/Dropbox/src/dropbox_options.cpp
+++ b/plugins/Dropbox/src/dropbox_options.cpp
@@ -133,12 +133,11 @@ void CDropboxOptionsInterception::OnApply()
msgw.cbSize = sizeof(msgw);
if (!CallService(MS_MSG_GETWINDOWDATA, (WPARAM)&msgwi, (LPARAM)&msgw) && msgw.uState & MSG_WINDOW_STATE_EXISTS) {
- BBButton bbd = { sizeof(bbd) };
+ BBButton bbd = {};
bbd.pszModuleName = MODULE;
bbd.dwButtonID = BBB_ID_FILE_SEND;
bbd.bbbFlags = BBSF_HIDDEN | BBSF_DISABLED;
-
- CallService(MS_BB_SETBUTTONSTATE, hContact, (LPARAM)&bbd);
+ Srmm_SetButtonState(hContact, &bbd);
}
}
}