summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-05-11 17:45:34 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-05-11 17:45:34 +0000
commit5ce57feec521140e4d6e11977ce1794ca7bf4a61 (patch)
tree7df47008fbd810350cb7fbcca91f0520cda4befc /plugins
parentb10fd8dfb267a67419a043cfc5a1d8ec56a031a1 (diff)
no need to display Dropbox menu item for chats
git-svn-id: http://svn.miranda-ng.org/main/trunk@13553 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins')
-rw-r--r--plugins/Dropbox/src/dropbox_menus.cpp32
1 files changed, 15 insertions, 17 deletions
diff --git a/plugins/Dropbox/src/dropbox_menus.cpp b/plugins/Dropbox/src/dropbox_menus.cpp
index cec9cc2988..79bf9d31eb 100644
--- a/plugins/Dropbox/src/dropbox_menus.cpp
+++ b/plugins/Dropbox/src/dropbox_menus.cpp
@@ -17,10 +17,8 @@ void CDropbox::InitializeMenus()
{
CLISTMENUITEM mi = { 0 };
mi.cbSize = sizeof(CLISTMENUITEM);
- mi.flags = CMIF_TCHAR;
-
mi.pszService = MODULE"/SendFilesToDropbox";
- mi.ptszName = LPGENT("Send files to Dropbox");
+ mi.pszName = LPGEN("Send files to Dropbox");
mi.position = -2000020000 + CMI_SEND_FILES;
mi.icolibItem = GetIconHandle(IDI_DROPBOX);
contactMenuItems[CMI_SEND_FILES] = Menu_AddContactMenuItem(&mi);
@@ -29,23 +27,23 @@ void CDropbox::InitializeMenus()
int CDropbox::OnPrebuildContactMenu(void *obj, WPARAM hContact, LPARAM)
{
- CDropbox *instance = (CDropbox*)obj;
-
if (!hContact)
return 0;
- Menu_ShowItem(instance->contactMenuItems[CMI_SEND_FILES], FALSE);
-
- if (!instance->HasAccessToken())
- 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() && isProtoOnline && (status != ID_STATUS_OFFLINE || canSendOffline) && instance->HasAccessToken() && !instance->hTransferContact)
- Menu_ShowItem(instance->contactMenuItems[CMI_SEND_FILES], TRUE);
+ BOOL bShow = FALSE;
+ CDropbox *instance = (CDropbox*)obj;
+ if (instance->HasAccessToken() && !instance->hTransferContact && hContact != instance->GetDefaultContact()) {
+ char *proto = GetContactProto(hContact);
+ if (proto && !db_get_b(hContact, proto, "ChatRoom", 0)) {
+ 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 (isProtoOnline && (status != ID_STATUS_OFFLINE || canSendOffline))
+ bShow = TRUE;
+ }
+ }
+
+ Menu_ShowItem(instance->contactMenuItems[CMI_SEND_FILES], bShow);
return 0;
}