From cf66cecdb6cf9f06720c4604fadf74ca0a0dbcd8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20P=C3=B6sel?= Date: Wed, 23 May 2012 13:47:55 +0000 Subject: MenuItemEx: - added option for refreshing contact details - some cleanup git-svn-id: http://svn.miranda-ng.org/main/trunk@148 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/MenuItemEx/main.c | 9 +- plugins/MenuItemEx/menuex.h | 35 ++--- plugins/MenuItemEx/menuex_10.vcxproj | 16 +++ plugins/MenuItemEx/menuex_10.vcxproj.filters | 44 ++++++ plugins/MenuItemEx/options.c | 21 +-- plugins/MenuItemEx/resource.h | 4 +- plugins/MenuItemEx/resource.rc | 203 ++++++++++++++++++++++++++- 7 files changed, 294 insertions(+), 38 deletions(-) (limited to 'plugins/MenuItemEx') diff --git a/plugins/MenuItemEx/main.c b/plugins/MenuItemEx/main.c index 2f7c998807..b2eac8f810 100644 --- a/plugins/MenuItemEx/main.c +++ b/plugins/MenuItemEx/main.c @@ -767,7 +767,7 @@ INT_PTR onCopyID(WPARAM wparam,LPARAM lparam) GetID(hContact,szProto,(LPSTR)&szID); - if(DBGetContactSettingWord(NULL,VISPLG,"flags",vf_default)&VF_CIDN) { + if(DBGetContactSettingDword(NULL,VISPLG,"flags",vf_default)&VF_CIDN) { if (bMir_08) pa = (PROTOACCOUNT*)CallService(MS_PROTO_GETACCOUNT, 0, (LPARAM)szProto); @@ -793,7 +793,7 @@ INT_PTR onCopyStatusMsg(WPARAM wparam,LPARAM lparam) char par[32]; TCHAR buffer[2048]; int i; - WORD flags=DBGetContactSettingWord(NULL,VISPLG,"flags",vf_default); + DWORD flags=DBGetContactSettingDword(NULL,VISPLG,"flags",vf_default); module = (LPSTR) CallService(MS_PROTO_GETCONTACTBASEPROTO, wparam, 0); if(!module) return 0; @@ -961,7 +961,7 @@ static void ModifySubmenuItem(HANDLE hItem, TCHAR* name, int checked, int hidden int BuildMenu(WPARAM wparam,LPARAM lparam) { CLISTMENUITEM miAV={0},miNV,miHFL,miIGN,miPROTO,miADD,miREQ,miCID,miRECV,miSTAT,miCIP,miCMV; - WORD flags=DBGetContactSettingWord(NULL,VISPLG,"flags",vf_default); + DWORD flags=DBGetContactSettingDword(NULL,VISPLG,"flags",vf_default); int i = 0, j = 0, check = 0, all = 0, hide = 0; BOOL bIsOnline = FALSE, bShowAll = CTRL_IS_PRESSED; PROTOACCOUNT* pa; @@ -1198,7 +1198,8 @@ static int ContactSettingChanged( WPARAM wParam, LPARAM lParam ) DBDeleteContactSetting( ( HANDLE )wParam, lpzProto, "LogoffTS"); // TESTING: updating user's details - CallContactService( ( HANDLE )wParam, PSS_GETINFO, 0, 0 ); + if (DBGetContactSettingDword(NULL, VISPLG, "flags", vf_default) & VF_REFRESH) + CallContactService( ( HANDLE )wParam, PSS_GETINFO, 0, 0 ); } if (newStatus == ID_STATUS_OFFLINE) { diff --git a/plugins/MenuItemEx/menuex.h b/plugins/MenuItemEx/menuex.h index 73428fb68d..6e738c04a6 100644 --- a/plugins/MenuItemEx/menuex.h +++ b/plugins/MenuItemEx/menuex.h @@ -50,23 +50,24 @@ int OptionsInit(WPARAM,LPARAM); #define MAX_GROUPS 32 #define MAX_IDLEN 16 -#define VF_VS 0x0001 -#define VF_SMNAME 0x0002 -#define VF_HFL 0x0004 -#define VF_IGN 0x0008 -#define VF_PROTO 0x0010 -#define VF_SHOWID 0x0020 -#define VF_ADD 0x0040 -#define VF_REQ 0x0080 -#define VF_CID 0x0100 -#define VF_RECV 0x0200 -#define VF_STAT 0x0400 -#define VF_CIDN 0x0800 -#define VF_CIP 0x1000 -#define VF_SAI 0x2000 -#define VF_TRIMID 0x4000 -#define VF_CMV 0x8000 -#define VF_IGNH 0x10000 +#define VF_VS 0x00000001 +#define VF_SMNAME 0x00000002 +#define VF_HFL 0x00000004 +#define VF_IGN 0x00000008 +#define VF_PROTO 0x00000010 +#define VF_SHOWID 0x00000020 +#define VF_ADD 0x00000040 +#define VF_REQ 0x00000080 +#define VF_CID 0x00000100 +#define VF_RECV 0x00000200 +#define VF_STAT 0x00000400 +#define VF_CIDN 0x00000800 +#define VF_CIP 0x00001000 +#define VF_SAI 0x00002000 +#define VF_TRIMID 0x00004000 +#define VF_CMV 0x00008000 +#define VF_IGNH 0x00010000 +#define VF_REFRESH 0x00020000 #define CTRL_IS_PRESSED (GetAsyncKeyState(VK_CONTROL)&0x8000) diff --git a/plugins/MenuItemEx/menuex_10.vcxproj b/plugins/MenuItemEx/menuex_10.vcxproj index 44569e50ee..8caf798869 100644 --- a/plugins/MenuItemEx/menuex_10.vcxproj +++ b/plugins/MenuItemEx/menuex_10.vcxproj @@ -291,6 +291,22 @@ _WIN64;%(PreprocessorDefinitions) + + + + + + + + + + + + + + + + diff --git a/plugins/MenuItemEx/menuex_10.vcxproj.filters b/plugins/MenuItemEx/menuex_10.vcxproj.filters index 195d7c544c..7d0db3342a 100644 --- a/plugins/MenuItemEx/menuex_10.vcxproj.filters +++ b/plugins/MenuItemEx/menuex_10.vcxproj.filters @@ -41,4 +41,48 @@ Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + + Resource Files + + \ No newline at end of file diff --git a/plugins/MenuItemEx/options.c b/plugins/MenuItemEx/options.c index ca14de03e8..6b3944d0c2 100644 --- a/plugins/MenuItemEx/options.c +++ b/plugins/MenuItemEx/options.c @@ -24,12 +24,13 @@ static const checkboxes[]={ { IDC_COPYIDNAME, VF_CIDN }, { IDC_RECVFILES, VF_RECV }, { IDC_SMNAME, VF_SMNAME }, - { IDC_TRIMID, VF_TRIMID } + { IDC_TRIMID, VF_TRIMID }, + { IDC_REFRESH_DETAILS, VF_REFRESH } }; INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) { - WORD flags=DBGetContactSettingWord(NULL,VISPLG,"flags",vf_default); + DWORD flags=DBGetContactSettingDword(NULL,VISPLG,"flags",vf_default); TCHAR buffer[64] = {0}; int i; @@ -41,10 +42,7 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) for (i = 0; i < SIZEOF(checkboxes); i++) { - if (checkboxes[i].flag == VF_IGNH) - CheckDlgButton(hdlg, checkboxes[i].idc, (DBGetContactSettingByte(NULL, VISPLG, "ignorehide", 0)) ? BST_CHECKED : BST_UNCHECKED); - else - CheckDlgButton(hdlg, checkboxes[i].idc, (flags & checkboxes[i].flag) ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hdlg, checkboxes[i].idc, (flags & checkboxes[i].flag) ? BST_CHECKED : BST_UNCHECKED); } if (ServiceExists(MS_POPUP_ADDPOPUP)) @@ -85,20 +83,15 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) switch(((LPNMHDR)lparam)->code){ case PSN_APPLY: { - WORD mod_flags=0; - int ignh=0; + DWORD mod_flags=0; for (i = 0; i < SIZEOF(checkboxes); i++) { - if (checkboxes[i].flag == VF_IGNH) - ignh = IsDlgButtonChecked(hdlg, checkboxes[i].idc); - else - mod_flags |= IsDlgButtonChecked(hdlg, checkboxes[i].idc) ? checkboxes[i].flag : 0; + mod_flags |= IsDlgButtonChecked(hdlg, checkboxes[i].idc) ? checkboxes[i].flag : 0; } //DBDeleteContactSetting(NULL,VISPLG,"flags"); - DBWriteContactSettingWord(NULL,VISPLG,"flags",mod_flags); - DBWriteContactSettingByte(NULL,VISPLG,"ignorehide",ignh); + DBWriteContactSettingDword(NULL,VISPLG,"flags",mod_flags); return 1; } diff --git a/plugins/MenuItemEx/resource.h b/plugins/MenuItemEx/resource.h index 888d5d46ab..f24747f3c9 100644 --- a/plugins/MenuItemEx/resource.h +++ b/plugins/MenuItemEx/resource.h @@ -1,6 +1,6 @@ //{{NO_DEPENDENCIES}} // Microsoft Visual C++ generated include file. -// Used by menuex.rc +// Used by resource.rc // #define IDD_OPTIONS 101 #define IDD_AUTHREQ 103 @@ -23,6 +23,7 @@ #define IDC_HIDE 1002 #define IDC_IGNORE 1003 #define IDC_PROTOS 1004 +#define IDC_REFRESH_DETAILS 1005 #define IDC_ADDED 1006 #define IDC_AUTHREQ 1007 #define IDC_COPYID 1008 @@ -37,6 +38,7 @@ #define IDC_SHOWID 1017 #define IDC_TRIMID 1018 #define IDC_IGNOREHIDE 1019 +#define __PLUGIN_ID 4303 #define IDC_STATIC -1 // Next default values for new objects diff --git a/plugins/MenuItemEx/resource.rc b/plugins/MenuItemEx/resource.rc index 0c167a2251..7c9a68781c 100644 --- a/plugins/MenuItemEx/resource.rc +++ b/plugins/MenuItemEx/resource.rc @@ -1,2 +1,201 @@ -#include "menuex.rc" -#include "version.rc" +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// Neutral resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU) +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +#pragma code_page(1250) + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_ICON0 ICON "icons\\hide_from_list.ico" +IDI_ICON1 ICON "icons\\Always Visible.ico" +IDI_ICON2 ICON "icons\\Never Visible.ico" +IDI_ICON3 ICON "icons\\copyid_overlay.ico" +IDI_ICON4 ICON "icons\\auth_added.ico" +IDI_ICON5 ICON "icons\\auth_ask.ico" +IDI_ICON6 ICON "icons\\change_proto.ico" +IDI_ICON7 ICON "icons\\ignore_list.ico" +IDI_ICON8 ICON "icons\\show_in_list.ico" +IDI_ICON9 ICON "icons\\msg_status.ico" +IDI_ICON10 ICON "icons\\msg_xstatus.ico" +IDI_ICON11 ICON "icons\\copyip_overlay.ico" +IDI_ICON12 ICON "icons\\recv_files.ico" +IDI_ICON13 ICON "icons\\CopyMirVer.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_AUTHREQ DIALOGEX 0, 0, 186, 95 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP | WS_VISIBLE | WS_CAPTION +CAPTION "Enter an authorization request" +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + DEFPUSHBUTTON "&Send",IDOK,34,74,50,14 + PUSHBUTTON "&Cancel",IDCANCEL,98,74,50,14 + EDITTEXT IDC_REASON,7,7,172,59,ES_MULTILINE | ES_AUTOVSCROLL | ES_WANTRETURN +END + +IDD_OPTIONS DIALOGEX 0, 0, 280, 217 +STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD | WS_VISIBLE +EXSTYLE WS_EX_CONTROLPARENT +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + GROUPBOX "Shown menu items",IDC_STATIC,7,7,266,173 + CONTROL "Visibility",IDC_VIS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,18,136,10 + CONTROL "Show alpha icons",IDC_SHOWALPHAICONS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,162,18,105,10 + CONTROL "Hide from list",IDC_HIDE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,30,136,10 + CONTROL "Ignore",IDC_IGNORE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,42,136,10 + CONTROL "Copy to Account (Ctrl+click for move to Account)",IDC_PROTOS, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,54,251,10 + CONTROL "Send 'You were added'",IDC_ADDED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,66,136,10 + CONTROL "Request Authorization",IDC_AUTHREQ,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,78,136,10 + CONTROL "Browse Received Files",IDC_RECVFILES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,90,136,10 + CONTROL "Copy IP",IDC_COPYIP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,102,136,10 + CONTROL "Copy MirVer",IDC_COPYMIRVER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,114,136,10 + CONTROL "Copy Status Message",IDC_STATUSMSG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,126,136,10 + CONTROL "Add item name",IDC_SMNAME,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,162,126,105,10 + CONTROL "Copy ID",IDC_COPYID,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,138,136,10 + CONTROL "Add protocol name",IDC_COPYIDNAME,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,162,138,105,10 + CONTROL "Show ID in menu item",IDC_SHOWID,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,150,127,10 + CONTROL "Trim too long ID",IDC_TRIMID,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,162,150,105,10 + LTEXT "* Use Ctrl+click to see popup with the copied text",IDC_HINT1,16,164,251,11 + CONTROL "Hide contact on 'Ignore all'",IDC_IGNOREHIDE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,162,42,105,10 + GROUPBOX "Other options",IDC_STATIC,7,184,266,27 + CONTROL "Automatically refresh contact's details after they comes online",IDC_REFRESH_DETAILS, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,196,251,10 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO +BEGIN + IDD_AUTHREQ, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 179 + TOPMARGIN, 7 + BOTTOMMARGIN, 64 + END + + IDD_OPTIONS, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 273 + VERTGUIDE, 16 + VERTGUIDE, 25 + VERTGUIDE, 152 + VERTGUIDE, 162 + VERTGUIDE, 214 + VERTGUIDE, 267 + TOPMARGIN, 7 + BOTTOMMARGIN, 211 + END +END +#endif // APSTUDIO_INVOKED + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" + "version.rc\0" +END + +2 TEXTINCLUDE +BEGIN + "#include \r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 1,3,0,9 + PRODUCTVERSION 1,3,0,9 + FILEFLAGSMASK 0x17L +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x4L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "FileDescription", "MenuItemEx plugin for Miranda IM" + VALUE "FileVersion", "1.3.0.9" + VALUE "InternalName", "menuex" + VALUE "LegalCopyright", "© 2001-03 Heiko Schillinger, © 2006-08 Baloo, © 2009-10 Billy_Bons, © 2011-12 Robert Posel" + VALUE "OriginalFilename", "menuex.dll" + VALUE "ProductName", "menuex" + VALUE "ProductVersion", "1.3.0.9" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // Neutral resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + -- cgit v1.2.3