From fdea2aec4a7900eec09c2597cd499571003f5ce4 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Tue, 10 Sep 2013 12:09:56 +0000 Subject: unneeded functionality removed from MenuItemEx git-svn-id: http://svn.miranda-ng.org/main/trunk@6042 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/MenuItemEx/docs/menuex_changelog.txt | 3 - plugins/MenuItemEx/res/resource.rc | 3 - plugins/MenuItemEx/src/main.cpp | 86 ++------------ plugins/MenuItemEx/src/menuex.h | 2 - plugins/MenuItemEx/src/options.cpp | 163 ++++++++++++--------------- plugins/MenuItemEx/src/resource.h | 1 - plugins/MenuItemEx/src/version.h | 2 +- 7 files changed, 82 insertions(+), 178 deletions(-) (limited to 'plugins/MenuItemEx') diff --git a/plugins/MenuItemEx/docs/menuex_changelog.txt b/plugins/MenuItemEx/docs/menuex_changelog.txt index 640fbb80ce..153db11adf 100644 --- a/plugins/MenuItemEx/docs/menuex_changelog.txt +++ b/plugins/MenuItemEx/docs/menuex_changelog.txt @@ -1,9 +1,6 @@ Version 1.3.0.9 -[+] Refresh contact info when contact comes online [+] Ability to hide contact from contact list when 'Ignore All' -[+] Saving lastseen datetime of contact (as DWORD in \LogoffTS) (reset when offline) -[+] Saving logon time (as DWORD in \LogonTS) (reset when online) Verison 1.3.0.8 diff --git a/plugins/MenuItemEx/res/resource.rc b/plugins/MenuItemEx/res/resource.rc index 5d5c6430b0..0f3cafeb30 100644 --- a/plugins/MenuItemEx/res/resource.rc +++ b/plugins/MenuItemEx/res/resource.rc @@ -79,9 +79,6 @@ BEGIN 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 come online",IDC_REFRESH_DETAILS, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,196,251,10 END diff --git a/plugins/MenuItemEx/src/main.cpp b/plugins/MenuItemEx/src/main.cpp index c89089478d..d2b0a2be58 100644 --- a/plugins/MenuItemEx/src/main.cpp +++ b/plugins/MenuItemEx/src/main.cpp @@ -66,14 +66,14 @@ struct { int icon; } static const ii[] = { - { LPGENT("All"), IGNOREEVENT_ALL, SKINICON_OTHER_FILLEDBLOB }, - { LPGENT("Messages"), IGNOREEVENT_MESSAGE, SKINICON_EVENT_MESSAGE }, - { LPGENT("URL"), IGNOREEVENT_URL, SKINICON_EVENT_URL }, - { LPGENT("Files"), IGNOREEVENT_FILE, SKINICON_EVENT_FILE }, - { LPGENT("User Online"), IGNOREEVENT_USERONLINE, SKINICON_OTHER_USERONLINE }, - { LPGENT("Authorization"), IGNOREEVENT_AUTHORIZATION, SKINICON_AUTH_REQUEST }, - { LPGENT("You Were Added"), IGNOREEVENT_YOUWEREADDED, SKINICON_AUTH_ADD }, - { LPGENT("Typing Notify"), IGNOREEVENT_TYPINGNOTIFY, SKINICON_OTHER_TYPING } + { LPGENT("All"), IGNOREEVENT_ALL, SKINICON_OTHER_FILLEDBLOB }, + { LPGENT("Messages"), IGNOREEVENT_MESSAGE, SKINICON_EVENT_MESSAGE }, + { LPGENT("URL"), IGNOREEVENT_URL, SKINICON_EVENT_URL }, + { LPGENT("Files"), IGNOREEVENT_FILE, SKINICON_EVENT_FILE }, + { LPGENT("User Online"), IGNOREEVENT_USERONLINE, SKINICON_OTHER_USERONLINE }, + { LPGENT("Authorization"), IGNOREEVENT_AUTHORIZATION, SKINICON_AUTH_REQUEST }, + { LPGENT("You Were Added"), IGNOREEVENT_YOUWEREADDED, SKINICON_AUTH_ADD }, + { LPGENT("Typing Notify"), IGNOREEVENT_TYPINGNOTIFY, SKINICON_OTHER_TYPING } }; PLUGININFOEX pluginInfoEx = { @@ -979,71 +979,6 @@ static int ContactWindowOpen(WPARAM wparam,LPARAM lParam) return 0; } -//======================================================================================== - -struct SaveStatus -{ - HANDLE hContact; - int iStatus; -}; - -static LIST saveStatuses(100, (LIST::FTSortFunc)HandleKeySortT); - -static int ContactSettingChanged( WPARAM wParam, LPARAM lParam ) -{ - DBCONTACTWRITESETTING *cws = ( DBCONTACTWRITESETTING* )lParam; - HANDLE hContact = ( HANDLE )wParam; - if (hContact == NULL || lstrcmpA( cws->szSetting, "Status" )) - return 0; - - int oldStatus = ID_STATUS_OFFLINE, newStatus = cws->value.wVal; - - SaveStatus tmp = { hContact, 0 }, *p; - if (( p = saveStatuses.find( &tmp )) != NULL) - oldStatus = p->iStatus; - if (oldStatus == newStatus) - return 0; - - char *lpzProto = GetContactProto(hContact); - - // ignore chat rooms - if (db_get_b(hContact, lpzProto, "ChatRoom", 0)) - return 0; - - if (oldStatus == ID_STATUS_OFFLINE) { - // set logon timestamp for this contact, only when not set already - if (!db_get_dw(hContact, lpzProto, "LogonTS", FALSE)) - db_set_dw(hContact, lpzProto, "LogonTS", ( DWORD )time(NULL)); - - // reset logoff timestamp - db_unset(hContact, lpzProto, "LogoffTS"); - - // TESTING: updating user's details - if (db_get_dw(NULL, MODULENAME, "flags", vf_default) & VF_REFRESH) { - // don't refresh Hidden or NotOnList contact's details - if (!db_get_b(hContact, "CList", "Hidden", 0) && !db_get_b((HANDLE)wParam, "CList", "NotOnList", 0)) - CallContactService(hContact, PSS_GETINFO, 0, 0 ); - } - } - if (newStatus == ID_STATUS_OFFLINE) { - // set logoff timestamp for this contact - db_set_dw(hContact, lpzProto, "LogoffTS", ( DWORD )time(NULL)); - // reset logon timestamp - db_unset(hContact, lpzProto, "LogonTS"); - } - - if (p != NULL) - p->iStatus = newStatus; - else { - p = new SaveStatus; - p->hContact = hContact; - p->iStatus = newStatus; - saveStatuses.insert(p); - } - - return 0; -} - static int ModuleLoad(WPARAM wParam, LPARAM lParam) { bPopupService = ServiceExists(MS_POPUP_ADDPOPUP); @@ -1171,7 +1106,6 @@ static int PluginInit(WPARAM wparam,LPARAM lparam) HookEvent(ME_CLIST_PREBUILDCONTACTMENU,BuildMenu); HookEvent(ME_OPT_INITIALISE,OptionsInit); - HookEvent(ME_DB_CONTACT_SETTINGCHANGED,ContactSettingChanged); HookEvent(ME_PROTO_ACCLISTCHANGED, EnumProtoSubmenu); if (HookEvent(ME_MSG_TOOLBARLOADED, TabsrmmButtonsInit)) { HookEvent(ME_MSG_BUTTONPRESSED, TabsrmmButtonPressed); @@ -1197,10 +1131,6 @@ extern "C" __declspec(dllexport) int Load(void) extern "C" __declspec(dllexport) int Unload(void) { - for (int i=0; i < saveStatuses.getCount(); i++) - delete saveStatuses[i]; - saveStatuses.destroy(); - DestroyIcon(hIcon[3]); DestroyIcon(hIcon[4]); return 0; diff --git a/plugins/MenuItemEx/src/menuex.h b/plugins/MenuItemEx/src/menuex.h index 6e04db8293..48b165fdbb 100644 --- a/plugins/MenuItemEx/src/menuex.h +++ b/plugins/MenuItemEx/src/menuex.h @@ -4,7 +4,6 @@ #define _CRT_SECURE_NO_DEPRECATE #include -#include #include #include @@ -59,7 +58,6 @@ int OptionsInit(WPARAM,LPARAM); #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/src/options.cpp b/plugins/MenuItemEx/src/options.cpp index e1695ee706..48c764df7c 100644 --- a/plugins/MenuItemEx/src/options.cpp +++ b/plugins/MenuItemEx/src/options.cpp @@ -7,25 +7,24 @@ struct { int idc; int flag; } -static const checkboxes[]={ - { IDC_COPYID, VF_CID }, - { IDC_STATUSMSG, VF_STAT }, - { IDC_COPYIP, VF_CIP }, - { IDC_COPYMIRVER, VF_CMV }, - { IDC_VIS, VF_VS }, - { IDC_SHOWALPHAICONS, VF_SAI }, - { IDC_HIDE, VF_HFL }, - { IDC_IGNORE, VF_IGN }, - { IDC_IGNOREHIDE, VF_IGNH }, - { IDC_PROTOS, VF_PROTO }, - { IDC_ADDED, VF_ADD }, - { IDC_AUTHREQ, VF_REQ }, - { IDC_SHOWID, VF_SHOWID }, - { IDC_COPYIDNAME, VF_CIDN }, - { IDC_RECVFILES, VF_RECV }, - { IDC_SMNAME, VF_SMNAME }, - { IDC_TRIMID, VF_TRIMID }, - { IDC_REFRESH_DETAILS, VF_REFRESH } +static const checkboxes[] = { + { IDC_COPYID, VF_CID }, + { IDC_STATUSMSG, VF_STAT }, + { IDC_COPYIP, VF_CIP }, + { IDC_COPYMIRVER, VF_CMV }, + { IDC_VIS, VF_VS }, + { IDC_SHOWALPHAICONS, VF_SAI }, + { IDC_HIDE, VF_HFL }, + { IDC_IGNORE, VF_IGN }, + { IDC_IGNOREHIDE, VF_IGNH }, + { IDC_PROTOS, VF_PROTO }, + { IDC_ADDED, VF_ADD }, + { IDC_AUTHREQ, VF_REQ }, + { IDC_SHOWID, VF_SHOWID }, + { IDC_COPYIDNAME, VF_CIDN }, + { IDC_RECVFILES, VF_RECV }, + { IDC_SMNAME, VF_SMNAME }, + { IDC_TRIMID, VF_TRIMID } }; INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) @@ -34,92 +33,77 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) TCHAR buffer[64] = {0}; int i; - switch(msg) - { - case WM_INITDIALOG: + switch(msg) { + case WM_INITDIALOG: - TranslateDialogDefault(hdlg); + TranslateDialogDefault(hdlg); - for (i = 0; i < SIZEOF(checkboxes); i++) - { - CheckDlgButton(hdlg, checkboxes[i].idc, (flags & checkboxes[i].flag) ? BST_CHECKED : BST_UNCHECKED); - } + for (i = 0; i < SIZEOF(checkboxes); i++) + { + CheckDlgButton(hdlg, checkboxes[i].idc, (flags & checkboxes[i].flag) ? BST_CHECKED : BST_UNCHECKED); + } - if (bPopupService) + if (bPopupService) + { + for (i = 0; i < 4; i++) { - for (i = 0; i < 4; i++) - { - GetDlgItemText(hdlg, checkboxes[i].idc, buffer, SIZEOF(buffer) - 3); - _tcscat(buffer, _T(" *")); - SetDlgItemText(hdlg, checkboxes[i].idc, buffer); - } + GetDlgItemText(hdlg, checkboxes[i].idc, buffer, SIZEOF(buffer) - 3); + _tcscat(buffer, _T(" *")); + SetDlgItemText(hdlg, checkboxes[i].idc, buffer); } - else - ShowWindow(GetDlgItem(hdlg, IDC_HINT1), SW_HIDE); - - SendMessage(hdlg, WM_USER + 50, 0, 0); - return 0; + } + else + ShowWindow(GetDlgItem(hdlg, IDC_HINT1), SW_HIDE); + + SendMessage(hdlg, WM_USER + 50, 0, 0); + return 0; + + case WM_USER+50: + EnableWindow(GetDlgItem(hdlg,IDC_SHOWALPHAICONS), IsDlgButtonChecked(hdlg,IDC_VIS) == BST_CHECKED); + EnableWindow(GetDlgItem(hdlg,IDC_IGNOREHIDE), IsDlgButtonChecked(hdlg,IDC_IGNORE) == BST_CHECKED); + EnableWindow(GetDlgItem(hdlg,IDC_COPYIDNAME), IsDlgButtonChecked(hdlg,IDC_COPYID) == BST_CHECKED); + EnableWindow(GetDlgItem(hdlg,IDC_SHOWID), IsDlgButtonChecked(hdlg,IDC_COPYID) == BST_CHECKED); + EnableWindow(GetDlgItem(hdlg,IDC_TRIMID), (IsDlgButtonChecked(hdlg,IDC_COPYID) == BST_CHECKED && IsDlgButtonChecked(hdlg,IDC_SHOWID) == BST_CHECKED)); + EnableWindow(GetDlgItem(hdlg,IDC_SMNAME), IsDlgButtonChecked(hdlg,IDC_STATUSMSG) == BST_CHECKED); + return 1; + + case WM_NOTIFY: + switch(((LPNMHDR)lparam)->code){ + case PSN_APPLY: + DWORD mod_flags=0; - case WM_USER+50: + for (i = 0; i < SIZEOF(checkboxes); i++) + mod_flags |= IsDlgButtonChecked(hdlg, checkboxes[i].idc) ? checkboxes[i].flag : 0; - EnableWindow(GetDlgItem(hdlg,IDC_SHOWALPHAICONS), - IsDlgButtonChecked(hdlg,IDC_VIS) == BST_CHECKED); - EnableWindow(GetDlgItem(hdlg,IDC_IGNOREHIDE), - IsDlgButtonChecked(hdlg,IDC_IGNORE) == BST_CHECKED); - EnableWindow(GetDlgItem(hdlg,IDC_COPYIDNAME), - IsDlgButtonChecked(hdlg,IDC_COPYID) == BST_CHECKED); - EnableWindow(GetDlgItem(hdlg,IDC_SHOWID), - IsDlgButtonChecked(hdlg,IDC_COPYID) == BST_CHECKED); - EnableWindow(GetDlgItem(hdlg,IDC_TRIMID), - (IsDlgButtonChecked(hdlg,IDC_COPYID) == BST_CHECKED && IsDlgButtonChecked(hdlg,IDC_SHOWID) == BST_CHECKED)); - EnableWindow(GetDlgItem(hdlg,IDC_SMNAME), - IsDlgButtonChecked(hdlg,IDC_STATUSMSG) == BST_CHECKED); + db_set_dw(NULL, MODULENAME, "flags", mod_flags); return 1; - - case WM_NOTIFY: - switch(((LPNMHDR)lparam)->code){ - case PSN_APPLY: - { - DWORD mod_flags=0; - - for (i = 0; i < SIZEOF(checkboxes); i++) - { - mod_flags |= IsDlgButtonChecked(hdlg, checkboxes[i].idc) ? checkboxes[i].flag : 0; - } - - //db_unset(NULL,VISPLG,"flags"); - db_set_dw(NULL, MODULENAME, "flags", mod_flags); - - return 1; - } - } - break; - - case WM_COMMAND: - if (HIWORD(wparam)==BN_CLICKED && GetFocus()==(HWND)lparam) { - SendMessage(GetParent(hdlg),PSM_CHANGED,0,0); - if (LOWORD(wparam) == IDC_VIS || - LOWORD(wparam) == IDC_IGNORE || - LOWORD(wparam) == IDC_COPYID || - LOWORD(wparam) == IDC_STATUSMSG || - LOWORD(wparam) == IDC_SHOWID) { - - SendMessage(hdlg, WM_USER + 50, 0, 0); - } + } + break; + + case WM_COMMAND: + if (HIWORD(wparam)==BN_CLICKED && GetFocus()==(HWND)lparam) { + SendMessage(GetParent(hdlg),PSM_CHANGED,0,0); + if (LOWORD(wparam) == IDC_VIS || + LOWORD(wparam) == IDC_IGNORE || + LOWORD(wparam) == IDC_COPYID || + LOWORD(wparam) == IDC_STATUSMSG || + LOWORD(wparam) == IDC_SHOWID) + { + SendMessage(hdlg, WM_USER + 50, 0, 0); } - return 0; + } + return 0; - case WM_CLOSE: - EndDialog(hdlg,0); - return 0; + case WM_CLOSE: + EndDialog(hdlg,0); + return 0; } return 0; } int OptionsInit(WPARAM wparam,LPARAM lparam) { - OPTIONSDIALOGPAGE odp={0}; - odp.cbSize = sizeof(odp); + OPTIONSDIALOGPAGE odp = { sizeof(odp) }; odp.position = 955000000; odp.hInstance = hinstance; odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPTIONS); @@ -128,6 +112,5 @@ int OptionsInit(WPARAM wparam,LPARAM lparam) odp.pszGroup = LPGEN("Customize"); odp.flags = ODPF_BOLDGROUPS; Options_AddPage(wparam,&odp); - return 0; } diff --git a/plugins/MenuItemEx/src/resource.h b/plugins/MenuItemEx/src/resource.h index d94600c900..d14e68272a 100644 --- a/plugins/MenuItemEx/src/resource.h +++ b/plugins/MenuItemEx/src/resource.h @@ -21,7 +21,6 @@ #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 diff --git a/plugins/MenuItemEx/src/version.h b/plugins/MenuItemEx/src/version.h index 03341eb5cf..45ef9f25e8 100644 --- a/plugins/MenuItemEx/src/version.h +++ b/plugins/MenuItemEx/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 1 #define __MINOR_VERSION 3 #define __RELEASE_NUM 0 -#define __BUILD_NUM 9 +#define __BUILD_NUM 10 #define __FILEVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM -- cgit v1.2.3