summaryrefslogtreecommitdiff
path: root/plugins/Dropbox/src
diff options
context:
space:
mode:
authorAlexander Lantsev <aunsane@gmail.com>2014-04-04 19:43:40 +0000
committerAlexander Lantsev <aunsane@gmail.com>2014-04-04 19:43:40 +0000
commit7e7e977e3dd74fe09c62d7b345bbbbecf33602a4 (patch)
tree88dc22b8f60b4a9b132bb4836eef1a140570ad04 /plugins/Dropbox/src
parentc8a6fc65ff5e3f53a9b7695f1d9674b7d7886566 (diff)
Dropbox: hides "Send to Dropbox" item when protocol is offline
git-svn-id: http://svn.miranda-ng.org/main/trunk@8857 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Dropbox/src')
-rw-r--r--plugins/Dropbox/src/dropbox_events.cpp3
-rw-r--r--plugins/Dropbox/src/dropbox_menus.cpp3
2 files changed, 4 insertions, 2 deletions
diff --git a/plugins/Dropbox/src/dropbox_events.cpp b/plugins/Dropbox/src/dropbox_events.cpp
index df5dfc14a4..efd8687762 100644
--- a/plugins/Dropbox/src/dropbox_events.cpp
+++ b/plugins/Dropbox/src/dropbox_events.cpp
@@ -92,6 +92,7 @@ int CDropbox::OnSrmmWindowOpened(void *obj, WPARAM wParam, LPARAM lParam)
if (ev->uType == MSG_WINDOW_EVT_OPENING && ev->hContact)
{
char *proto = GetContactProto(ev->hContact);
+ bool isProtoOnline = CallProtoService(proto, PS_GETSTATUS, 0, 0) > ID_STATUS_OFFLINE;
WORD status = db_get_w(ev->hContact, proto, "Status", ID_STATUS_OFFLINE);
bool canSendOffline = (CallProtoService(proto, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_IMSENDOFFLINE) > 0;
@@ -101,7 +102,7 @@ int CDropbox::OnSrmmWindowOpened(void *obj, WPARAM wParam, LPARAM lParam)
bbd.bbbFlags = BBSF_RELEASED;
if (!instance->HasAccessToken() || ev->hContact == instance->GetDefaultContact() || !instance->HasAccessToken())
bbd.bbbFlags = BBSF_HIDDEN | BBSF_DISABLED;
- else if (status == ID_STATUS_OFFLINE && !canSendOffline)
+ else if (!isProtoOnline || (status == ID_STATUS_OFFLINE && !canSendOffline))
bbd.bbbFlags = BBSF_DISABLED;
CallService(MS_BB_SETBUTTONSTATE, ev->hContact, (LPARAM)&bbd);
diff --git a/plugins/Dropbox/src/dropbox_menus.cpp b/plugins/Dropbox/src/dropbox_menus.cpp
index fe5f38d234..615aec238e 100644
--- a/plugins/Dropbox/src/dropbox_menus.cpp
+++ b/plugins/Dropbox/src/dropbox_menus.cpp
@@ -27,10 +27,11 @@ int CDropbox::OnPrebuildContactMenu(void *obj, WPARAM hContact, LPARAM lParam)
return 0;
char *proto = GetContactProto(hContact);
+ bool isProtoOnline = CallProtoService(proto, PS_GETSTATUS, 0, 0) > ID_STATUS_OFFLINE;
WORD status = db_get_w(hContact, proto, "Status", ID_STATUS_OFFLINE);
bool canSendOffline = (CallProtoService(proto, PS_GETCAPS, PFLAGNUM_4, 0) & PF4_IMSENDOFFLINE) > 0;
- if (hContact != instance->GetDefaultContact() && (status != ID_STATUS_OFFLINE || canSendOffline) && instance->HasAccessToken() && !instance->hTransferContact)
+ if (hContact != instance->GetDefaultContact() && isProtoOnline && (status != ID_STATUS_OFFLINE || canSendOffline) && instance->HasAccessToken() && !instance->hTransferContact)
Menu_ShowItem(instance->contactMenuItems[CMI_SEND_FILES], TRUE);
return 0;