diff options
Diffstat (limited to 'plugins/MenuItemEx')
-rw-r--r-- | plugins/MenuItemEx/docs/menuex_changelog.txt | 7 | ||||
-rw-r--r-- | plugins/MenuItemEx/main.c | 93 | ||||
-rw-r--r-- | plugins/MenuItemEx/menuex.h | 2 | ||||
-rw-r--r-- | plugins/MenuItemEx/menuex.rc | 62 | ||||
-rw-r--r-- | plugins/MenuItemEx/options.c | 16 | ||||
-rw-r--r-- | plugins/MenuItemEx/resource.h | 1 | ||||
-rw-r--r-- | plugins/MenuItemEx/version.h | 10 |
7 files changed, 123 insertions, 68 deletions
diff --git a/plugins/MenuItemEx/docs/menuex_changelog.txt b/plugins/MenuItemEx/docs/menuex_changelog.txt index e7932a334d..640fbb80ce 100644 --- a/plugins/MenuItemEx/docs/menuex_changelog.txt +++ b/plugins/MenuItemEx/docs/menuex_changelog.txt @@ -1,3 +1,10 @@ +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 <protocol>\LogoffTS) (reset when offline)
+[+] Saving logon time (as DWORD in <protocol>\LogonTS) (reset when online)
+
Verison 1.3.0.8
[+] Added ability to copy unicode status message
diff --git a/plugins/MenuItemEx/main.c b/plugins/MenuItemEx/main.c index df21a89fce..30e07e0511 100644 --- a/plugins/MenuItemEx/main.c +++ b/plugins/MenuItemEx/main.c @@ -24,7 +24,7 @@ struct MM_INTERFACE mmi; HINSTANCE hinstance;
HANDLE hmenuVis,hmenuOff,hmenuHide,hmenuIgnore,hmenuProto,hmenuAdded,hmenuAuthReq;
HANDLE hmenuCopyID,hmenuRecvFiles,hmenuStatusMsg,hmenuCopyIP,hmenuCopyMirVer;
-static HANDLE hIgnoreItem[9], hProtoItem[MAX_PROTOS], hHooks[7], hServices[12];
+static HANDLE hIgnoreItem[9], hProtoItem[MAX_PROTOS], hHooks[8], hServices[12];
HICON hIcon[5];
BOOL bMetaContacts, bMir_08;
PROTOACCOUNT **accs;
@@ -918,6 +918,11 @@ int isIgnored(HANDLE hContact, int type) INT_PTR onIgnore(WPARAM wparam,LPARAM lparam)
{
+ if (DBGetContactSettingByte(NULL, VISPLG, "ignorehide", 0) && (lparam == IGNOREEVENT_ALL)) {
+ DBWriteContactSettingByte((HANDLE)wparam, "CList", "Hidden", (isIgnored((HANDLE)wparam, lparam) ? (byte)0 : (byte)1));
+ CallService(MS_CLUI_SORTLIST, 0, 0);
+ }
+
CallService(isIgnored((HANDLE)wparam, lparam) ? MS_IGNORE_UNIGNORE : MS_IGNORE_IGNORE, wparam, lparam);
return 0;
}
@@ -1139,25 +1144,70 @@ static int TabsrmmButtonsInit(WPARAM wParam, LPARAM lParam) static void TabsrmmButtonsModify(HANDLE hContact)
{
if (!DirectoryExists(hContact))
- {
- BBButton bbd = {0};
- bbd.cbSize = sizeof(BBButton);
- bbd.dwButtonID = 0;
- bbd.pszModuleName = MODULENAME;
- bbd.bbbFlags = BBSF_DISABLED | BBSF_HIDDEN;
- CallService(MS_BB_SETBUTTONSTATE, (WPARAM)hContact, (LPARAM)&bbd);
- }
+ {
+ BBButton bbd = {0};
+ bbd.cbSize = sizeof(BBButton);
+ bbd.dwButtonID = 0;
+ bbd.pszModuleName = MODULENAME;
+ bbd.bbbFlags = BBSF_DISABLED | BBSF_HIDDEN;
+ CallService(MS_BB_SETBUTTONSTATE, (WPARAM)hContact, (LPARAM)&bbd);
+ }
}
static int ContactWindowOpen(WPARAM wparam,LPARAM lParam)
{
- MessageWindowEventData *MWeventdata = (MessageWindowEventData*)lParam;
+ MessageWindowEventData *MWeventdata = (MessageWindowEventData*)lParam;
+
+ if(MWeventdata->uType == MSG_WINDOW_EVT_OPENING && MWeventdata->hContact)
+ {
+ TabsrmmButtonsModify(MWeventdata->hContact);
+ }
+ return 0;
+}
+
+static int ContactSettingChanged( WPARAM wParam, LPARAM lParam )
+{ // NSN
+ DBCONTACTWRITESETTING *cws = ( DBCONTACTWRITESETTING* )lParam;
+ WORD newStatus = 0, oldStatus = 0;
+ DWORD dwStatuses = 0;
+ time_t tCurrentTime;
+ char *lpzProto;
+
+ if ( ( HANDLE )wParam == NULL || lstrcmpA( cws->szSetting, "Status" ) )
+ return 0;
+ newStatus = cws->value.wVal;
+ oldStatus = DBGetContactSettingWord((HANDLE)wParam,"UserOnline","OldStatus2",ID_STATUS_OFFLINE );
+ if (oldStatus == newStatus)
+ return 0;
- if(MWeventdata->uType == MSG_WINDOW_EVT_OPENING && MWeventdata->hContact)
- {
- TabsrmmButtonsModify(MWeventdata->hContact);
- }
- return 0;
+ tCurrentTime = time( NULL );
+ lpzProto = ( char* )CallService( MS_PROTO_GETCONTACTBASEPROTO, ( WPARAM )wParam, 0);
+
+ if (oldStatus == ID_STATUS_OFFLINE)
+ {
+ // set online timestamp for this contact, only when not set already
+ if (!DBGetContactSettingDword( ( HANDLE )wParam, lpzProto, "LogonTS", FALSE))
+ DBWriteContactSettingDword( ( HANDLE )wParam, lpzProto, "LogonTS", ( DWORD )tCurrentTime);
+
+ // TODO: dont reset logoff timestamp?
+ DBDeleteContactSetting( ( HANDLE )wParam, lpzProto, "LogoffTS");
+
+ // TESTING: updating user's details
+ CallContactService( ( HANDLE )wParam, PSS_GETINFO, 0, 0 );
+ }
+ if (newStatus == ID_STATUS_OFFLINE)
+ {
+ // set offline timestamp for this contact
+ DBWriteContactSettingDword( ( HANDLE )wParam, lpzProto, "LogoffTS", ( DWORD )tCurrentTime);
+ // reset logon timestamp
+ DBDeleteContactSetting( ( HANDLE )wParam, lpzProto, "LogonTS");
+
+ // set last status for this contact
+ DBWriteContactSettingDword( ( HANDLE )wParam, lpzProto, "LastStatus", ( DWORD )oldStatus);
+ }
+ DBWriteContactSettingWord( ( HANDLE )wParam, "UserOnline", "OldStatus2", newStatus);
+
+ return 0;
}
// called when all modules are loaded
@@ -1287,13 +1337,14 @@ static int PluginInit(WPARAM wparam,LPARAM lparam) hHooks[0] = HookEvent(ME_CLIST_PREBUILDCONTACTMENU,BuildMenu);
hHooks[1] = HookEvent(ME_OPT_INITIALISE,OptionsInit);
+ hHooks[2] = HookEvent(ME_DB_CONTACT_SETTINGCHANGED,ContactSettingChanged);
if (bMir_08)
- hHooks[2] = HookEvent(ME_PROTO_ACCLISTCHANGED, EnumProtoSubmenu);
- hHooks[3] = HookEvent(ME_MSG_TOOLBARLOADED, TabsrmmButtonsInit);
- if (hHooks[3])
+ hHooks[3] = HookEvent(ME_PROTO_ACCLISTCHANGED, EnumProtoSubmenu);
+ hHooks[4] = HookEvent(ME_MSG_TOOLBARLOADED, TabsrmmButtonsInit);
+ if (hHooks[4])
{
- hHooks[4] = HookEvent(ME_MSG_BUTTONPRESSED, TabsrmmButtonPressed);
- hHooks[5] = HookEvent(ME_MSG_WINDOWEVENT,ContactWindowOpen);
+ hHooks[5] = HookEvent(ME_MSG_BUTTONPRESSED, TabsrmmButtonPressed);
+ hHooks[6] = HookEvent(ME_MSG_WINDOWEVENT,ContactWindowOpen);
}
// updater plugin support
@@ -1318,7 +1369,7 @@ __declspec(dllexport)int Load(PLUGINLINK *link) pluginLink=link;
mir_getMMI( &mmi );
mir_getLP(&pluginInfoEx);
- hHooks[6] = HookEvent(ME_SYSTEM_MODULESLOADED,PluginInit);
+ hHooks[7] = HookEvent(ME_SYSTEM_MODULESLOADED,PluginInit);
return 0;
}
diff --git a/plugins/MenuItemEx/menuex.h b/plugins/MenuItemEx/menuex.h index db5cdfc428..73428fb68d 100644 --- a/plugins/MenuItemEx/menuex.h +++ b/plugins/MenuItemEx/menuex.h @@ -10,6 +10,7 @@ #include <stdio.h>
#include "newpluginapi.h"
#include "win2k.h"
+#include "time.h"
#include "m_system.h"
#include "m_utils.h"
#include "m_options.h"
@@ -65,6 +66,7 @@ int OptionsInit(WPARAM,LPARAM); #define VF_SAI 0x2000
#define VF_TRIMID 0x4000
#define VF_CMV 0x8000
+#define VF_IGNH 0x10000
#define CTRL_IS_PRESSED (GetAsyncKeyState(VK_CONTROL)&0x8000)
diff --git a/plugins/MenuItemEx/menuex.rc b/plugins/MenuItemEx/menuex.rc index 2609320a22..be750a05b7 100644 --- a/plugins/MenuItemEx/menuex.rc +++ b/plugins/MenuItemEx/menuex.rc @@ -18,7 +18,7 @@ #if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU)
#ifdef _WIN32
LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL
-#pragma code_page(1251)
+#pragma code_page(1250)
#endif //_WIN32
/////////////////////////////////////////////////////////////////////////////
@@ -49,15 +49,13 @@ IDI_ICON13 ICON "icons\\CopyMirVer.ico" //
IDD_AUTHREQ DIALOGEX 0, 0, 186, 95
-STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_POPUP |
- WS_VISIBLE | WS_CAPTION
+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
+ EDITTEXT IDC_REASON,7,7,172,59,ES_MULTILINE | ES_AUTOVSCROLL | ES_WANTRETURN
END
IDD_OPTIONS DIALOGEX 0, 0, 280, 183
@@ -66,41 +64,25 @@ EXSTYLE WS_EX_CONTROLPARENT FONT 8, "MS Shell Dlg", 0, 0, 0x1
BEGIN
GROUPBOX "Shown menu items",IDC_STATIC,7,7,266,180
- CONTROL "Visibility",IDC_VIS,"Button",BS_AUTOCHECKBOX |
- WS_TABSTOP,16,18,77,10
- CONTROL "Show alpha icons",IDC_SHOWALPHAICONS,"Button",
- BS_AUTOCHECKBOX | WS_TABSTOP,162,18,104,10
- CONTROL "Hide from list",IDC_HIDE,"Button",BS_AUTOCHECKBOX |
- WS_TABSTOP,16,30,77,10
- CONTROL "Ignore",IDC_IGNORE,"Button",BS_AUTOCHECKBOX |
- WS_TABSTOP,16,42,159,10
- CONTROL "Copy to Account (Ctrl+click for move to Account)",
- IDC_PROTOS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,54,
- 192,10
- CONTROL "Send 'You were added'",IDC_ADDED,"Button",
- BS_AUTOCHECKBOX | WS_TABSTOP,16,66,158,10
- CONTROL "Request Authorization",IDC_AUTHREQ,"Button",
- BS_AUTOCHECKBOX | WS_TABSTOP,16,78,157,10
- CONTROL "Browse Received Files",IDC_RECVFILES,"Button",
- BS_AUTOCHECKBOX | WS_TABSTOP,16,90,158,10
- CONTROL "Copy IP",IDC_COPYIP,"Button",BS_AUTOCHECKBOX |
- WS_TABSTOP,16,102,157,10
- CONTROL "Copy MirVer",IDC_COPYMIRVER,"Button",BS_AUTOCHECKBOX |
- WS_TABSTOP,16,114,157,10
- CONTROL "Copy Status Message",IDC_STATUSMSG,"Button",
- BS_AUTOCHECKBOX | WS_TABSTOP,16,126,144,10
- CONTROL "Add item name",IDC_SMNAME,"Button",BS_AUTOCHECKBOX |
- WS_TABSTOP,162,126,104,10
- CONTROL "Copy ID",IDC_COPYID,"Button",BS_AUTOCHECKBOX |
- WS_TABSTOP,16,138,76,10
- CONTROL "Add protocol name",IDC_COPYIDNAME,"Button",
- BS_AUTOCHECKBOX | WS_TABSTOP,162,138,104,10
- CONTROL "Show ID in menu item",IDC_SHOWID,"Button",
- BS_AUTOCHECKBOX | WS_TABSTOP,25,150,132,10
- CONTROL "Trim too long ID",IDC_TRIMID,"Button",BS_AUTOCHECKBOX |
- WS_TABSTOP,162,150,104,10
- LTEXT "* Use Ctrl+click to see popup with the copied text",
- IDC_HINT1,15,164,249,18
+ CONTROL "Visibility",IDC_VIS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,18,77,10
+ CONTROL "Show alpha icons",IDC_SHOWALPHAICONS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,162,18,104,10
+ CONTROL "Hide from list",IDC_HIDE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,30,77,10
+ CONTROL "Ignore",IDC_IGNORE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,42,140,10
+ CONTROL "Copy to Account (Ctrl+click for move to Account)",IDC_PROTOS,
+ "Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,54,192,10
+ CONTROL "Send 'You were added'",IDC_ADDED,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,66,158,10
+ CONTROL "Request Authorization",IDC_AUTHREQ,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,78,157,10
+ CONTROL "Browse Received Files",IDC_RECVFILES,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,90,158,10
+ CONTROL "Copy IP",IDC_COPYIP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,102,157,10
+ CONTROL "Copy MirVer",IDC_COPYMIRVER,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,114,157,10
+ CONTROL "Copy Status Message",IDC_STATUSMSG,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,126,144,10
+ CONTROL "Add item name",IDC_SMNAME,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,162,126,104,10
+ CONTROL "Copy ID",IDC_COPYID,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,16,138,76,10
+ CONTROL "Add protocol name",IDC_COPYIDNAME,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,162,138,104,10
+ CONTROL "Show ID in menu item",IDC_SHOWID,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,25,150,132,10
+ CONTROL "Trim too long ID",IDC_TRIMID,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,162,150,104,10
+ LTEXT "* Use Ctrl+click to see popup with the copied text",IDC_HINT1,15,164,249,18
+ CONTROL "Hide contact on 'Ignore all'",IDC_IGNOREHIDE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,162,42,104,10
END
diff --git a/plugins/MenuItemEx/options.c b/plugins/MenuItemEx/options.c index 38aff12beb..ca14de03e8 100644 --- a/plugins/MenuItemEx/options.c +++ b/plugins/MenuItemEx/options.c @@ -16,6 +16,7 @@ static const checkboxes[]={ { 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 },
@@ -40,7 +41,10 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) for (i = 0; i < SIZEOF(checkboxes); i++)
{
- CheckDlgButton(hdlg, checkboxes[i].idc, (flags & checkboxes[i].flag) ? BST_CHECKED : BST_UNCHECKED);
+ 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);
}
if (ServiceExists(MS_POPUP_ADDPOPUP))
@@ -65,6 +69,8 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) 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),
@@ -80,14 +86,19 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) case PSN_APPLY:
{
WORD mod_flags=0;
+ int ignh=0;
for (i = 0; i < SIZEOF(checkboxes); i++)
{
- mod_flags |= IsDlgButtonChecked(hdlg, checkboxes[i].idc) ? checkboxes[i].flag : 0;
+ if (checkboxes[i].flag == VF_IGNH)
+ ignh = IsDlgButtonChecked(hdlg, checkboxes[i].idc);
+ else
+ 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);
return 1;
}
@@ -98,6 +109,7 @@ INT_PTR CALLBACK OptionsProc(HWND hdlg,UINT msg,WPARAM wparam,LPARAM lparam) 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) {
diff --git a/plugins/MenuItemEx/resource.h b/plugins/MenuItemEx/resource.h index c2f0ffea16..888d5d46ab 100644 --- a/plugins/MenuItemEx/resource.h +++ b/plugins/MenuItemEx/resource.h @@ -36,6 +36,7 @@ #define IDC_HINT1 1016
#define IDC_SHOWID 1017
#define IDC_TRIMID 1018
+#define IDC_IGNOREHIDE 1019
#define IDC_STATIC -1
// Next default values for new objects
diff --git a/plugins/MenuItemEx/version.h b/plugins/MenuItemEx/version.h index 12596016db..b2860e5ad4 100644 --- a/plugins/MenuItemEx/version.h +++ b/plugins/MenuItemEx/version.h @@ -1,5 +1,5 @@ -#define __FILEVERSION_STRING 1,3,0,8
-#define __VERSION_STRING "1.3.0.8"
+#define __FILEVERSION_STRING 1,3,0,9
+#define __VERSION_STRING "1.3.0.9"
#define __VERSION_DWORD 0x01030008
#if defined (_WIN64)
@@ -19,9 +19,9 @@ #define __WEB "http://addons.miranda-im.org/details.php?action=viewfile&id="
#define __DESC "Adds some useful options to a contacts menu."
-#define __AUTHORS "Heiko Schillinger, Baloo, Billy_Bons"
-#define __EMAIL "micron@nexgo.de, baloo@bk.ru, tatarinov.sergey@gmail.com"
-#define __COPYRIGHTS "© 2001-03 Heiko Schillinger, © 2006-08 Baloo, © 2009-10 Billy_Bons"
+#define __AUTHORS "Heiko Schillinger, Baloo, Billy_Bons, Robert Posel"
+#define __EMAIL "micron@nexgo.de, baloo@bk.ru, tatarinov.sergey@gmail.com, robyer@seznam.cz"
+#define __COPYRIGHTS "© 2001-03 Heiko Schillinger, © 2006-08 Baloo, © 2009-10 Billy_Bons, © 2011-12 Robert Posel"
#ifdef _UNICODE
// {b1902a52-9114-4d7e-ac2e-b3a52e01d574}
|