From 177c84716db384c8be095219c58d0a68f87101fe Mon Sep 17 00:00:00 2001 From: Vadim Dashevskiy Date: Mon, 23 Jul 2012 11:56:59 +0000 Subject: NotesAndReminders, Nudge, OpenFolder, PackUpdater: changed folder structure git-svn-id: http://svn.miranda-ng.org/main/trunk@1116 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Nudge/ChangeLog.txt | 190 -------- plugins/Nudge/Sounds/nudge.wav | Bin 164500 -> 0 bytes plugins/Nudge/autoexec_nudge.ini | 4 - plugins/Nudge/docs/ChangeLog.txt | 190 ++++++++ plugins/Nudge/docs/Sounds/nudge.wav | Bin 0 -> 164500 bytes plugins/Nudge/docs/autoexec_nudge.ini | 4 + plugins/Nudge/docs/nudge-translation.txt | 62 +++ plugins/Nudge/headers.h | 68 --- plugins/Nudge/main.cpp | 789 ------------------------------- plugins/Nudge/main.h | 31 -- plugins/Nudge/miranda.ico | Bin 3638 -> 0 bytes plugins/Nudge/nudge-translation.txt | 62 --- plugins/Nudge/nudge.cpp | 117 ----- plugins/Nudge/nudge.h | 67 --- plugins/Nudge/nudge_10.vcxproj | 45 +- plugins/Nudge/nudge_10.vcxproj.filters | 68 +-- plugins/Nudge/options.cpp | 435 ----------------- plugins/Nudge/options.h | 14 - plugins/Nudge/res/Nudge.ico | Bin 0 -> 2038 bytes plugins/Nudge/res/NudgeIRC.ico | Bin 0 -> 2038 bytes plugins/Nudge/res/NudgeMSN.ico | Bin 0 -> 2038 bytes plugins/Nudge/res/NudgeMeta.ico | Bin 0 -> 2038 bytes plugins/Nudge/res/NudgeTlen.ico | Bin 0 -> 2038 bytes plugins/Nudge/res/NudgeYahoo.ico | Bin 0 -> 2038 bytes plugins/Nudge/res/resource.rc | 285 +++++++++++ plugins/Nudge/resource.h | 89 ---- plugins/Nudge/resource.rc | 285 ----------- plugins/Nudge/resources/Nudge.ico | Bin 2038 -> 0 bytes plugins/Nudge/resources/NudgeIRC.ico | Bin 2038 -> 0 bytes plugins/Nudge/resources/NudgeMSN.ico | Bin 2038 -> 0 bytes plugins/Nudge/resources/NudgeMeta.ico | Bin 2038 -> 0 bytes plugins/Nudge/resources/NudgeTlen.ico | Bin 2038 -> 0 bytes plugins/Nudge/resources/NudgeYahoo.ico | Bin 2038 -> 0 bytes plugins/Nudge/resources/nudge msn.ico | Bin 1406 -> 0 bytes plugins/Nudge/shake.cpp | 189 -------- plugins/Nudge/shake.h | 27 -- plugins/Nudge/src/headers.h | 70 +++ plugins/Nudge/src/main.cpp | 789 +++++++++++++++++++++++++++++++ plugins/Nudge/src/main.h | 31 ++ plugins/Nudge/src/nudge.cpp | 117 +++++ plugins/Nudge/src/nudge.h | 67 +++ plugins/Nudge/src/options.cpp | 435 +++++++++++++++++ plugins/Nudge/src/options.h | 14 + plugins/Nudge/src/resource.h | 89 ++++ plugins/Nudge/src/shake.cpp | 189 ++++++++ plugins/Nudge/src/shake.h | 27 ++ 46 files changed, 2406 insertions(+), 2443 deletions(-) delete mode 100644 plugins/Nudge/ChangeLog.txt delete mode 100644 plugins/Nudge/Sounds/nudge.wav delete mode 100644 plugins/Nudge/autoexec_nudge.ini create mode 100644 plugins/Nudge/docs/ChangeLog.txt create mode 100644 plugins/Nudge/docs/Sounds/nudge.wav create mode 100644 plugins/Nudge/docs/autoexec_nudge.ini create mode 100644 plugins/Nudge/docs/nudge-translation.txt delete mode 100644 plugins/Nudge/headers.h delete mode 100644 plugins/Nudge/main.cpp delete mode 100644 plugins/Nudge/main.h delete mode 100644 plugins/Nudge/miranda.ico delete mode 100644 plugins/Nudge/nudge-translation.txt delete mode 100644 plugins/Nudge/nudge.cpp delete mode 100644 plugins/Nudge/nudge.h delete mode 100644 plugins/Nudge/options.cpp delete mode 100644 plugins/Nudge/options.h create mode 100644 plugins/Nudge/res/Nudge.ico create mode 100644 plugins/Nudge/res/NudgeIRC.ico create mode 100644 plugins/Nudge/res/NudgeMSN.ico create mode 100644 plugins/Nudge/res/NudgeMeta.ico create mode 100644 plugins/Nudge/res/NudgeTlen.ico create mode 100644 plugins/Nudge/res/NudgeYahoo.ico create mode 100644 plugins/Nudge/res/resource.rc delete mode 100644 plugins/Nudge/resource.h delete mode 100644 plugins/Nudge/resource.rc delete mode 100644 plugins/Nudge/resources/Nudge.ico delete mode 100644 plugins/Nudge/resources/NudgeIRC.ico delete mode 100644 plugins/Nudge/resources/NudgeMSN.ico delete mode 100644 plugins/Nudge/resources/NudgeMeta.ico delete mode 100644 plugins/Nudge/resources/NudgeTlen.ico delete mode 100644 plugins/Nudge/resources/NudgeYahoo.ico delete mode 100644 plugins/Nudge/resources/nudge msn.ico delete mode 100644 plugins/Nudge/shake.cpp delete mode 100644 plugins/Nudge/shake.h create mode 100644 plugins/Nudge/src/headers.h create mode 100644 plugins/Nudge/src/main.cpp create mode 100644 plugins/Nudge/src/main.h create mode 100644 plugins/Nudge/src/nudge.cpp create mode 100644 plugins/Nudge/src/nudge.h create mode 100644 plugins/Nudge/src/options.cpp create mode 100644 plugins/Nudge/src/options.h create mode 100644 plugins/Nudge/src/resource.h create mode 100644 plugins/Nudge/src/shake.cpp create mode 100644 plugins/Nudge/src/shake.h (limited to 'plugins/Nudge') diff --git a/plugins/Nudge/ChangeLog.txt b/plugins/Nudge/ChangeLog.txt deleted file mode 100644 index 140671c177..0000000000 --- a/plugins/Nudge/ChangeLog.txt +++ /dev/null @@ -1,190 +0,0 @@ -0.0.1.22 -=========== -+ 64bit version -+ unhook hooks on exit -+ destroy services on exit -+ open message window on popup click -+ open message window on preview -+ moved sounds in "Nudge" section -- fixed navigation in options -+ new option: "Open message window" -+ New option: "Open contact list" -+ new option: "Respect ignore settings (status changes)" -* status changes are now stored in UTF8 -- Removed popup on sending nudges (on popular request) -* popup options are moved into popup classes, needs a recent version of popup+ or YAPP - -0.0.1.21 -=========== -+ Traslation fo icon description - -0.0.1.20 -=========== -! Bug in options layout -! Fix for crash when no protocol available (based on changed by Ivan) - -0.0.1.19 -=========== -! Patch by Drugwash : option page redesign and ansi buit fix -* Change N/A to NA (requested by freak) -+ Patch for tabsrmm button api support (thx DaniOK) - -0.0.1.18 -=========== -! Fix autoresend save setting -+ Add a autoresend delay (must be between 1 and 10 sec) - -0.0.1.17 -=========== -+ Add unicode aware flag -+ Support for miranda 0.8 -! Fix for icolib support -+ Added icons from angelika - -0.0.1.16 -=========== -+ Add a service to hide/show "send nudge" context menu (for metacontact) - -0.0.1.15 -=========== -* Patch by Tioduke (offline nudge) - -0.0.1.14 -=========== -* Fix visual option - -0.0.1.13 -=========== -! Unicode patch by Ghazan -! Fix options dialog size -! Fix nudge text in unicode -! Use DBGetContactSettingTString to read data - -0.0.1.12 -=========== -+ Unicode supports (will need unicows.dll, thanks to sje - eblis) -! Fix retreiving chat window (patch sje) - -0.0.1.11 -=========== -! Check for null handle to avoid crash in IRC mod -! gdi leaks in option page (thx tioduke) -+ Auto send nudge option when received one. -* New trigger plugin support (first step) -* Use the text set in option page in popup. -* Use find first contact service for popup preview -* Set auto resend nudge to false by default - -0.0.1.10 -=========== -* Use popup for warning instead of message box. -+ Check if popup plugin is present if not use messagebox. - -0.0.1.9 -=========== -* Change options dialog (use tabsrmm uxtheme) - -0.0.1.8 -=========== -+ Show a popup on sending nudge - -0.0.1.7 -=========== -! Change text for status log on receive. -* Use flags = 0 for status notify. -! Wrong section name in options saving. -* Use winres.h in resource. - -0.0.1.6 -=========== -+ Per contact limitation (no more per protocol cause too restrictive) -+ Privacy options to limit the number of nudge to receive -+ Options to show nudge as status change. (thx Tioduke) - -0.0.1.5 -=========== -! Memory leaks fix. (Patch by Ghazan) - -0.0.1.4 -=========== -! Bug fix, url for file in updater info points to source :-(. - -0.0.1.3 -=========== -! Bug fix, check time for default proto too ;) - -0.0.1.2 -=========== -+ Add the right url for updater, now that nudge is on FL. - -0.0.1.1 -=========== -:( skipped - -0.0.1.0 -=========== -* Some modifications of the option page. -* Redesign option page. -! Bug fix with slider in shake option. -! Bug fix with updater and stable version. - -0.0.0.12 -=========== -+ Now possible to change the text shown when sending or receiving nudge ( [color=red]BUZZ!!![/color] for yahoo ;)) -* Change options page. -! Now apply button is enable when changing status. - -0.0.0.11 -=========== -+ Status support (global or by protocol) -+ Limitation only sent 1 nudge every 30 sec per protocol. - -0.0.0.10 -=========== -+ Multiprotocol options - -0.0.0.9 -=========== -Patch by Tioduke -{ - * Use the right protoname for treating nudge as event - * Take care of the message dialog (open or not) in treating nudge as event - + Registration in dbeditor ++ -} -* Be aware of metacontact when sendig/receiving nudge (history). - -0.0.0.8 -=========== -+ Shake options are now saved in DB -! some code rewrite in order to easily change the algo of shaking -! Patch by Tioduke for icons (non support of icolib) -+ Option to treat nudge as a message. -! Recieved -> received. - -0.0.0.7 -=========== -! Wrong service call - -0.0.0.6 -=========== -* Change the return value for trigger functions -! Bug sound file name was not set (thx TioDuke) -+ Add default Sound - -0.0.0.5 -=========== -! Trigger plugin bug fix - -0.0.0.4 -============ -+ Icolib support -! Option redesign to fix visual bug -+ First step in option page to by protocol option -+ Settings are now saved in DB :-) - - -0.0.0.3 -============ -* Some mod in option page. -+ Support for trigger plugin from pboon. -* Forced beta version in updater. \ No newline at end of file diff --git a/plugins/Nudge/Sounds/nudge.wav b/plugins/Nudge/Sounds/nudge.wav deleted file mode 100644 index 938812970c..0000000000 Binary files a/plugins/Nudge/Sounds/nudge.wav and /dev/null differ diff --git a/plugins/Nudge/autoexec_nudge.ini b/plugins/Nudge/autoexec_nudge.ini deleted file mode 100644 index d5e9a563da..0000000000 --- a/plugins/Nudge/autoexec_nudge.ini +++ /dev/null @@ -1,4 +0,0 @@ -SETTINGS: - -[SkinSounds] -Nudge : Default=sSounds\nudge.wav \ No newline at end of file diff --git a/plugins/Nudge/docs/ChangeLog.txt b/plugins/Nudge/docs/ChangeLog.txt new file mode 100644 index 0000000000..140671c177 --- /dev/null +++ b/plugins/Nudge/docs/ChangeLog.txt @@ -0,0 +1,190 @@ +0.0.1.22 +=========== ++ 64bit version ++ unhook hooks on exit ++ destroy services on exit ++ open message window on popup click ++ open message window on preview ++ moved sounds in "Nudge" section +- fixed navigation in options ++ new option: "Open message window" ++ New option: "Open contact list" ++ new option: "Respect ignore settings (status changes)" +* status changes are now stored in UTF8 +- Removed popup on sending nudges (on popular request) +* popup options are moved into popup classes, needs a recent version of popup+ or YAPP + +0.0.1.21 +=========== ++ Traslation fo icon description + +0.0.1.20 +=========== +! Bug in options layout +! Fix for crash when no protocol available (based on changed by Ivan) + +0.0.1.19 +=========== +! Patch by Drugwash : option page redesign and ansi buit fix +* Change N/A to NA (requested by freak) ++ Patch for tabsrmm button api support (thx DaniOK) + +0.0.1.18 +=========== +! Fix autoresend save setting ++ Add a autoresend delay (must be between 1 and 10 sec) + +0.0.1.17 +=========== ++ Add unicode aware flag ++ Support for miranda 0.8 +! Fix for icolib support ++ Added icons from angelika + +0.0.1.16 +=========== ++ Add a service to hide/show "send nudge" context menu (for metacontact) + +0.0.1.15 +=========== +* Patch by Tioduke (offline nudge) + +0.0.1.14 +=========== +* Fix visual option + +0.0.1.13 +=========== +! Unicode patch by Ghazan +! Fix options dialog size +! Fix nudge text in unicode +! Use DBGetContactSettingTString to read data + +0.0.1.12 +=========== ++ Unicode supports (will need unicows.dll, thanks to sje - eblis) +! Fix retreiving chat window (patch sje) + +0.0.1.11 +=========== +! Check for null handle to avoid crash in IRC mod +! gdi leaks in option page (thx tioduke) ++ Auto send nudge option when received one. +* New trigger plugin support (first step) +* Use the text set in option page in popup. +* Use find first contact service for popup preview +* Set auto resend nudge to false by default + +0.0.1.10 +=========== +* Use popup for warning instead of message box. ++ Check if popup plugin is present if not use messagebox. + +0.0.1.9 +=========== +* Change options dialog (use tabsrmm uxtheme) + +0.0.1.8 +=========== ++ Show a popup on sending nudge + +0.0.1.7 +=========== +! Change text for status log on receive. +* Use flags = 0 for status notify. +! Wrong section name in options saving. +* Use winres.h in resource. + +0.0.1.6 +=========== ++ Per contact limitation (no more per protocol cause too restrictive) ++ Privacy options to limit the number of nudge to receive ++ Options to show nudge as status change. (thx Tioduke) + +0.0.1.5 +=========== +! Memory leaks fix. (Patch by Ghazan) + +0.0.1.4 +=========== +! Bug fix, url for file in updater info points to source :-(. + +0.0.1.3 +=========== +! Bug fix, check time for default proto too ;) + +0.0.1.2 +=========== ++ Add the right url for updater, now that nudge is on FL. + +0.0.1.1 +=========== +:( skipped + +0.0.1.0 +=========== +* Some modifications of the option page. +* Redesign option page. +! Bug fix with slider in shake option. +! Bug fix with updater and stable version. + +0.0.0.12 +=========== ++ Now possible to change the text shown when sending or receiving nudge ( [color=red]BUZZ!!![/color] for yahoo ;)) +* Change options page. +! Now apply button is enable when changing status. + +0.0.0.11 +=========== ++ Status support (global or by protocol) ++ Limitation only sent 1 nudge every 30 sec per protocol. + +0.0.0.10 +=========== ++ Multiprotocol options + +0.0.0.9 +=========== +Patch by Tioduke +{ + * Use the right protoname for treating nudge as event + * Take care of the message dialog (open or not) in treating nudge as event + + Registration in dbeditor ++ +} +* Be aware of metacontact when sendig/receiving nudge (history). + +0.0.0.8 +=========== ++ Shake options are now saved in DB +! some code rewrite in order to easily change the algo of shaking +! Patch by Tioduke for icons (non support of icolib) ++ Option to treat nudge as a message. +! Recieved -> received. + +0.0.0.7 +=========== +! Wrong service call + +0.0.0.6 +=========== +* Change the return value for trigger functions +! Bug sound file name was not set (thx TioDuke) ++ Add default Sound + +0.0.0.5 +=========== +! Trigger plugin bug fix + +0.0.0.4 +============ ++ Icolib support +! Option redesign to fix visual bug ++ First step in option page to by protocol option ++ Settings are now saved in DB :-) + + +0.0.0.3 +============ +* Some mod in option page. ++ Support for trigger plugin from pboon. +* Forced beta version in updater. \ No newline at end of file diff --git a/plugins/Nudge/docs/Sounds/nudge.wav b/plugins/Nudge/docs/Sounds/nudge.wav new file mode 100644 index 0000000000..938812970c Binary files /dev/null and b/plugins/Nudge/docs/Sounds/nudge.wav differ diff --git a/plugins/Nudge/docs/autoexec_nudge.ini b/plugins/Nudge/docs/autoexec_nudge.ini new file mode 100644 index 0000000000..d5e9a563da --- /dev/null +++ b/plugins/Nudge/docs/autoexec_nudge.ini @@ -0,0 +1,4 @@ +SETTINGS: + +[SkinSounds] +Nudge : Default=sSounds\nudge.wav \ No newline at end of file diff --git a/plugins/Nudge/docs/nudge-translation.txt b/plugins/Nudge/docs/nudge-translation.txt new file mode 100644 index 0000000000..454dd7ef60 --- /dev/null +++ b/plugins/Nudge/docs/nudge-translation.txt @@ -0,0 +1,62 @@ +; Common strings that belong to many files +;[Nudge] + +; ../../plugins/Nudge/main.cpp +;[Default Nudge] +;[ExampleAction] +;[Nudge : Send a nudge] +;[Nudge : Shake contact list/chat window] +;[Nudge as Default] +;[Nudge for %s] +;[Send &Nudge] +;[Send Nudge] +;[Show Nudge] +;[You are not allowed to send too much nudge (only 1 each %d sec, %d sec left)] + +; ../../plugins/Nudge/nudge.cpp +;[You received a nudge] +;[You sent a nudge] + +; ../../plugins/Nudge/options.cpp +;[Events] +;[Window Shaking] + +; ../../plugins/Nudge/resource.rc +;[* Nudge sending delay is hardcoded and cannot be changed.] +;[Allow nudges when you're:] +;[Allow receiving one nudge from the same contact every :] +;[Allow sending* one nudge to the same contact every :] +;[Auto resend nudge after] +;[Away] +;[DND] +;[Enable contact list shaking] +;[Enable message window shaking] +;[Enable popup notification] +;[Free for chat] +;[Invisible] +;[NA] +;[Number of moves] +;[Occupied] +;[Offline] +;[On the phone] +;[Online] +;[Open contact list] +;[Open message window] +;[Out to lunch] +;[Preview] +;[Privacy] +;[Protocol options] +;[Receiving text] +;[Respect ignore settings (status changes)] +;[Sending text] +;[Shake the chat window] +;[Shake the contact list] +;[Shaking Clist Options] +;[Shaking Message Window Options] +;[Show as status change] +;[Slider1] +;[Specify options for each protocol] +;[Static] +;[Text] +;[Width of move] +;[s] diff --git a/plugins/Nudge/headers.h b/plugins/Nudge/headers.h deleted file mode 100644 index 456af2d7ed..0000000000 --- a/plugins/Nudge/headers.h +++ /dev/null @@ -1,68 +0,0 @@ -// stdafx.h : include file for standard system include files, -// or project specific include files that are used frequently, but -// are changed infrequently -// - -#pragma once - -// Modify the following defines if you have to target a platform prior to the ones specified below. -// Refer to MSDN for the latest info on corresponding values for different platforms. -#ifndef WINVER // Allow use of features specific to Windows XP or later. -#define WINVER 0x0501 // Change this to the appropriate value to target other versions of Windows. -#endif - -#ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later. -#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows. -#endif - -#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later. -#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later. -#endif - -#ifndef _WIN32_IE // Allow use of features specific to IE 6.0 or later. -#define _WIN32_IE 0x0600 // Change this to the appropriate value to target other versions of IE. -#endif - -#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers -// Windows Header Files: - -#include -#include -#include - -#define MIRANDA_VER 0x0A00 -#include //CallService,UnHookEvent -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include "resource.h" -#include "m_nudge.h" - - -/* -* -****************************/ -int NudgeOptInit(WPARAM wParam,LPARAM lParam); - -/* -* -****************************/ -int Preview(); - -/* -* -****************************/ -HANDLE Nudge_GethContact(HANDLE); \ No newline at end of file diff --git a/plugins/Nudge/main.cpp b/plugins/Nudge/main.cpp deleted file mode 100644 index c673ebe0c5..0000000000 --- a/plugins/Nudge/main.cpp +++ /dev/null @@ -1,789 +0,0 @@ -#include "headers.h" -#include "main.h" -#include "shake.h" -#include "m_msg_buttonsbar.h" - - -int nProtocol = 0; -static HANDLE g_hEventModulesLoaded = NULL, hEventOptionsInitialize = NULL, g_hIcon = NULL, g_hEventDbWindowEvent = NULL, g_hEventToolbarLoaded = NULL, g_hEventButtonPressed = NULL, g_hEventAccountsChanged = NULL; -HINSTANCE hInst; - -NudgeElementList *NudgeList = NULL; -CNudgeElement DefaultNudge; -CShake shake; -CNudge GlobalNudge; - - - -int hLangpack = 0; - - -//======================== -// MirandaPluginInfo -//======================== -PLUGININFOEX pluginInfo={ - sizeof(PLUGININFOEX), - "Nudge", - PLUGIN_MAKE_VERSION(0,0,2,0), - "Plugin to shake the clist and chat window", - "Tweety/GouZ, FREAK_THEMIGHTY", - "francois.mean@skynet.be, Sylvain.gougouzian@gmail.com, wishmaster51@googlemail.com", - "copyright to the miranda community", - "http://nightly.miranda.im/", // www - UNICODE_AWARE, //doesn't replace anything built-in - { 0xe47cc215, 0xd28, 0x462d, { 0xa0, 0xf6, 0x3a, 0xe4, 0x44, 0x3d, 0x29, 0x26 } } // {E47CC215-0D28-462D-A0F6-3AE4443D2926} -}; - -INT_PTR NudgeShowMenu(WPARAM wParam,LPARAM lParam) -{ - - for(NudgeElementList *n = NudgeList;n != NULL; n = n->next) - { - if (!strcmp((char *) wParam,n->item.ProtocolName)) - { - return n->item.ShowContactMenu(lParam != 0); - } - } - return 0; -} - -INT_PTR NudgeSend(WPARAM wParam,LPARAM lParam) -{ - - char *protoName = (char*) CallService(MS_PROTO_GETCONTACTBASEPROTO,wParam,0); - int diff = time(NULL) - DBGetContactSettingDword((HANDLE) wParam, "Nudge", "LastSent", time(NULL)-30); - - if(diff < GlobalNudge.sendTimeSec) - { - TCHAR msg[500]; - mir_sntprintf(msg,500, TranslateT("You are not allowed to send too much nudge (only 1 each %d sec, %d sec left)"),GlobalNudge.sendTimeSec, 30 - diff); - //MessageBox(NULL,msg,NULL,0); - if(GlobalNudge.useByProtocol) - { - for(NudgeElementList *n = NudgeList;n != NULL; n = n->next) - { - if (!strcmp(protoName,n->item.ProtocolName)) - { - Nudge_ShowPopup(n->item, (HANDLE) wParam, msg); - } - } - } - else - { - Nudge_ShowPopup(DefaultNudge, (HANDLE) wParam, msg); - } - return 0; - } - - DBWriteContactSettingDword((HANDLE) wParam, "Nudge", "LastSent", time(NULL)); - - if(GlobalNudge.useByProtocol) - { - NudgeElementList *n; - for(n = NudgeList;n != NULL; n = n->next) - { - if (!strcmp(protoName,n->item.ProtocolName)) - { - //if(n->item.showPopup) - // Nudge_ShowPopup(n->item, (HANDLE) wParam, n->item.senText); - if(n->item.showStatus) - Nudge_SentStatus(n->item, (HANDLE) wParam); - } - } - } - else - { - //if(DefaultNudge.showPopup) - // Nudge_ShowPopup(DefaultNudge, (HANDLE) wParam, DefaultNudge.senText); - if(DefaultNudge.showStatus) - Nudge_SentStatus(DefaultNudge, (HANDLE) wParam); - } - - CallProtoService(protoName,"/SendNudge",wParam,lParam); - return 0; -} - -void OpenContactList() -{ - HWND hWnd = (HWND) CallService(MS_CLUI_GETHWND,0,0); - ShowWindow(hWnd, SW_RESTORE); - ShowWindow(hWnd, SW_SHOW); -} - -int NudgeRecieved(WPARAM wParam,LPARAM lParam) -{ - - char *protoName = (char*) CallService(MS_PROTO_GETCONTACTBASEPROTO,wParam,0); - - DWORD currentTimestamp = time(NULL); - DWORD nudgeSentTimestamp = lParam ? (DWORD)lParam : currentTimestamp; - - int diff = currentTimestamp - DBGetContactSettingDword((HANDLE) wParam, "Nudge", "LastReceived", currentTimestamp-30); - int diff2 = nudgeSentTimestamp - DBGetContactSettingDword((HANDLE) wParam, "Nudge", "LastReceived2", nudgeSentTimestamp-30); - - if(diff >= GlobalNudge.recvTimeSec) - DBWriteContactSettingDword((HANDLE) wParam, "Nudge", "LastReceived", currentTimestamp); - if(diff2 >= GlobalNudge.recvTimeSec) - DBWriteContactSettingDword((HANDLE) wParam, "Nudge", "LastReceived2", nudgeSentTimestamp); - - if(GlobalNudge.useByProtocol) - { - for(NudgeElementList *n = NudgeList;n != NULL; n = n->next) - { - if (!strcmp(protoName,n->item.ProtocolName)) - { - - if(n->item.enabled) - { - if(n->item.useIgnoreSettings && CallService(MS_IGNORE_ISIGNORED,wParam,IGNOREEVENT_USERONLINE)) - return 0; - - DWORD Status = CallProtoService(protoName,PS_GETSTATUS,0,0); - - if ( ((n->item.statusFlags & NUDGE_ACC_ST0) && (Status<=ID_STATUS_OFFLINE)) || - ((n->item.statusFlags & NUDGE_ACC_ST1) && (Status==ID_STATUS_ONLINE)) || - ((n->item.statusFlags & NUDGE_ACC_ST2) && (Status==ID_STATUS_AWAY)) || - ((n->item.statusFlags & NUDGE_ACC_ST3) && (Status==ID_STATUS_DND)) || - ((n->item.statusFlags & NUDGE_ACC_ST4) && (Status==ID_STATUS_NA)) || - ((n->item.statusFlags & NUDGE_ACC_ST5) && (Status==ID_STATUS_OCCUPIED)) || - ((n->item.statusFlags & NUDGE_ACC_ST6) && (Status==ID_STATUS_FREECHAT)) || - ((n->item.statusFlags & NUDGE_ACC_ST7) && (Status==ID_STATUS_INVISIBLE)) || - ((n->item.statusFlags & NUDGE_ACC_ST8) && (Status==ID_STATUS_ONTHEPHONE)) || - ((n->item.statusFlags & NUDGE_ACC_ST9) && (Status==ID_STATUS_OUTTOLUNCH))) - { - if(diff >= GlobalNudge.recvTimeSec) - { - if(n->item.showPopup) - Nudge_ShowPopup(n->item, (HANDLE) wParam, n->item.recText); - if(n->item.openContactList) - OpenContactList(); - if(n->item.shakeClist) - ShakeClist(wParam,lParam); - if(n->item.openMessageWindow) - CallService(MS_MSG_SENDMESSAGET,wParam,0); - if(n->item.shakeChat) - ShakeChat(wParam,lParam); - if(n->item.autoResend) - mir_forkthread(AutoResendNudge,(void *)wParam); - - SkinPlaySound( n->item.NudgeSoundname ); - } - } - if(diff2 >= GlobalNudge.recvTimeSec) - { - if(n->item.showStatus) - Nudge_ShowStatus(n->item, (HANDLE) wParam, nudgeSentTimestamp); - } - - } - break; - } - } - } - else - { - if(DefaultNudge.enabled) - { - if(DefaultNudge.useIgnoreSettings && CallService(MS_IGNORE_ISIGNORED,wParam,IGNOREEVENT_USERONLINE)) - return 0; - DWORD Status = CallService(MS_CLIST_GETSTATUSMODE,0,0); - if ( ((DefaultNudge.statusFlags & NUDGE_ACC_ST0) && (Status<=ID_STATUS_OFFLINE)) || - ((DefaultNudge.statusFlags & NUDGE_ACC_ST1) && (Status==ID_STATUS_ONLINE)) || - ((DefaultNudge.statusFlags & NUDGE_ACC_ST2) && (Status==ID_STATUS_AWAY)) || - ((DefaultNudge.statusFlags & NUDGE_ACC_ST3) && (Status==ID_STATUS_DND)) || - ((DefaultNudge.statusFlags & NUDGE_ACC_ST4) && (Status==ID_STATUS_NA)) || - ((DefaultNudge.statusFlags & NUDGE_ACC_ST5) && (Status==ID_STATUS_OCCUPIED)) || - ((DefaultNudge.statusFlags & NUDGE_ACC_ST6) && (Status==ID_STATUS_FREECHAT)) || - ((DefaultNudge.statusFlags & NUDGE_ACC_ST7) && (Status==ID_STATUS_INVISIBLE)) || - ((DefaultNudge.statusFlags & NUDGE_ACC_ST8) && (Status==ID_STATUS_ONTHEPHONE)) || - ((DefaultNudge.statusFlags & NUDGE_ACC_ST9) && (Status==ID_STATUS_OUTTOLUNCH))) - { - if(diff >= GlobalNudge.recvTimeSec) - { - if(DefaultNudge.showPopup) - Nudge_ShowPopup(DefaultNudge, (HANDLE) wParam, DefaultNudge.recText); - if(DefaultNudge.openContactList) - OpenContactList(); - if(DefaultNudge.shakeClist) - ShakeClist(wParam,lParam); - if(DefaultNudge.openMessageWindow) - CallService(MS_MSG_SENDMESSAGET,wParam,0); - if(DefaultNudge.shakeChat) - ShakeChat(wParam,lParam); - if(DefaultNudge.autoResend) - mir_forkthread(AutoResendNudge,(void *)wParam); - - SkinPlaySound( DefaultNudge.NudgeSoundname ); - } - } - if(diff2 >= GlobalNudge.recvTimeSec) - { - if(DefaultNudge.showStatus) - Nudge_ShowStatus(DefaultNudge, (HANDLE) wParam, nudgeSentTimestamp); - } - } - } - return 0; -} - -extern "C" BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved) -{ - hInst=hinstDLL; - return TRUE; -} - -extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion) -{ - return &pluginInfo; -} - -static INT_PTR CALLBACK DlgProcOptsTrigger(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { - - switch (msg) { - case WM_INITDIALOG: { - // lParam = (LPARAM)(DWORD)actionID or 0 if this is a new trigger entry - BOOL bshakeClist,bshakeChat; - - DWORD actionID = (DWORD)lParam; - TranslateDialogDefault(hwnd); - // Initialize the dialog according to the action ID - bshakeClist = DBGetActionSettingByte(actionID, NULL, "Nudge", "ShakeClist",FALSE); - bshakeChat = DBGetActionSettingByte(actionID, NULL, "Nudge", "ShakeChat",FALSE); - CheckDlgButton(hwnd, IDC_TRIGGER_SHAKECLIST, bshakeClist ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwnd, IDC_TRIGGER_SHAKECHAT, bshakeChat ? BST_CHECKED : BST_UNCHECKED); - break; - } - - case TM_ADDACTION: { - // save your settings - // wParam = (WPARAM)(DWORD)actionID - bool bshakeClist,bshakeChat; - - DWORD actionID = (DWORD)wParam; - bshakeClist = (IsDlgButtonChecked(hwnd,IDC_TRIGGER_SHAKECLIST)==BST_CHECKED); - bshakeChat = (IsDlgButtonChecked(hwnd,IDC_TRIGGER_SHAKECHAT)==BST_CHECKED); - DBWriteActionSettingByte(actionID, NULL, "Nudge", "ShakeClist",bshakeClist); - DBWriteActionSettingByte(actionID, NULL, "Nudge", "ShakeChat",bshakeChat); - break; - } - } - - return FALSE; -} - -int TriggerActionRecv( DWORD actionID, REPORTINFO *ri) -{ - // check how to process this call - if (ri->flags&ACT_PERFORM) { - BOOL bshakeClist,bshakeChat; - HANDLE hContact = ((ri->td!=NULL)&&(ri->td->dFlags&DF_CONTACT))?ri->td->hContact:NULL; - bshakeClist = DBGetActionSettingByte(actionID, NULL, "Nudge", "ShakeClist",FALSE); - bshakeChat = DBGetActionSettingByte(actionID, NULL, "Nudge", "ShakeChat",FALSE); - - if(bshakeClist) - ShakeClist(NULL,NULL); - if(bshakeChat && (hContact != NULL)) - ShakeChat((WPARAM)hContact,NULL); - } - - if (ri->flags&ACT_CLEANUP) // request to delete all associated settings - RemoveAllActionSettings(actionID, "Nudge"); - - return FALSE; -} - -int TriggerActionSend( DWORD actionID, REPORTINFO *ri) -{ - if (ri->flags & ACT_PERFORM) { - HANDLE hContact = ((ri->td!=NULL)&&(ri->td->dFlags&DF_CONTACT))?ri->td->hContact:NULL; - if(hContact != NULL) - NudgeSend((WPARAM)hContact,NULL); - } - - return FALSE; -} - -void LoadProtocols(void) -{ - //Load the default nudge - mir_snprintf(DefaultNudge.ProtocolName,sizeof(DefaultNudge.ProtocolName),"Default"); - mir_snprintf(DefaultNudge.NudgeSoundname,sizeof(DefaultNudge.NudgeSoundname),"Nudge : Default"); - SkinAddNewSoundEx( DefaultNudge.NudgeSoundname, LPGEN("Nudge"), LPGEN("Default Nudge")); - DefaultNudge.Load(); - - GlobalNudge.Load(); - - int numberOfProtocols = 0; - PROTOACCOUNT **ppProtocolDescriptors; - INT_PTR ret = ProtoEnumAccounts(&numberOfProtocols,&ppProtocolDescriptors); - if(ret == 0) - { - for(int i = 0; i < numberOfProtocols ; i++) - { - Nudge_AddAccount(ppProtocolDescriptors[i]); - } - - } - - shake.Load(); - - /*CNudgeElement *n; - for(n = NudgeList;n != NULL; n = n->next) - { - MessageBox(NULL,n->ProtocolName,n->NudgeSoundname,0); - }*/ -} - -void RegisterToTrigger(void) -{ - if ( ServiceExists(MS_TRIGGER_REGISTERACTION)) - { - ACTIONREGISTER ar; - ZeroMemory(&ar, sizeof(ar)); - ar.cbSize = sizeof(ar); - ar.hInstance = hInst; - ar.flags = ARF_TCHAR|ARF_FUNCTION; - ar.actionFunction = TriggerActionRecv; - ar.pfnDlgProc = DlgProcOptsTrigger; - ar.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_TRIGGER); - ar.pszName = Translate("Nudge : Shake contact list/chat window"); - - // register the action - CallService(MS_TRIGGER_REGISTERACTION, 0, (LPARAM)&ar); - - ar.actionFunction = TriggerActionSend; - ar.pszName = Translate("Nudge : Send a nudge"); - ar.pfnDlgProc = NULL; - ar.pszTemplate = NULL; - - // register the action - CallService(MS_TRIGGER_REGISTERACTION, 0, (LPARAM)&ar); - } -} - -void RegisterToDbeditorpp(void) -{ - // known modules list - if (ServiceExists("DBEditorpp/RegisterSingleModule")) - CallService("DBEditorpp/RegisterSingleModule", (WPARAM)"Nudge", 0); -} - -void LoadIcons(void) -{ - //Load icons - SKINICONDESC sid = {0}; - TCHAR szFilename[MAX_PATH]; - GetModuleFileName(hInst,szFilename,MAX_PATH); - - sid.cbSize = sizeof(sid); - sid.flags = SIDF_ALL_TCHAR; - sid.ptszSection = LPGENT("Nudge"); - sid.ptszDefaultFile = szFilename; - - sid.pszName = "Nudge_Default"; - sid.ptszDescription = LPGENT("Nudge as Default"); - sid.iDefaultIndex = -IDI_NUDGE; - sid.hDefaultIcon = LoadIcon(hInst,MAKEINTRESOURCE(IDI_NUDGE)); - g_hIcon = Skin_AddIcon(&sid); -} - -// Nudge support -static int TabsrmmButtonPressed(WPARAM wParam, LPARAM lParam) -{ - CustomButtonClickData *cbcd=(CustomButtonClickData *)lParam; - - if (!strcmp(cbcd->pszModule,"Nudge")) - NudgeSend(wParam, 0); - - return 0; -} - -static int TabsrmmButtonInit(WPARAM wParam, LPARAM lParam) -{ - BBButton bbd = {0}; - - bbd.cbSize = sizeof(BBButton); - bbd.pszModuleName = "Nudge"; - bbd.ptszTooltip = LPGENT("Send Nudge"); - bbd.dwDefPos = 300; - bbd.bbbFlags = BBBF_ISIMBUTTON|BBBF_ISLSIDEBUTTON|BBBF_CANBEHIDDEN; - bbd.hIcon = g_hIcon; - bbd.dwButtonID = 6000; - bbd.iButtonWidth = 0; - CallService (MS_BB_ADDBUTTON, 0, (LPARAM)&bbd); - - return 0; -} - -void HideNudgeButton(HANDLE hContact) -{ - char str[MAXMODULELABELLENGTH + 12] = {0}; - char *szProto = (char*) CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)hContact,0); - mir_snprintf(str,MAXMODULELABELLENGTH + 12,"%s/SendNudge", szProto); - - if (!ServiceExists(str)) - { - BBButton bbd={0}; - bbd.cbSize=sizeof(BBButton); - bbd.bbbFlags=BBSF_HIDDEN|BBSF_DISABLED; - bbd.pszModuleName="Nudge"; - bbd.dwButtonID = 6000; - CallService(MS_BB_SETBUTTONSTATE, (WPARAM)hContact, (LPARAM)&bbd); - } -} - -static int ContactWindowOpen(WPARAM wparam,LPARAM lParam) -{ - MessageWindowEventData *MWeventdata = (MessageWindowEventData*)lParam; - - if(MWeventdata->uType == MSG_WINDOW_EVT_OPENING&&MWeventdata->hContact) - { - HideNudgeButton(MWeventdata->hContact); - } - return 0; -} - -int ModulesLoaded(WPARAM,LPARAM) -{ - RegisterToTrigger(); - RegisterToDbeditorpp(); - LoadProtocols(); - LoadIcons(); - LoadPopupClass(); - - g_hEventToolbarLoaded = HookEvent(ME_MSG_TOOLBARLOADED, TabsrmmButtonInit); - if (g_hEventToolbarLoaded) - { - g_hEventButtonPressed = HookEvent(ME_MSG_BUTTONPRESSED, TabsrmmButtonPressed); - g_hEventDbWindowEvent = HookEvent(ME_MSG_WINDOWEVENT,ContactWindowOpen); - } - return 0; -} - -int AccListChanged(WPARAM wParam,LPARAM lParam) -{ - PROTOACCOUNT *proto = (PROTOACCOUNT*) wParam; - if (proto==NULL) - return 0; - - switch (lParam) - { - case PRAC_ADDED: - Nudge_AddAccount(proto); - break; - } - return 0; -} - -HANDLE hShakeClist=NULL,hShakeChat=NULL,hNudgeSend=NULL,hNudgeShowMenu=NULL; -extern "C" int __declspec(dllexport) Load(void) -{ - - mir_getLP(&pluginInfo); - - g_hEventModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED,ModulesLoaded); - g_hEventAccountsChanged = HookEvent(ME_PROTO_ACCLISTCHANGED,AccListChanged); - hEventOptionsInitialize = HookEvent(ME_OPT_INITIALISE, NudgeOptInit); - - //Create function for plugins - hShakeClist=CreateServiceFunction(MS_SHAKE_CLIST,ShakeClist); - hShakeChat=CreateServiceFunction(MS_SHAKE_CHAT,ShakeChat); - hNudgeSend=CreateServiceFunction(MS_NUDGE_SEND,NudgeSend); - hNudgeShowMenu=CreateServiceFunction(MS_NUDGE_SHOWMENU,NudgeShowMenu); - return 0; -} - -extern "C" int __declspec(dllexport) Unload(void) -{ - if(g_hEventToolbarLoaded) UnhookEvent(g_hEventToolbarLoaded); - if(g_hEventDbWindowEvent) UnhookEvent(g_hEventButtonPressed); - if(g_hEventDbWindowEvent) UnhookEvent(g_hEventDbWindowEvent); - - UnhookEvent(g_hEventModulesLoaded); - UnhookEvent(g_hEventAccountsChanged); - UnhookEvent(hEventOptionsInitialize); - - DestroyServiceFunction(hShakeClist); - DestroyServiceFunction(hShakeChat); - DestroyServiceFunction(hNudgeSend); - DestroyServiceFunction(hNudgeShowMenu); - - NudgeElementList* p = NudgeList; - while ( p != NULL ) - { - if(p->item.hEvent) UnhookEvent(p->item.hEvent); - NudgeElementList* p1 = p->next; - //free( p ); - delete p; - p = p1; - } - return 0; -} - -LRESULT CALLBACK NudgePopUpProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam) -{ - switch(msg) - { - case WM_COMMAND: - { - HANDLE hContact = PUGetContact(hWnd); - CallService(MS_MSG_SENDMESSAGET, (WPARAM)hContact, 0); - PUDeletePopUp(hWnd); - break; - } - - case WM_CONTEXTMENU: - PUDeletePopUp(hWnd); - break; - case UM_FREEPLUGINDATA: - //Here we'd free our own data, if we had it. - return FALSE; - case UM_INITPOPUP: - break; - case UM_DESTROYPOPUP: - break; - case WM_NOTIFY: - default: - break; - } - return DefWindowProc(hWnd,msg,wParam,lParam); -} - -void LoadPopupClass() -{ - if(ServiceExists(MS_POPUP_REGISTERCLASS)) - { - POPUPCLASS ppc = {0}; - ppc.cbSize = sizeof(ppc); - ppc.flags = PCF_TCHAR; - ppc.pszName = "nudge"; - ppc.ptszDescription = LPGENT("Show Nudge"); - ppc.hIcon = (HICON) CallService(MS_SKIN2_GETICONBYHANDLE,0,(LPARAM)g_hIcon); - ppc.colorBack = NULL; - ppc.colorText = NULL; - ppc.iSeconds = 0; - ppc.PluginWindowProc = NudgePopUpProc; - CallService(MS_POPUP_REGISTERCLASS,0,(LPARAM)&ppc); - } -} - -int Preview() -{ - HANDLE hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST,0,0); - if ( GlobalNudge.useByProtocol ) - { - for(NudgeElementList *n = NudgeList;n != NULL; n = n->next) - { - if(n->item.enabled) - { - SkinPlaySound( n->item.NudgeSoundname ); - if(n->item.showPopup) - Nudge_ShowPopup(n->item, hContact, n->item.recText); - if(n->item.openContactList) - OpenContactList(); - if(n->item.shakeClist) - ShakeClist(0,0); - if(n->item.openMessageWindow) - CallService(MS_MSG_SENDMESSAGET,(WPARAM)hContact,NULL); - if(n->item.shakeChat) - ShakeChat((WPARAM)hContact,(LPARAM)time(NULL)); - } - } - } - else - { - if(DefaultNudge.enabled) - { - SkinPlaySound( DefaultNudge.NudgeSoundname ); - if(DefaultNudge.showPopup) - Nudge_ShowPopup(DefaultNudge, hContact, DefaultNudge.recText); - if(DefaultNudge.openContactList) - OpenContactList(); - if(DefaultNudge.shakeClist) - ShakeClist(0,0); - if(DefaultNudge.openMessageWindow) - CallService(MS_MSG_SENDMESSAGET,(WPARAM)hContact,NULL); - if(DefaultNudge.shakeChat) - ShakeChat((WPARAM)hContact,(LPARAM)time(NULL)); - } - } - return 0; -} - -void Nudge_ShowPopup(CNudgeElement n, HANDLE hContact, TCHAR * Message) -{ - hContact = Nudge_GethContact(hContact); - TCHAR * lpzContactName = (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME,(WPARAM)hContact,GCDNF_TCHAR); - - if(ServiceExists(MS_POPUP_ADDPOPUPCLASS)) - { - POPUPDATACLASS NudgePopUp = {0}; - NudgePopUp.cbSize = sizeof(NudgePopUp); - NudgePopUp.hContact = hContact; - NudgePopUp.ptszText = Message; - NudgePopUp.ptszTitle = lpzContactName; - NudgePopUp.pszClassName = "nudge"; - CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&NudgePopUp); - } - else if(ServiceExists(MS_POPUP_ADDPOPUPT)) - { - POPUPDATAT NudgePopUp = {0}; - - NudgePopUp.lchContact = hContact; - NudgePopUp.lchIcon = (HICON) CallService(MS_SKIN2_GETICON,0,(LPARAM) n.hIcoLibItem ); - NudgePopUp.colorBack = 0; - NudgePopUp.colorText = 0; - NudgePopUp.iSeconds = 0; - NudgePopUp.PluginWindowProc = NudgePopUpProc; - NudgePopUp.PluginData = (void *)1; - - //lstrcpy(NudgePopUp.lpzText, Translate(Message)); - lstrcpy(NudgePopUp.lptzText, Message); - - lstrcpy(NudgePopUp.lptzContactName, lpzContactName); - - CallService(MS_POPUP_ADDPOPUPT,(WPARAM)&NudgePopUp,0); - } - else - { - MessageBox(NULL,Message,lpzContactName,0); - } -} - -void Nudge_SentStatus(CNudgeElement n, HANDLE hContact) -{ - DBEVENTINFO NudgeEvent = { 0 }; - - NudgeEvent.cbSize = sizeof(NudgeEvent); - NudgeEvent.szModule = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); - - char *buff = mir_utf8encodeT(n.senText); - NudgeEvent.flags = DBEF_SENT | DBEF_UTF; - - NudgeEvent.timestamp = ( DWORD )time(NULL); - NudgeEvent.eventType = EVENTTYPE_STATUSCHANGE; - NudgeEvent.cbBlob = (DWORD)strlen(buff) + 1; - NudgeEvent.pBlob = ( PBYTE ) buff; - - INT_PTR res = CallService( MS_MC_GETMETACONTACT, (WPARAM)hContact, 0 ); //try to retrieve the metacontact if some - if(res != CALLSERVICE_NOTFOUND) - { - HANDLE hMetaContact = (HANDLE) res; - if(hMetaContact != NULL) //metacontact - CallService(MS_DB_EVENT_ADD,(WPARAM)hMetaContact,(LPARAM)&NudgeEvent); - } - - - CallService(MS_DB_EVENT_ADD,(WPARAM)hContact,(LPARAM)&NudgeEvent); -} - -void Nudge_ShowStatus(CNudgeElement n, HANDLE hContact, DWORD timestamp) -{ - DBEVENTINFO NudgeEvent = { 0 }; - - NudgeEvent.cbSize = sizeof(NudgeEvent); - NudgeEvent.szModule = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); - - char *buff = mir_utf8encodeT(n.recText); - NudgeEvent.flags = DBEF_UTF; - - NudgeEvent.timestamp = timestamp; - NudgeEvent.eventType = EVENTTYPE_STATUSCHANGE; - NudgeEvent.cbBlob = (DWORD)strlen(buff) + 1; - NudgeEvent.pBlob = ( PBYTE ) buff; - - - INT_PTR res = CallService( MS_MC_GETMETACONTACT, (WPARAM)hContact, 0 ); //try to retrieve the metacontact if some - if(res != CALLSERVICE_NOTFOUND) - { - HANDLE hMetaContact = (HANDLE) res; - if(hMetaContact != NULL) //metacontact - { - CallService(MS_DB_EVENT_ADD,(WPARAM)hMetaContact,(LPARAM)&NudgeEvent); - NudgeEvent.flags |= DBEF_READ; - } - } - - CallService(MS_DB_EVENT_ADD,(WPARAM)hContact,(LPARAM)&NudgeEvent); -} - -HANDLE Nudge_GethContact(HANDLE hContact) -{ - INT_PTR res = CallService( MS_MC_GETMETACONTACT, (WPARAM)hContact, 0 ); - if(res!=CALLSERVICE_NOTFOUND) - { - HANDLE hMetaContact = (HANDLE) res; - if(hMetaContact!=NULL) - return hMetaContact; - } - - return hContact; -} - -void Nudge_AddAccount(PROTOACCOUNT *proto) -{ - char str[MAXMODULELABELLENGTH + 10]; - mir_snprintf(str,sizeof(str),"%s/Nudge",proto->szModuleName); - HANDLE hevent = HookEvent(str, NudgeRecieved); - if(hevent == NULL) - return; - - nProtocol ++; - - //Add a specific sound per protocol - NudgeElementList *newNudge = new NudgeElementList; - //newNudge = (NudgeElementList*) malloc(sizeof(NudgeElementList)); - mir_snprintf(newNudge->item.NudgeSoundname,sizeof(newNudge->item.NudgeSoundname),"%s: Nudge",proto->szModuleName); - - strcpy( newNudge->item.ProtocolName, proto->szProtoName ); - _tcscpy(newNudge->item.AccountName, proto->tszAccountName ); - - newNudge->item.Load(); - - newNudge->item.hEvent = hevent; - - TCHAR soundDesc[MAXMODULELABELLENGTH + 10]; - mir_sntprintf(soundDesc,sizeof(soundDesc),_T("Nudge for %s"),proto->tszAccountName); - SkinAddNewSoundExT(newNudge->item.NudgeSoundname, LPGENT("Nudge"), soundDesc); - - newNudge->next = NudgeList; - NudgeList = newNudge; - - char iconName[MAXMODULELABELLENGTH + 10]; - mir_snprintf(iconName,sizeof(iconName),"Nudge_%s",proto->szModuleName); - - TCHAR szFilename[MAX_PATH], iconDesc[MAXMODULELABELLENGTH + 10]; - GetModuleFileName(hInst,szFilename,MAX_PATH); - mir_sntprintf(iconDesc, SIZEOF(iconDesc), TranslateT("Nudge for %s"), proto->tszAccountName); - - SKINICONDESC sid = {0}; - sid.cbSize = sizeof(sid); - sid.flags = SIDF_ALL_TCHAR; - sid.ptszSection = LPGENT("Nudge"); - sid.ptszDefaultFile = szFilename; - sid.pszName = iconName; - sid.ptszDescription = iconDesc; - sid.iDefaultIndex = -IDI_NUDGE; - sid.hDefaultIcon = LoadIcon(hInst,MAKEINTRESOURCE(IDI_NUDGE)); - newNudge->item.hIcoLibItem = Skin_AddIcon(&sid); - - //Add contact menu entry - CLISTMENUITEM mi = {0}; - mi.cbSize = sizeof(mi); - mi.popupPosition = 500085000; - mi.pszContactOwner = proto->szModuleName; - mi.pszPopupName = proto->szModuleName; - mi.flags = CMIF_NOTOFFLINE | CMIF_TCHAR | CMIF_ICONFROMICOLIB; - mi.position = -500050004; - mi.icolibItem = newNudge->item.hIcoLibItem; - mi.ptszName = LPGENT( "Send &Nudge" ); - mi.pszService = MS_NUDGE_SEND; - newNudge->item.hContactMenu = Menu_AddContactMenuItem(&mi); -} - -void AutoResendNudge(void *wParam) -{ - - Sleep(GlobalNudge.resendDelaySec * 1000); - NudgeSend((WPARAM) wParam,NULL); -} diff --git a/plugins/Nudge/main.h b/plugins/Nudge/main.h deleted file mode 100644 index 556ee0070b..0000000000 --- a/plugins/Nudge/main.h +++ /dev/null @@ -1,31 +0,0 @@ -#include "nudge.h" - -/* -* -****************************/ -void Nudge_ShowPopup(CNudgeElement, HANDLE, TCHAR *); - -/* -* -****************************/ -void Nudge_ShowStatus(CNudgeElement, HANDLE, DWORD timestamp); - -/* -* -****************************/ -void Nudge_SentStatus(CNudgeElement, HANDLE); - -/* -* -****************************/ -void Nudge_AddAccount(PROTOACCOUNT *proto); - -/* -* -****************************/ -void LoadPopupClass(); - -/* -* -****************************/ -void AutoResendNudge(void *wParam) ; diff --git a/plugins/Nudge/miranda.ico b/plugins/Nudge/miranda.ico deleted file mode 100644 index 4fba0d431a..0000000000 Binary files a/plugins/Nudge/miranda.ico and /dev/null differ diff --git a/plugins/Nudge/nudge-translation.txt b/plugins/Nudge/nudge-translation.txt deleted file mode 100644 index 454dd7ef60..0000000000 --- a/plugins/Nudge/nudge-translation.txt +++ /dev/null @@ -1,62 +0,0 @@ -; Common strings that belong to many files -;[Nudge] - -; ../../plugins/Nudge/main.cpp -;[Default Nudge] -;[ExampleAction] -;[Nudge : Send a nudge] -;[Nudge : Shake contact list/chat window] -;[Nudge as Default] -;[Nudge for %s] -;[Send &Nudge] -;[Send Nudge] -;[Show Nudge] -;[You are not allowed to send too much nudge (only 1 each %d sec, %d sec left)] - -; ../../plugins/Nudge/nudge.cpp -;[You received a nudge] -;[You sent a nudge] - -; ../../plugins/Nudge/options.cpp -;[Events] -;[Window Shaking] - -; ../../plugins/Nudge/resource.rc -;[* Nudge sending delay is hardcoded and cannot be changed.] -;[Allow nudges when you're:] -;[Allow receiving one nudge from the same contact every :] -;[Allow sending* one nudge to the same contact every :] -;[Auto resend nudge after] -;[Away] -;[DND] -;[Enable contact list shaking] -;[Enable message window shaking] -;[Enable popup notification] -;[Free for chat] -;[Invisible] -;[NA] -;[Number of moves] -;[Occupied] -;[Offline] -;[On the phone] -;[Online] -;[Open contact list] -;[Open message window] -;[Out to lunch] -;[Preview] -;[Privacy] -;[Protocol options] -;[Receiving text] -;[Respect ignore settings (status changes)] -;[Sending text] -;[Shake the chat window] -;[Shake the contact list] -;[Shaking Clist Options] -;[Shaking Message Window Options] -;[Show as status change] -;[Slider1] -;[Specify options for each protocol] -;[Static] -;[Text] -;[Width of move] -;[s] diff --git a/plugins/Nudge/nudge.cpp b/plugins/Nudge/nudge.cpp deleted file mode 100644 index 0afa6edee0..0000000000 --- a/plugins/Nudge/nudge.cpp +++ /dev/null @@ -1,117 +0,0 @@ -#include "headers.h" -#include "nudge.h" - -void CNudge::Save(void) -{ - char SectionName[512]; - mir_snprintf(SectionName,512,"useByProtocol"); - DBWriteContactSettingByte(NULL, "Nudge", SectionName, this->useByProtocol); - mir_snprintf(SectionName,512,"RecvTimeSec"); - DBWriteContactSettingDword(NULL, "Nudge", SectionName, this->recvTimeSec); - mir_snprintf(SectionName,512,"SendTimeSec"); - DBWriteContactSettingDword(NULL, "Nudge", SectionName, this->sendTimeSec); - mir_snprintf(SectionName,512,"ResendDelaySec"); - DBWriteContactSettingDword(NULL, "Nudge", SectionName, this->resendDelaySec); -} - - -void CNudge::Load(void) -{ - char SectionName[512]; - mir_snprintf(SectionName,512,"useByProtocol"); - this->useByProtocol = DBGetContactSettingByte(NULL, "Nudge", SectionName, FALSE) != 0; - mir_snprintf(SectionName,512,"RecvTimeSec"); - this->recvTimeSec = DBGetContactSettingDword(NULL, "Nudge", SectionName, 30); - mir_snprintf(SectionName,512,"SendTimeSec"); - this->sendTimeSec = DBGetContactSettingDword(NULL, "Nudge", SectionName, 30); - mir_snprintf(SectionName,512,"ResendDelaySec"); - this->resendDelaySec = DBGetContactSettingDword(NULL, "Nudge", SectionName, 3); -} - -int CNudgeElement::ShowContactMenu(bool show) -{ - - CLISTMENUITEM mi; - memset( &mi, 0, sizeof( mi )); - mi.cbSize = sizeof( mi ); - mi.flags = show? CMIM_FLAGS : CMIM_FLAGS | CMIF_HIDDEN ; - CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hContactMenu, (LPARAM)&mi); - - return 0; -} - -void CNudgeElement::Save(void) -{ - char SectionName[512]; - mir_snprintf(SectionName,512,"%s-openMessageWindow", ProtocolName); - DBWriteContactSettingByte(NULL, "Nudge", SectionName, this->openMessageWindow); - mir_snprintf(SectionName,512,"%s-openContactList", ProtocolName); - DBWriteContactSettingByte(NULL, "Nudge", SectionName, this->openContactList); - mir_snprintf(SectionName,512,"%s-useIgnore", ProtocolName); - DBWriteContactSettingByte(NULL, "Nudge", SectionName, this->useIgnoreSettings); - mir_snprintf(SectionName,512,"%s-showStatus", ProtocolName); - DBWriteContactSettingByte(NULL, "Nudge", SectionName, this->showStatus); - mir_snprintf(SectionName,512,"%s-showPopup", ProtocolName); - DBWriteContactSettingByte(NULL, "Nudge", SectionName, this->showPopup); - mir_snprintf(SectionName,512,"%s-shakeClist", ProtocolName); - DBWriteContactSettingByte(NULL, "Nudge", SectionName, this->shakeClist); - mir_snprintf(SectionName,512,"%s-shakeChat", ProtocolName); - DBWriteContactSettingByte(NULL, "Nudge", SectionName, this->shakeChat); - mir_snprintf(SectionName,512,"%s-enabled", ProtocolName); - DBWriteContactSettingByte(NULL, "Nudge", SectionName, this->enabled); - mir_snprintf(SectionName,512,"%s-autoResend", ProtocolName); - DBWriteContactSettingByte(NULL, "Nudge", SectionName, this->autoResend); - mir_snprintf(SectionName,512,"%s-statusFlags", ProtocolName); - DBWriteContactSettingDword(NULL, "Nudge", SectionName, this->statusFlags); - mir_snprintf(SectionName,512,"%s-recText", ProtocolName); - DBWriteContactSettingTString(NULL, "Nudge", SectionName, this->recText); - mir_snprintf(SectionName,512,"%s-senText", ProtocolName); - DBWriteContactSettingTString(NULL, "Nudge", SectionName, this->senText); -} - - -void CNudgeElement::Load(void) -{ - DBVARIANT dbv; - char SectionName[512]; - mir_snprintf(SectionName,512,"%s-openMessageWindow", ProtocolName); - this->openMessageWindow = DBGetContactSettingByte(NULL, "Nudge", SectionName, TRUE) != 0; - mir_snprintf(SectionName,512,"%s-openContactList", ProtocolName); - this->openContactList = DBGetContactSettingByte(NULL, "Nudge", SectionName, TRUE) != 0; - mir_snprintf(SectionName,512,"%s-useIgnore", ProtocolName); - this->useIgnoreSettings = DBGetContactSettingByte(NULL, "Nudge", SectionName, TRUE) != 0; - mir_snprintf(SectionName,512,"%s-showStatus", ProtocolName); - this->showStatus = DBGetContactSettingByte(NULL, "Nudge", SectionName, TRUE) != 0; - mir_snprintf(SectionName,512,"%s-showPopup", ProtocolName); - this->showPopup = DBGetContactSettingByte(NULL, "Nudge", SectionName, TRUE) != 0; - mir_snprintf(SectionName,512,"%s-shakeClist", ProtocolName); - this->shakeClist = DBGetContactSettingByte(NULL, "Nudge", SectionName, TRUE) != 0; - mir_snprintf(SectionName,512,"%s-shakeChat", ProtocolName); - this->shakeChat = DBGetContactSettingByte(NULL, "Nudge", SectionName, TRUE) != 0; - mir_snprintf(SectionName,512,"%s-enabled", ProtocolName); - this->enabled = DBGetContactSettingByte(NULL, "Nudge", SectionName, TRUE) != 0; - mir_snprintf(SectionName,512,"%s-autoResend", ProtocolName); - this->autoResend = DBGetContactSettingByte(NULL, "Nudge", SectionName, FALSE) != 0; - mir_snprintf(SectionName,512,"%s-statusFlags", ProtocolName); - this->statusFlags = DBGetContactSettingDword(NULL, "Nudge", SectionName, 967); - mir_snprintf(SectionName,512,"%s-recText", ProtocolName); - if (!DBGetContactSettingTString(NULL,"Nudge",SectionName,&dbv)) - { - _tcsncpy(this->recText,dbv.ptszVal,TEXT_LEN); - if(_tcsclen(this->recText) < 1) - _tcsncpy(this->recText,TranslateT("You received a nudge"),TEXT_LEN); - DBFreeVariant(&dbv); - } - else - _tcsncpy(this->recText,TranslateT("You received a nudge"),TEXT_LEN); - mir_snprintf(SectionName,512,"%s-senText", ProtocolName); - if (!DBGetContactSettingTString(NULL,"Nudge",SectionName,&dbv)) - { - _tcsncpy(this->senText,dbv.ptszVal,TEXT_LEN); - if(_tcsclen(this->senText) < 1) - _tcsncpy(this->senText,TranslateT("You sent a nudge"),TEXT_LEN); - DBFreeVariant(&dbv); - } - else - _tcsncpy(this->senText,TranslateT("You sent a nudge"),TEXT_LEN); -} \ No newline at end of file diff --git a/plugins/Nudge/nudge.h b/plugins/Nudge/nudge.h deleted file mode 100644 index 8a531639ca..0000000000 --- a/plugins/Nudge/nudge.h +++ /dev/null @@ -1,67 +0,0 @@ -#ifndef NUDGE_H -#define NUDGE_H - -// NUDGE account status flags -#define NUDGE_ACC_ST0 0x00000001 //Check (countdown) when Offline -#define NUDGE_ACC_ST1 0x00000002 //Check (countdown) when Online -#define NUDGE_ACC_ST2 0x00000004 //Check (countdown) when Away -#define NUDGE_ACC_ST3 0x00000008 //Check (countdown) when N/A -#define NUDGE_ACC_ST4 0x00000010 //Check (countdown) when Occupied -#define NUDGE_ACC_ST5 0x00000020 //Check (countdown) when DND -#define NUDGE_ACC_ST6 0x00000040 //Check (countdown) when Free for chat -#define NUDGE_ACC_ST7 0x00000080 //Check (countdown) when Invisible -#define NUDGE_ACC_ST8 0x00000100 //Check (countdown) when On the phone -#define NUDGE_ACC_ST9 0x00000200 //Check (countdown) when Out to lunch - -// For status log -#define EVENTTYPE_STATUSCHANGE 25368 - -#define TEXT_LEN 1024 - -class CNudge -{ -public: - bool useByProtocol; - int sendTimeSec; - int recvTimeSec; - int resendDelaySec; - - void Load(void); - void Save(void); -}; - -class CNudgeElement -{ -public: - char ProtocolName[64]; - TCHAR AccountName[128]; - char NudgeSoundname[100]; - TCHAR recText[TEXT_LEN]; - TCHAR senText[TEXT_LEN]; - bool showPopup; - bool showStatus; - bool openMessageWindow; - bool openContactList; - bool useIgnoreSettings; - bool shakeClist; - bool shakeChat; - bool enabled; - bool autoResend; - DWORD statusFlags; - int iProtoNumber; - HANDLE hIcoLibItem; - HANDLE hEvent; - HANDLE hContactMenu; - - void Load(void); - void Save(void); - int ShowContactMenu(bool show); -}; - -typedef struct NudgeElementList -{ - CNudgeElement item; - NudgeElementList *next; -} NUDGEELEMENTLIST; - -#endif \ No newline at end of file diff --git a/plugins/Nudge/nudge_10.vcxproj b/plugins/Nudge/nudge_10.vcxproj index 80400c5152..f5b50a0d35 100644 --- a/plugins/Nudge/nudge_10.vcxproj +++ b/plugins/Nudge/nudge_10.vcxproj @@ -21,7 +21,6 @@ Nudge {8190CFAA-3B73-43D8-9101-8368E21F1864} - nudge @@ -74,14 +73,13 @@ Disabled ..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) - WIN32;_DEBUG;_WINDOWS;_USRDLL;nudge_EXPORTS;%(PreprocessorDefinitions) + WIN32;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebugDLL Use Level3 EditAndContinue headers.h - 4996;%(DisableSpecificWarnings) _DEBUG;%(PreprocessorDefinitions) @@ -100,13 +98,12 @@ Disabled ..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) - WIN64;_DEBUG;_WINDOWS;_USRDLL;nudge_EXPORTS;%(PreprocessorDefinitions) + WIN64;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) EnableFastChecks MultiThreadedDebugDLL Use Level3 headers.h - 4996;%(DisableSpecificWarnings) _DEBUG;%(PreprocessorDefinitions) @@ -128,12 +125,11 @@ Size false ..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) - WIN32;NDEBUG;_WINDOWS;_USRDLL;nudge_EXPORTS;%(PreprocessorDefinitions) + WIN32;NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) true true Use Level3 - 4996;%(DisableSpecificWarnings) headers.h @@ -158,12 +154,11 @@ Size false ..\..\include;..\ExternalAPI;%(AdditionalIncludeDirectories) - WIN64;NDEBUG;_WINDOWS;_USRDLL;nudge_EXPORTS;%(PreprocessorDefinitions) + WIN64;NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions) true true Use Level3 - 4996;%(DisableSpecificWarnings) headers.h @@ -182,33 +177,23 @@ - + Create - - - + + + - - - - - - + + + + + + - - - - - - - - - - - + diff --git a/plugins/Nudge/nudge_10.vcxproj.filters b/plugins/Nudge/nudge_10.vcxproj.filters index d21def2c41..87af4fd86d 100644 --- a/plugins/Nudge/nudge_10.vcxproj.filters +++ b/plugins/Nudge/nudge_10.vcxproj.filters @@ -1,76 +1,52 @@  - + + {021e1c6f-a1a3-4538-b5a1-7df818ac8791} + + + {24214ff5-3fda-4081-a191-e7d6bbf80014} + + + {3041ddc0-6ef1-4fb6-a3bd-e81f1ce388eb} + + + + Source Files - + Source Files - + Source Files - + Source Files - + Header Files - + Header Files - + Header Files - + Header Files - + Header Files - + Header Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - Resource Files - - - - - {021e1c6f-a1a3-4538-b5a1-7df818ac8791} - - - {24214ff5-3fda-4081-a191-e7d6bbf80014} - - - {3041ddc0-6ef1-4fb6-a3bd-e81f1ce388eb} - - - - + Resource Files diff --git a/plugins/Nudge/options.cpp b/plugins/Nudge/options.cpp deleted file mode 100644 index b0369143dc..0000000000 --- a/plugins/Nudge/options.cpp +++ /dev/null @@ -1,435 +0,0 @@ -#include "headers.h" -#include "main.h" -#include "shake.h" -#include "options.h" - -CNudgeElement* ActualNudge = NULL; - - - -int NudgeOptInit(WPARAM wParam,LPARAM lParam) -{ - OPTIONSDIALOGPAGE odp = { 0 }; - odp.cbSize = sizeof(odp); - odp.position = -790000000; - odp.hInstance = hInst; - odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_NUDGE); - odp.pszTitle = LPGEN("Nudge"); - odp.pszGroup = LPGEN("Events"); - odp.pszTab = LPGEN("Nudge"); - odp.flags = ODPF_BOLDGROUPS; - odp.pfnDlgProc = DlgProcNudgeOpt; - Options_AddPage(wParam, &odp); - - odp.position = -790000001; - odp.pszTab = LPGEN("Window Shaking"); - odp.pfnDlgProc = DlgProcShakeOpt; - odp.flags |= ODPF_EXPERTONLY; - odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_SHAKE); - Options_AddPage(wParam, &odp); - return 0; -} - -INT_PTR CALLBACK DlgProcShakeOpt(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam) -{ - switch(msg) - { - case WM_INITDIALOG: - TCHAR szBuf[20]; - TranslateDialogDefault(hwnd); - mir_sntprintf(szBuf, 10, _T("%d"), shake.nMoveClist); - SetDlgItemText(hwnd,IDC_LNUMBER_CLIST,szBuf); - mir_sntprintf(szBuf, 10, _T("%d"), shake.nMoveChat); - SetDlgItemText(hwnd,IDC_LNUMBER_CHAT,szBuf); - - mir_sntprintf(szBuf, 10, _T("%d"), shake.nScaleClist); - SetDlgItemText(hwnd,IDC_LSCALE_CLIST,szBuf); - mir_sntprintf(szBuf, 10, _T("%d"), shake.nScaleChat); - SetDlgItemText(hwnd,IDC_LSCALE_CHAT,szBuf); - - SendDlgItemMessage(hwnd, IDC_SNUMBER_CLIST, TBM_SETRANGE, 0, (LPARAM)MAKELONG(1, 60)); - SendDlgItemMessage(hwnd, IDC_SNUMBER_CHAT, TBM_SETRANGE, 0, (LPARAM)MAKELONG(1, 60)); - - SendDlgItemMessage(hwnd, IDC_SSCALE_CLIST, TBM_SETRANGE, 0, (LPARAM)MAKELONG(1, 40)); - SendDlgItemMessage(hwnd, IDC_SSCALE_CHAT, TBM_SETRANGE, 0, (LPARAM)MAKELONG(1, 40)); - - SendDlgItemMessage(hwnd, IDC_SNUMBER_CLIST, TBM_SETPOS, TRUE, shake.nMoveClist); - SendDlgItemMessage(hwnd, IDC_SNUMBER_CHAT, TBM_SETPOS, TRUE, shake.nMoveChat); - - SendDlgItemMessage(hwnd, IDC_SSCALE_CLIST, TBM_SETPOS, TRUE, shake.nScaleClist); - SendDlgItemMessage(hwnd, IDC_SSCALE_CHAT, TBM_SETPOS, TRUE, shake.nScaleChat); - - break; - case WM_COMMAND: - { - WORD wNotifyCode = HIWORD(wParam); - switch(LOWORD(wParam)) - { - case IDC_PREVIEW: - ShakeClist(0,0); - //SendMessage(GetParent(hwnd),PSM_CHANGED,0,0); - break; - } - break; - } - case WM_HSCROLL: - if ((HWND)lParam == GetDlgItem(hwnd, IDC_SNUMBER_CLIST) || (HWND)lParam == GetDlgItem(hwnd, IDC_SNUMBER_CHAT) - || (HWND)lParam == GetDlgItem(hwnd, IDC_SSCALE_CLIST) || (HWND)lParam == GetDlgItem(hwnd, IDC_SSCALE_CHAT)) - { - TCHAR szBuf[20]; - DWORD dwPos = SendMessage((HWND) lParam, TBM_GETPOS, 0, 0); - mir_sntprintf(szBuf, sizeof(szBuf), _T("%d"), dwPos); - if ((HWND)lParam == GetDlgItem(hwnd, IDC_SNUMBER_CLIST)) - SetDlgItemText(hwnd,IDC_LNUMBER_CLIST,szBuf); - if ((HWND)lParam == GetDlgItem(hwnd, IDC_SNUMBER_CHAT)) - SetDlgItemText(hwnd,IDC_LNUMBER_CHAT,szBuf); - if ((HWND)lParam == GetDlgItem(hwnd, IDC_SSCALE_CLIST)) - SetDlgItemText(hwnd,IDC_LSCALE_CLIST,szBuf); - if ((HWND)lParam == GetDlgItem(hwnd, IDC_SSCALE_CHAT)) - SetDlgItemText(hwnd,IDC_LSCALE_CHAT,szBuf); - SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); - } - break; - - case WM_SHOWWINDOW: - break; - - case WM_NOTIFY: - switch(((LPNMHDR)lParam)->idFrom) - { - case 0: - switch(((LPNMHDR)lParam)->code) - { - case PSN_APPLY: - { - shake.nMoveClist = (int) SendMessage(GetDlgItem(hwnd, IDC_SNUMBER_CLIST), TBM_GETPOS, 0, 0); - shake.nMoveChat = (int) SendMessage(GetDlgItem(hwnd, IDC_SNUMBER_CHAT), TBM_GETPOS, 0, 0); - shake.nScaleClist = (int) SendMessage(GetDlgItem(hwnd, IDC_SSCALE_CLIST), TBM_GETPOS, 0, 0); - shake.nScaleChat = (int) SendMessage(GetDlgItem(hwnd, IDC_SSCALE_CHAT), TBM_GETPOS, 0, 0); - shake.Save(); - } - } - } - break; - } - - return FALSE; -} - -void CreateImageList(HWND hWnd) -{ - // Create and populate image list - HIMAGELIST hImList = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_MASK | ILC_COLOR32, nProtocol, 0); - - for(NudgeElementList *n = NudgeList;n != NULL; n = n->next) - { - INT_PTR res = CallProtoService(n->item.ProtocolName, PS_LOADICON,PLI_PROTOCOL | PLIF_SMALL | PLIF_ICOLIB, 0); - if(res==CALLSERVICE_NOTFOUND) - { - res = CallService(MS_SKIN2_GETICONBYHANDLE,0,(LPARAM)n->item.hIcoLibItem); - } - - HICON hIcon = (HICON) res; - ImageList_AddIcon(hImList, hIcon); - } - //ADD default Icon for nudge - HICON hIcon = (HICON) LoadImage(hInst, MAKEINTRESOURCE(IDI_NUDGE), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0); - ImageList_AddIcon(hImList, hIcon); - DestroyIcon(hIcon); - - HWND hLstView = GetDlgItem(hWnd, IDC_PROTOLIST); - TreeView_SetImageList(hLstView, hImList, TVSIL_NORMAL); -} - -void PopulateProtocolList(HWND hWnd) -{ - bool useOne = IsDlgButtonChecked(hWnd, IDC_USEBYPROTOCOL) == BST_UNCHECKED; - - HWND hLstView = GetDlgItem(hWnd, IDC_PROTOLIST); - - TreeView_DeleteAllItems(hLstView); - - TVINSERTSTRUCT tvi = {0}; - tvi.hParent = TVI_ROOT; - tvi.hInsertAfter = TVI_LAST; - tvi.item.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_STATE | TVIF_SELECTEDIMAGE; - tvi.item.stateMask = TVIS_STATEIMAGEMASK; - - int i = 0; - if (GlobalNudge.useByProtocol) - { - for(NudgeElementList *n = NudgeList;n != NULL; n = n->next) - { - tvi.item.pszText = n->item.AccountName; - tvi.item.iImage = i; - n->item.iProtoNumber = i; - tvi.item.iSelectedImage = i; - tvi.item.state = INDEXTOSTATEIMAGEMASK(n->item.enabled?2:1); - TreeView_InsertItem(hLstView, &tvi); - i++; - } - } - else - { - tvi.item.pszText = TranslateT("Nudge"); - tvi.item.iImage = nProtocol; - DefaultNudge.iProtoNumber = nProtocol; - tvi.item.iSelectedImage = nProtocol; - tvi.item.state = INDEXTOSTATEIMAGEMASK(DefaultNudge.enabled?2:1); - TreeView_InsertItem(hLstView, &tvi); - - } - TreeView_SelectItem(hLstView, TreeView_GetRoot(hLstView)); - //TreeView_SetCheckState(hLstView, TreeView_GetRoot(hLstView), TRUE) -} - - -INT_PTR CALLBACK DlgProcNudgeOpt(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam) -{ - static bool iInitDone = true; - switch(msg) - { - case WM_INITDIALOG: - iInitDone = false; - TranslateDialogDefault(hwnd); - CreateImageList(hwnd); - PopulateProtocolList(hwnd); - UpdateControls(hwnd); - iInitDone = true; - break; - case WM_DESTROY: - { - HIMAGELIST hImList = TreeView_GetImageList(GetDlgItem(hwnd, IDC_PROTOLIST), TVSIL_NORMAL); - if (hImList) - { - TreeView_SetImageList(GetDlgItem(hwnd, IDC_PROTOLIST), NULL, TVSIL_NORMAL); // Avoiding Access Violation in CommonControls DLL - ImageList_Destroy(hImList); - } - break; - } - case WM_COMMAND: - { - WORD wNotifyCode = HIWORD(wParam); - switch(LOWORD(wParam)) - { - case IDC_PREVIEW: - Preview(); - break; - case IDC_USEBYPROTOCOL: - GlobalNudge.useByProtocol = (IsDlgButtonChecked(hwnd,IDC_USEBYPROTOCOL)==BST_CHECKED); - PopulateProtocolList(hwnd); - UpdateControls(hwnd); - SendMessage(GetParent(hwnd),PSM_CHANGED,0,0); - break; - case IDC_AUTORESEND: - if (ActualNudge)// fix NULL pointer then no nudge support protocols - { - ActualNudge->autoResend = (IsDlgButtonChecked(hwnd,IDC_AUTORESEND)==BST_CHECKED); - EnableWindow(GetDlgItem(hwnd,IDC_RESENDDELAY),ActualNudge->autoResend); - } - SendMessage(GetParent(hwnd),PSM_CHANGED,0,0); - break; - case IDC_CHECKST0: - case IDC_CHECKST1: - case IDC_CHECKST2: - case IDC_CHECKST3: - case IDC_CHECKST4: - case IDC_CHECKST5: - case IDC_CHECKST6: - case IDC_CHECKST7: - case IDC_CHECKST8: - case IDC_CHECKST9: - case IDC_CHECKPOP: - case IDC_OPENMESSAGE: - case IDC_CHECKCLIST: - case IDC_CHECKCHAT: - case IDC_CHECKSTATUS: - case IDC_IGNORE: - case IDC_OPENCONTACTLIST: - SendMessage(GetParent(hwnd),PSM_CHANGED,0,0); - break; - case IDC_RESENDDELAY: - case IDC_SENDTEXT: - case IDC_RECVTEXT: - case IDC_SENDTIME: - case IDC_RECVTIME: - if(iInitDone && (wNotifyCode == EN_CHANGE)) - SendMessage(GetParent(hwnd),PSM_CHANGED,0,0); - break; - } - break; - } - case WM_SHOWWINDOW: - break; - - case WM_NOTIFY: - switch(((LPNMHDR)lParam)->idFrom) - { - case 0: - switch(((LPNMHDR)lParam)->code) - { - case PSN_APPLY: - { - BOOL Translated; - GlobalNudge.sendTimeSec = GetDlgItemInt(hwnd,IDC_SENDTIME,&Translated,FALSE); - GlobalNudge.recvTimeSec = GetDlgItemInt(hwnd,IDC_RECVTIME,&Translated,FALSE); - GlobalNudge.resendDelaySec = GetDlgItemInt(hwnd,IDC_RESENDDELAY,&Translated,FALSE); - if(GlobalNudge.resendDelaySec > 10 ) GlobalNudge.resendDelaySec = 10; - if(GlobalNudge.resendDelaySec < 1 ) GlobalNudge.resendDelaySec = 1; - if (ActualNudge)// fix NULL pointer then no nudge support protocols - { - ActualNudge->shakeClist = (IsDlgButtonChecked(hwnd,IDC_CHECKCLIST)==BST_CHECKED); - ActualNudge->shakeChat = (IsDlgButtonChecked(hwnd,IDC_CHECKCHAT)==BST_CHECKED); - ActualNudge->openMessageWindow = (IsDlgButtonChecked(hwnd,IDC_OPENMESSAGE)==BST_CHECKED); - ActualNudge->openContactList = (IsDlgButtonChecked(hwnd,IDC_OPENCONTACTLIST)==BST_CHECKED); - ActualNudge->useIgnoreSettings = (IsDlgButtonChecked(hwnd,IDC_IGNORE)==BST_CHECKED); - ActualNudge->showStatus = (IsDlgButtonChecked(hwnd,IDC_CHECKSTATUS)==BST_CHECKED); - ActualNudge->showPopup = (IsDlgButtonChecked(hwnd,IDC_CHECKPOP)==BST_CHECKED); - ActualNudge->statusFlags = - ((IsDlgButtonChecked(hwnd,IDC_CHECKST0)==BST_CHECKED) ? NUDGE_ACC_ST0 : 0) | - ((IsDlgButtonChecked(hwnd,IDC_CHECKST1)==BST_CHECKED) ? NUDGE_ACC_ST1 : 0) | - ((IsDlgButtonChecked(hwnd,IDC_CHECKST2)==BST_CHECKED) ? NUDGE_ACC_ST2 : 0) | - ((IsDlgButtonChecked(hwnd,IDC_CHECKST3)==BST_CHECKED) ? NUDGE_ACC_ST3 : 0) | - ((IsDlgButtonChecked(hwnd,IDC_CHECKST4)==BST_CHECKED) ? NUDGE_ACC_ST4 : 0) | - ((IsDlgButtonChecked(hwnd,IDC_CHECKST5)==BST_CHECKED) ? NUDGE_ACC_ST5 : 0) | - ((IsDlgButtonChecked(hwnd,IDC_CHECKST6)==BST_CHECKED) ? NUDGE_ACC_ST6 : 0) | - ((IsDlgButtonChecked(hwnd,IDC_CHECKST7)==BST_CHECKED) ? NUDGE_ACC_ST7 : 0) | - ((IsDlgButtonChecked(hwnd,IDC_CHECKST8)==BST_CHECKED) ? NUDGE_ACC_ST8 : 0) | - ((IsDlgButtonChecked(hwnd,IDC_CHECKST9)==BST_CHECKED) ? NUDGE_ACC_ST9 : 0) ; - - GetDlgItemText(hwnd,IDC_SENDTEXT,ActualNudge->senText,TEXT_LEN); - GetDlgItemText(hwnd,IDC_RECVTEXT,ActualNudge->recText,TEXT_LEN); - ActualNudge->Save(); - } - GlobalNudge.Save(); - } - } - case IDC_PROTOLIST: - switch (((LPNMHDR)lParam)->code) - { - case NM_CLICK: - { - TVHITTESTINFO ht = {0}; - - DWORD dwpos = GetMessagePos(); - POINTSTOPOINT(ht.pt, MAKEPOINTS(dwpos)); - MapWindowPoints(HWND_DESKTOP, ((LPNMHDR)lParam)->hwndFrom, &ht.pt, 1); - - TreeView_HitTest(((LPNMHDR)lParam)->hwndFrom, &ht); - /*if (TVHT_ONITEM & ht.flags) - CheckChange(hwnd,ht.hItem);*/ - if (TVHT_ONITEMSTATEICON & ht.flags) - CheckChange(hwnd,ht.hItem); - } - - case TVN_KEYDOWN: - if (((LPNMTVKEYDOWN) lParam)->wVKey == VK_SPACE) - CheckChange(hwnd, TreeView_GetSelection(((LPNMHDR)lParam)->hwndFrom)); - break; - - case TVN_SELCHANGED: - { - LPNMTREEVIEW pnmtv = (LPNMTREEVIEW) lParam; - if (pnmtv->itemNew.state & TVIS_SELECTED) - UpdateControls(hwnd); - } - break; - } - break; - } - break; - } - - return FALSE; -} - -void CheckChange(HWND hwnd, HTREEITEM hItem) -{ - HWND hLstView = GetDlgItem(hwnd, IDC_PROTOLIST); - bool isChecked = !TreeView_GetCheckState(hLstView, hItem); - - TreeView_SelectItem(hLstView, hItem); - - int proto = nProtocol; - if (GlobalNudge.useByProtocol) - { - proto = GetSelProto(hwnd, hItem); - ActualNudge = NULL; - for(NudgeElementList *n = NudgeList;n != NULL; n = n->next) - { - if(n->item.iProtoNumber == proto) - ActualNudge = &n->item; - } - } - else - ActualNudge = &DefaultNudge; - - if (ActualNudge)// fix NULL pointer then no nudge support protocols - ActualNudge->enabled = isChecked; - - UpdateControls(hwnd); -} - -void UpdateControls(HWND hwnd) -{ - int proto = nProtocol; - if (GlobalNudge.useByProtocol) - { - proto = GetSelProto(hwnd,NULL); - ActualNudge = NULL; - for(NudgeElementList *n = NudgeList;n != NULL; n = n->next) - { - if(n->item.iProtoNumber == proto) - ActualNudge = &n->item; - } - } - else - ActualNudge = &DefaultNudge; - - SetDlgItemInt(hwnd, IDC_SENDTIME, GlobalNudge.sendTimeSec,FALSE); - SetDlgItemInt(hwnd, IDC_RECVTIME, GlobalNudge.recvTimeSec,FALSE); - SetDlgItemInt(hwnd, IDC_RESENDDELAY, GlobalNudge.resendDelaySec,FALSE); - CheckDlgButton(hwnd, IDC_USEBYPROTOCOL, (WPARAM) GlobalNudge.useByProtocol); - - if (ActualNudge)// fix NULL pointer then no nudge support protocols - { - CheckDlgButton(hwnd, IDC_CHECKPOP, (WPARAM) ActualNudge->showPopup); - CheckDlgButton(hwnd, IDC_CHECKCLIST, (WPARAM) ActualNudge->shakeClist); - CheckDlgButton(hwnd, IDC_CHECKCHAT, (WPARAM) ActualNudge->shakeChat); - CheckDlgButton(hwnd, IDC_CHECKSTATUS, (WPARAM) ActualNudge->showStatus); - CheckDlgButton(hwnd, IDC_AUTORESEND, (WPARAM) ActualNudge->autoResend); - CheckDlgButton(hwnd, IDC_OPENMESSAGE, (WPARAM) ActualNudge->openMessageWindow); - CheckDlgButton(hwnd, IDC_OPENCONTACTLIST, (WPARAM) ActualNudge->openContactList); - CheckDlgButton(hwnd, IDC_IGNORE, (WPARAM) ActualNudge->useIgnoreSettings); - EnableWindow(GetDlgItem(hwnd,IDC_RESENDDELAY),ActualNudge->autoResend); - CheckDlgButton(hwnd,IDC_CHECKST0,ActualNudge->statusFlags & NUDGE_ACC_ST0 ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwnd,IDC_CHECKST1,ActualNudge->statusFlags & NUDGE_ACC_ST1 ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwnd,IDC_CHECKST2,ActualNudge->statusFlags & NUDGE_ACC_ST2 ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwnd,IDC_CHECKST3,ActualNudge->statusFlags & NUDGE_ACC_ST3 ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwnd,IDC_CHECKST4,ActualNudge->statusFlags & NUDGE_ACC_ST4 ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwnd,IDC_CHECKST5,ActualNudge->statusFlags & NUDGE_ACC_ST5 ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwnd,IDC_CHECKST6,ActualNudge->statusFlags & NUDGE_ACC_ST6 ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwnd,IDC_CHECKST7,ActualNudge->statusFlags & NUDGE_ACC_ST7 ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwnd,IDC_CHECKST8,ActualNudge->statusFlags & NUDGE_ACC_ST8 ? BST_CHECKED : BST_UNCHECKED); - CheckDlgButton(hwnd,IDC_CHECKST9,ActualNudge->statusFlags & NUDGE_ACC_ST9 ? BST_CHECKED : BST_UNCHECKED); - SetDlgItemText(hwnd,IDC_SENDTEXT,ActualNudge->senText); - SetDlgItemText(hwnd,IDC_RECVTEXT,ActualNudge->recText); - } - else - { - EnableWindow(GetDlgItem(hwnd,IDC_PROTOLIST),FALSE); - } -} - -int GetSelProto(HWND hwnd, HTREEITEM hItem) -{ - HWND hLstView = GetDlgItem(hwnd, IDC_PROTOLIST); - TVITEM tvi = {0}; - - tvi.mask = TVIF_IMAGE; - tvi.hItem = hItem == NULL ? TreeView_GetSelection(hLstView) : hItem; - - TreeView_GetItem(hLstView, &tvi); - - return tvi.iImage; -} \ No newline at end of file diff --git a/plugins/Nudge/options.h b/plugins/Nudge/options.h deleted file mode 100644 index 68f648a0bb..0000000000 --- a/plugins/Nudge/options.h +++ /dev/null @@ -1,14 +0,0 @@ -extern HINSTANCE hInst; -extern NudgeElementList* NudgeList; -extern int nProtocol; -extern CNudgeElement DefaultNudge; -extern CShake shake; -extern CNudge GlobalNudge; - -static INT_PTR CALLBACK OptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); -static INT_PTR CALLBACK DlgProcNudgeOpt(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam); -static INT_PTR CALLBACK DlgProcShakeOpt(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam); - -void UpdateControls(HWND hwnd); -int GetSelProto(HWND hwnd, HTREEITEM hItem); -void CheckChange(HWND hwnd, HTREEITEM hItem); diff --git a/plugins/Nudge/res/Nudge.ico b/plugins/Nudge/res/Nudge.ico new file mode 100644 index 0000000000..29d9911214 Binary files /dev/null and b/plugins/Nudge/res/Nudge.ico differ diff --git a/plugins/Nudge/res/NudgeIRC.ico b/plugins/Nudge/res/NudgeIRC.ico new file mode 100644 index 0000000000..f950403fa5 Binary files /dev/null and b/plugins/Nudge/res/NudgeIRC.ico differ diff --git a/plugins/Nudge/res/NudgeMSN.ico b/plugins/Nudge/res/NudgeMSN.ico new file mode 100644 index 0000000000..c52057bc9e Binary files /dev/null and b/plugins/Nudge/res/NudgeMSN.ico differ diff --git a/plugins/Nudge/res/NudgeMeta.ico b/plugins/Nudge/res/NudgeMeta.ico new file mode 100644 index 0000000000..fabd329f70 Binary files /dev/null and b/plugins/Nudge/res/NudgeMeta.ico differ diff --git a/plugins/Nudge/res/NudgeTlen.ico b/plugins/Nudge/res/NudgeTlen.ico new file mode 100644 index 0000000000..d4a2c06930 Binary files /dev/null and b/plugins/Nudge/res/NudgeTlen.ico differ diff --git a/plugins/Nudge/res/NudgeYahoo.ico b/plugins/Nudge/res/NudgeYahoo.ico new file mode 100644 index 0000000000..7bed3ca103 Binary files /dev/null and b/plugins/Nudge/res/NudgeYahoo.ico differ diff --git a/plugins/Nudge/res/resource.rc b/plugins/Nudge/res/resource.rc new file mode 100644 index 0000000000..4bdb574ccd --- /dev/null +++ b/plugins/Nudge/res/resource.rc @@ -0,0 +1,285 @@ +// Microsoft Visual C++ generated resource script. +// +#include "..\src\resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include "winres.h" + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// Bulgarian (Bulgaria) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_BGR) +LANGUAGE LANG_BULGARIAN, SUBLANG_DEFAULT +#pragma code_page(1251) + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "..\\src\\resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""winres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + +#endif // Bulgarian (Bulgaria) resources +///////////////////////////////////////////////////////////////////////////// + + +///////////////////////////////////////////////////////////////////////////// +// Neutral resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU) +LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL +#pragma code_page(1252) + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_OPT_NUDGE DIALOGEX 0, 0, 309, 232 +STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD | WS_VISIBLE +EXSTYLE WS_EX_CONTROLPARENT +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + GROUPBOX "Protocol options",IDC_STATIC,4,1,303,225 + CONTROL "",IDC_PROTOLIST,"SysTreeView32",TVS_DISABLEDRAGDROP | TVS_SHOWSELALWAYS | TVS_CHECKBOXES | WS_BORDER | WS_HSCROLL | WS_TABSTOP,12,10,94,84 + CONTROL "Specify options for each protocol",IDC_USEBYPROTOCOL, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,112,10,182,9 + CONTROL "Open contact list",IDC_OPENCONTACTLIST,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,128,20,166,9 + CONTROL "Enable contact list shaking",IDC_CHECKCLIST,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,128,30,166,9 + CONTROL "Open message window",IDC_OPENMESSAGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,128,40,166,9 + CONTROL "Enable message window shaking",IDC_CHECKCHAT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,128,50,166,9 + CONTROL "Show as status change",IDC_CHECKSTATUS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,128,60,166,9 + CONTROL "Auto resend nudge after",IDC_AUTORESEND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,128,70,139,9 + EDITTEXT IDC_RESENDDELAY,276,69,18,11,ES_AUTOHSCROLL | ES_NUMBER + LTEXT "s",IDC_STATIC,298,71,8,8 + CONTROL "Enable popup notification",IDC_CHECKPOP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,128,80,166,9 + CONTROL "Respect ignore settings (status changes)",IDC_IGNORE, + "Button",BS_AUTOCHECKBOX | WS_TABSTOP,128,90,166,10 + LTEXT "Sending text",IDC_STATIC,174,145,120,8 + EDITTEXT IDC_SENDTEXT,174,156,120,12,ES_AUTOHSCROLL + LTEXT "Receiving text",IDC_STATIC,174,172,120,8 + EDITTEXT IDC_RECVTEXT,174,183,120,12,ES_AUTOHSCROLL + GROUPBOX "Privacy",IDC_STATIC,12,97,290,36 + RTEXT "Allow sending* one nudge to the same contact every :",IDC_STATIC,18,106,247,8 + EDITTEXT IDC_SENDTIME,270,104,21,12,ES_AUTOHSCROLL | ES_READONLY | WS_DISABLED + LTEXT "s",IDC_STATIC,293,106,8,8 + RTEXT "Allow receiving one nudge from the same contact every :",IDC_STATIC,18,120,246,8 + EDITTEXT IDC_RECVTIME,270,118,22,12,ES_AUTOHSCROLL + LTEXT "s",IDC_STATIC,293,120,8,8 + CTEXT "* Nudge sending delay is hardcoded and cannot be changed.",IDC_STATIC,18,204,138,17,NOT WS_GROUP + PUSHBUTTON "Preview",IDC_PREVIEW,241,206,53,15 + GROUPBOX "Text",IDC_STATIC,168,136,134,68 + GROUPBOX "Allow nudges when you're:",IDC_STATIC,12,136,149,68 + CONTROL "Offline",IDC_CHECKST0,"Button",BS_AUTOCHECKBOX | BS_NOTIFY | WS_TABSTOP,18,147,58,9 + CONTROL "Online",IDC_CHECKST1,"Button",BS_AUTOCHECKBOX | BS_NOTIFY | WS_TABSTOP,18,157,58,9 + CONTROL "Away",IDC_CHECKST2,"Button",BS_AUTOCHECKBOX | BS_NOTIFY | WS_TABSTOP,18,167,58,9 + CONTROL "NA",IDC_CHECKST3,"Button",BS_AUTOCHECKBOX | BS_NOTIFY | WS_TABSTOP,18,177,58,9 + CONTROL "Occupied",IDC_CHECKST4,"Button",BS_AUTOCHECKBOX | BS_NOTIFY | WS_TABSTOP,18,187,58,9 + CONTROL "DND",IDC_CHECKST5,"Button",BS_AUTOCHECKBOX | BS_NOTIFY | WS_TABSTOP,84,147,72,9 + CONTROL "Free for chat",IDC_CHECKST6,"Button",BS_AUTOCHECKBOX | BS_NOTIFY | WS_TABSTOP,84,157,72,9 + CONTROL "Invisible",IDC_CHECKST7,"Button",BS_AUTOCHECKBOX | BS_NOTIFY | WS_TABSTOP,84,167,72,9 + CONTROL "On the phone",IDC_CHECKST8,"Button",BS_AUTOCHECKBOX | BS_NOTIFY | WS_TABSTOP,84,177,72,9 + CONTROL "Out to lunch",IDC_CHECKST9,"Button",BS_AUTOCHECKBOX | BS_NOTIFY | WS_TABSTOP,84,187,72,9 +END + +IDD_OPT_SHAKE DIALOGEX 0, 0, 309, 184 +STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD | WS_VISIBLE +EXSTYLE WS_EX_CONTROLPARENT +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + GROUPBOX "Shaking Clist Options",IDC_STATIC,7,10,296,77 + RTEXT "Number of moves",IDC_STATIC,13,127,70,9 + CONTROL "Slider1",IDC_SNUMBER_CLIST,"msctls_trackbar32",TBS_AUTOTICKS | TBS_BOTH | WS_TABSTOP,90,25,179,21 + RTEXT "Width of move",IDC_STATIC,13,156,70,9 + CONTROL "",IDC_SSCALE_CLIST,"msctls_trackbar32",TBS_AUTOTICKS | TBS_BOTH | WS_TABSTOP,90,57,179,21 + LTEXT "Static",IDC_LSCALE_CLIST,276,65,21,8 + LTEXT "Static",IDC_LNUMBER_CLIST,276,34,21,8 + GROUPBOX "Shaking Message Window Options",IDC_STATIC,7,101,296,75 + RTEXT "Number of moves",IDC_STATIC,13,31,70,9 + CONTROL "Slider1",IDC_SNUMBER_CHAT,"msctls_trackbar32",TBS_AUTOTICKS | TBS_BOTH | WS_TABSTOP,90,117,179,21 + RTEXT "Width of move",IDC_STATIC,13,65,70,9 + CONTROL "",IDC_SSCALE_CHAT,"msctls_trackbar32",TBS_AUTOTICKS | TBS_BOTH | WS_TABSTOP,90,148,179,21 + LTEXT "Static",IDC_LSCALE_CHAT,276,152,21,8 + LTEXT "Static",IDC_LNUMBER_CHAT,276,121,21,8 +END + +IDD_OPT_TRIGGER DIALOGEX 0, 0, 319, 249 +STYLE DS_SETFONT | DS_FIXEDSYS | DS_CENTER | WS_CHILD +EXSTYLE WS_EX_CONTROLPARENT +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + CONTROL "Shake the contact list",IDC_TRIGGER_SHAKECLIST,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,20,270,10 + CONTROL "Shake the chat window",IDC_TRIGGER_SHAKECHAT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,35,270,10 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO +BEGIN + IDD_OPT_NUDGE, DIALOG + BEGIN + LEFTMARGIN, 4 + VERTGUIDE, 12 + VERTGUIDE, 18 + VERTGUIDE, 76 + VERTGUIDE, 84 + VERTGUIDE, 128 + VERTGUIDE, 156 + VERTGUIDE, 161 + VERTGUIDE, 168 + VERTGUIDE, 174 + VERTGUIDE, 294 + VERTGUIDE, 302 + TOPMARGIN, 1 + BOTTOMMARGIN, 226 + HORZGUIDE, 4 + HORZGUIDE, 10 + HORZGUIDE, 133 + HORZGUIDE, 136 + HORZGUIDE, 204 + HORZGUIDE, 221 + END + + IDD_OPT_SHAKE, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 303 + VERTGUIDE, 13 + VERTGUIDE, 83 + VERTGUIDE, 90 + VERTGUIDE, 269 + VERTGUIDE, 276 + VERTGUIDE, 297 + VERTGUIDE, 303 + TOPMARGIN, 4 + BOTTOMMARGIN, 176 + HORZGUIDE, 5 + HORZGUIDE, 20 + HORZGUIDE, 147 + HORZGUIDE, 156 + END + + IDD_OPT_TRIGGER, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 312 + VERTGUIDE, 13 + VERTGUIDE, 85 + VERTGUIDE, 160 + VERTGUIDE, 307 + TOPMARGIN, 4 + BOTTOMMARGIN, 243 + HORZGUIDE, 5 + HORZGUIDE, 20 + HORZGUIDE, 147 + HORZGUIDE, 157 + HORZGUIDE, 173 + HORZGUIDE, 184 + HORZGUIDE, 207 + HORZGUIDE, 217 + HORZGUIDE, 228 + HORZGUIDE, 239 + HORZGUIDE, 243 + END +END +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION 0,0,2,0 + PRODUCTVERSION 0,0,2,0 + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x2L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "000004b0" + BEGIN + VALUE "Comments", "Plugin that render nudge events from different protocols" + VALUE "CompanyName", "Miranda community" + VALUE "FileDescription", "Nudge plugin for Miranda-IM" + VALUE "FileVersion", "0, 0, 2, 0" + VALUE "InternalName", "Nudge" + VALUE "LegalCopyright", "Copyright © 2006-2011" + VALUE "OriginalFilename", "nudge.dll" + VALUE "ProductName", "nudge" + VALUE "ProductVersion", "0, 0, 2, 0" + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x0, 1200 + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_NUDGE ICON "Nudge.ico" +IDI_NUGDE_YAHOO ICON "NudgeYahoo.ico" +IDI_NUDGE_IRC ICON "NudgeIRC.ico" +IDI_NUDGE_MSN ICON "NudgeMSN.ico" +IDI_NUDGE_TLEN ICON "NudgeTlen.ico" +IDI_NUDGE_META ICON "NudgeMeta.ico" +#endif // Neutral resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/plugins/Nudge/resource.h b/plugins/Nudge/resource.h deleted file mode 100644 index 60a56388e2..0000000000 --- a/plugins/Nudge/resource.h +++ /dev/null @@ -1,89 +0,0 @@ -//{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by resource.rc -// -#define IDD_DIALOG1 101 -#define IDI_NUDGE 102 -#define IDI_NUGDE_YAHOO 107 -#define IDI_NUDGE_IRC 109 -#define IDI_NUDGE_MSN 110 -#define IDI_NUDGE_TLEN 111 -#define IDI_NUDGE_META 113 -#define IDD_SHAKEOPT 126 -#define IDD_OPT_NUDGE 126 -#define IDD_OPT_SHAKE 128 -#define IDD_OPT_TRIGGER 129 -#define IDC_BUTTON1 1000 -#define IDC_PREVIEW 1000 -#define IDC_EDIT1 1001 -#define IDC_SENDTEXT 1001 -#define IDC_BUTTON2 1002 -#define IDC_SENDTEXT2 1002 -#define IDC_RECVTEXT 1002 -#define IDC_BUTTON3 1003 -#define IDC_BUTTON4 1004 -#define IDC_BUTTON5 1005 -#define IDC_BUTTON6 1006 -#define IDC_BUTTON7 1007 -#define IDC_USEWINCOLORS 1007 -#define IDC_LABEL_FN 1008 -#define IDC_LABEL_IMAGESIZE 1009 -#define IDC_SLIDER_CLIST 1009 -#define IDC_SNUMBER_CLIST 1009 -#define IDC_SLIDER_CHAT 1010 -#define IDC_SNUMBER_CHAT 1010 -#define IDC_LABEL_ERRSTATE 1011 -#define IDC_SSCALE_CLIST 1011 -#define IDC_LABEL_TOTALBLOCKS 1012 -#define IDC_LNUMBER_CLIST 1012 -#define IDC_LABEL_WRITTENBLOCKS 1013 -#define IDC_LABEL_RESULT 1013 -#define IDC_LNUMBER_CHAT 1013 -#define IDC_LSCALE_CLIST 1014 -#define IDC_SSCALE_CHAT 1015 -#define IDC_LSCALE_CHAT 1016 -#define IDC_CHECKCLIST 1018 -#define IDC_CHECKST0 1019 -#define IDC_CHECKST1 1020 -#define IDC_CHECKST2 1021 -#define IDC_CHECKST3 1022 -#define IDC_CHECKST4 1023 -#define IDC_CHECKST5 1024 -#define IDC_CHECKST6 1025 -#define IDC_CHECKST7 1026 -#define IDC_POPUPTEXTCOLOR 1027 -#define IDC_CHECKST8 1028 -#define IDC_CHECKST9 1029 -#define IDC_BGCOLOUR 1030 -#define IDC_PROTOLIST 1031 -#define IDC_TEXTCOLOUR 1032 -#define IDC_USEBYPROTOCOL 1033 -#define IDC_CHECKCHAT2 1034 -#define IDC_CHECKCHAT 1034 -#define IDC_CHECKCOL 1035 -#define IDC_CHECKEVENT 1035 -#define IDC_POPUPBACKCOLOR 1036 -#define IDC_CHECKPOP 1037 -#define IDC_POPUPTIME 1038 -#define IDC_SENDTIME 1039 -#define IDC_RECVTIME 1040 -#define IDC_TRIGGER_SHAKECLIST 1040 -#define IDC_CHECKEVENT2 1041 -#define IDC_CHECKSTATUS 1041 -#define IDC_TRIGGER_SHAKECHAT 1041 -#define IDC_AUTORESEND 1042 -#define IDC_RESENDDELAY 1043 -#define IDC_OPENMESSAGE 1044 -#define IDC_OPENCONTACTLIST 1046 -#define IDC_IGNORE 1047 - -// Next default values for new objects -// -#ifdef APSTUDIO_INVOKED -#ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 114 -#define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1048 -#define _APS_NEXT_SYMED_VALUE 101 -#endif -#endif diff --git a/plugins/Nudge/resource.rc b/plugins/Nudge/resource.rc deleted file mode 100644 index 4188b695b4..0000000000 --- a/plugins/Nudge/resource.rc +++ /dev/null @@ -1,285 +0,0 @@ -// Microsoft Visual C++ generated resource script. -// -#include "resource.h" - -#define APSTUDIO_READONLY_SYMBOLS -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 2 resource. -// -#include "winres.h" - -///////////////////////////////////////////////////////////////////////////// -#undef APSTUDIO_READONLY_SYMBOLS - -///////////////////////////////////////////////////////////////////////////// -// Bulgarian (Bulgaria) resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_BGR) -LANGUAGE LANG_BULGARIAN, SUBLANG_DEFAULT -#pragma code_page(1251) - -#ifdef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// TEXTINCLUDE -// - -1 TEXTINCLUDE -BEGIN - "resource.h\0" -END - -2 TEXTINCLUDE -BEGIN - "#include ""winres.h""\r\n" - "\0" -END - -3 TEXTINCLUDE -BEGIN - "\r\n" - "\0" -END - -#endif // APSTUDIO_INVOKED - -#endif // Bulgarian (Bulgaria) resources -///////////////////////////////////////////////////////////////////////////// - - -///////////////////////////////////////////////////////////////////////////// -// Neutral resources - -#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_NEU) -LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL -#pragma code_page(1252) - -///////////////////////////////////////////////////////////////////////////// -// -// Dialog -// - -IDD_OPT_NUDGE DIALOGEX 0, 0, 309, 232 -STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD | WS_VISIBLE -EXSTYLE WS_EX_CONTROLPARENT -FONT 8, "MS Shell Dlg", 0, 0, 0x1 -BEGIN - GROUPBOX "Protocol options",IDC_STATIC,4,1,303,225 - CONTROL "",IDC_PROTOLIST,"SysTreeView32",TVS_DISABLEDRAGDROP | TVS_SHOWSELALWAYS | TVS_CHECKBOXES | WS_BORDER | WS_HSCROLL | WS_TABSTOP,12,10,94,84 - CONTROL "Specify options for each protocol",IDC_USEBYPROTOCOL, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,112,10,182,9 - CONTROL "Open contact list",IDC_OPENCONTACTLIST,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,128,20,166,9 - CONTROL "Enable contact list shaking",IDC_CHECKCLIST,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,128,30,166,9 - CONTROL "Open message window",IDC_OPENMESSAGE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,128,40,166,9 - CONTROL "Enable message window shaking",IDC_CHECKCHAT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,128,50,166,9 - CONTROL "Show as status change",IDC_CHECKSTATUS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,128,60,166,9 - CONTROL "Auto resend nudge after",IDC_AUTORESEND,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,128,70,139,9 - EDITTEXT IDC_RESENDDELAY,276,69,18,11,ES_AUTOHSCROLL | ES_NUMBER - LTEXT "s",IDC_STATIC,298,71,8,8 - CONTROL "Enable popup notification",IDC_CHECKPOP,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,128,80,166,9 - CONTROL "Respect ignore settings (status changes)",IDC_IGNORE, - "Button",BS_AUTOCHECKBOX | WS_TABSTOP,128,90,166,10 - LTEXT "Sending text",IDC_STATIC,174,145,120,8 - EDITTEXT IDC_SENDTEXT,174,156,120,12,ES_AUTOHSCROLL - LTEXT "Receiving text",IDC_STATIC,174,172,120,8 - EDITTEXT IDC_RECVTEXT,174,183,120,12,ES_AUTOHSCROLL - GROUPBOX "Privacy",IDC_STATIC,12,97,290,36 - RTEXT "Allow sending* one nudge to the same contact every :",IDC_STATIC,18,106,247,8 - EDITTEXT IDC_SENDTIME,270,104,21,12,ES_AUTOHSCROLL | ES_READONLY | WS_DISABLED - LTEXT "s",IDC_STATIC,293,106,8,8 - RTEXT "Allow receiving one nudge from the same contact every :",IDC_STATIC,18,120,246,8 - EDITTEXT IDC_RECVTIME,270,118,22,12,ES_AUTOHSCROLL - LTEXT "s",IDC_STATIC,293,120,8,8 - CTEXT "* Nudge sending delay is hardcoded and cannot be changed.",IDC_STATIC,18,204,138,17,NOT WS_GROUP - PUSHBUTTON "Preview",IDC_PREVIEW,241,206,53,15 - GROUPBOX "Text",IDC_STATIC,168,136,134,68 - GROUPBOX "Allow nudges when you're:",IDC_STATIC,12,136,149,68 - CONTROL "Offline",IDC_CHECKST0,"Button",BS_AUTOCHECKBOX | BS_NOTIFY | WS_TABSTOP,18,147,58,9 - CONTROL "Online",IDC_CHECKST1,"Button",BS_AUTOCHECKBOX | BS_NOTIFY | WS_TABSTOP,18,157,58,9 - CONTROL "Away",IDC_CHECKST2,"Button",BS_AUTOCHECKBOX | BS_NOTIFY | WS_TABSTOP,18,167,58,9 - CONTROL "NA",IDC_CHECKST3,"Button",BS_AUTOCHECKBOX | BS_NOTIFY | WS_TABSTOP,18,177,58,9 - CONTROL "Occupied",IDC_CHECKST4,"Button",BS_AUTOCHECKBOX | BS_NOTIFY | WS_TABSTOP,18,187,58,9 - CONTROL "DND",IDC_CHECKST5,"Button",BS_AUTOCHECKBOX | BS_NOTIFY | WS_TABSTOP,84,147,72,9 - CONTROL "Free for chat",IDC_CHECKST6,"Button",BS_AUTOCHECKBOX | BS_NOTIFY | WS_TABSTOP,84,157,72,9 - CONTROL "Invisible",IDC_CHECKST7,"Button",BS_AUTOCHECKBOX | BS_NOTIFY | WS_TABSTOP,84,167,72,9 - CONTROL "On the phone",IDC_CHECKST8,"Button",BS_AUTOCHECKBOX | BS_NOTIFY | WS_TABSTOP,84,177,72,9 - CONTROL "Out to lunch",IDC_CHECKST9,"Button",BS_AUTOCHECKBOX | BS_NOTIFY | WS_TABSTOP,84,187,72,9 -END - -IDD_OPT_SHAKE DIALOGEX 0, 0, 309, 184 -STYLE DS_SETFONT | DS_FIXEDSYS | DS_CONTROL | WS_CHILD | WS_VISIBLE -EXSTYLE WS_EX_CONTROLPARENT -FONT 8, "MS Shell Dlg", 0, 0, 0x1 -BEGIN - GROUPBOX "Shaking Clist Options",IDC_STATIC,7,10,296,77 - RTEXT "Number of moves",IDC_STATIC,13,127,70,9 - CONTROL "Slider1",IDC_SNUMBER_CLIST,"msctls_trackbar32",TBS_AUTOTICKS | TBS_BOTH | WS_TABSTOP,90,25,179,21 - RTEXT "Width of move",IDC_STATIC,13,156,70,9 - CONTROL "",IDC_SSCALE_CLIST,"msctls_trackbar32",TBS_AUTOTICKS | TBS_BOTH | WS_TABSTOP,90,57,179,21 - LTEXT "Static",IDC_LSCALE_CLIST,276,65,21,8 - LTEXT "Static",IDC_LNUMBER_CLIST,276,34,21,8 - GROUPBOX "Shaking Message Window Options",IDC_STATIC,7,101,296,75 - RTEXT "Number of moves",IDC_STATIC,13,31,70,9 - CONTROL "Slider1",IDC_SNUMBER_CHAT,"msctls_trackbar32",TBS_AUTOTICKS | TBS_BOTH | WS_TABSTOP,90,117,179,21 - RTEXT "Width of move",IDC_STATIC,13,65,70,9 - CONTROL "",IDC_SSCALE_CHAT,"msctls_trackbar32",TBS_AUTOTICKS | TBS_BOTH | WS_TABSTOP,90,148,179,21 - LTEXT "Static",IDC_LSCALE_CHAT,276,152,21,8 - LTEXT "Static",IDC_LNUMBER_CHAT,276,121,21,8 -END - -IDD_OPT_TRIGGER DIALOGEX 0, 0, 319, 249 -STYLE DS_SETFONT | DS_FIXEDSYS | DS_CENTER | WS_CHILD -EXSTYLE WS_EX_CONTROLPARENT -FONT 8, "MS Shell Dlg", 0, 0, 0x1 -BEGIN - CONTROL "Shake the contact list",IDC_TRIGGER_SHAKECLIST,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,20,270,10 - CONTROL "Shake the chat window",IDC_TRIGGER_SHAKECHAT,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,13,35,270,10 -END - - -///////////////////////////////////////////////////////////////////////////// -// -// DESIGNINFO -// - -#ifdef APSTUDIO_INVOKED -GUIDELINES DESIGNINFO -BEGIN - IDD_OPT_NUDGE, DIALOG - BEGIN - LEFTMARGIN, 4 - VERTGUIDE, 12 - VERTGUIDE, 18 - VERTGUIDE, 76 - VERTGUIDE, 84 - VERTGUIDE, 128 - VERTGUIDE, 156 - VERTGUIDE, 161 - VERTGUIDE, 168 - VERTGUIDE, 174 - VERTGUIDE, 294 - VERTGUIDE, 302 - TOPMARGIN, 1 - BOTTOMMARGIN, 226 - HORZGUIDE, 4 - HORZGUIDE, 10 - HORZGUIDE, 133 - HORZGUIDE, 136 - HORZGUIDE, 204 - HORZGUIDE, 221 - END - - IDD_OPT_SHAKE, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 303 - VERTGUIDE, 13 - VERTGUIDE, 83 - VERTGUIDE, 90 - VERTGUIDE, 269 - VERTGUIDE, 276 - VERTGUIDE, 297 - VERTGUIDE, 303 - TOPMARGIN, 4 - BOTTOMMARGIN, 176 - HORZGUIDE, 5 - HORZGUIDE, 20 - HORZGUIDE, 147 - HORZGUIDE, 156 - END - - IDD_OPT_TRIGGER, DIALOG - BEGIN - LEFTMARGIN, 7 - RIGHTMARGIN, 312 - VERTGUIDE, 13 - VERTGUIDE, 85 - VERTGUIDE, 160 - VERTGUIDE, 307 - TOPMARGIN, 4 - BOTTOMMARGIN, 243 - HORZGUIDE, 5 - HORZGUIDE, 20 - HORZGUIDE, 147 - HORZGUIDE, 157 - HORZGUIDE, 173 - HORZGUIDE, 184 - HORZGUIDE, 207 - HORZGUIDE, 217 - HORZGUIDE, 228 - HORZGUIDE, 239 - HORZGUIDE, 243 - END -END -#endif // APSTUDIO_INVOKED - - -///////////////////////////////////////////////////////////////////////////// -// -// Version -// - -VS_VERSION_INFO VERSIONINFO - FILEVERSION 0,0,2,0 - PRODUCTVERSION 0,0,2,0 - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS 0x1L -#else - FILEFLAGS 0x0L -#endif - FILEOS 0x40004L - FILETYPE 0x2L - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "000004b0" - BEGIN - VALUE "Comments", "Plugin that render nudge events from different protocols" - VALUE "CompanyName", "Miranda community" - VALUE "FileDescription", "Nudge plugin for Miranda-IM" - VALUE "FileVersion", "0, 0, 2, 0" - VALUE "InternalName", "Nudge" - VALUE "LegalCopyright", "Copyright © 2006-2011" - VALUE "OriginalFilename", "nudge.dll" - VALUE "ProductName", "nudge" - VALUE "ProductVersion", "0, 0, 2, 0" - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x0, 1200 - END -END - - -///////////////////////////////////////////////////////////////////////////// -// -// Icon -// - -// Icon with lowest ID value placed first to ensure application icon -// remains consistent on all systems. -IDI_NUDGE ICON "resources\\Nudge.ico" -IDI_NUGDE_YAHOO ICON "resources\\NudgeYahoo.ico" -IDI_NUDGE_IRC ICON "resources\\NudgeIRC.ico" -IDI_NUDGE_MSN ICON "resources\\NudgeMSN.ico" -IDI_NUDGE_TLEN ICON "resources\\NudgeTlen.ico" -IDI_NUDGE_META ICON "resources\\NudgeMeta.ico" -#endif // Neutral resources -///////////////////////////////////////////////////////////////////////////// - - - -#ifndef APSTUDIO_INVOKED -///////////////////////////////////////////////////////////////////////////// -// -// Generated from the TEXTINCLUDE 3 resource. -// - - -///////////////////////////////////////////////////////////////////////////// -#endif // not APSTUDIO_INVOKED - diff --git a/plugins/Nudge/resources/Nudge.ico b/plugins/Nudge/resources/Nudge.ico deleted file mode 100644 index 29d9911214..0000000000 Binary files a/plugins/Nudge/resources/Nudge.ico and /dev/null differ diff --git a/plugins/Nudge/resources/NudgeIRC.ico b/plugins/Nudge/resources/NudgeIRC.ico deleted file mode 100644 index f950403fa5..0000000000 Binary files a/plugins/Nudge/resources/NudgeIRC.ico and /dev/null differ diff --git a/plugins/Nudge/resources/NudgeMSN.ico b/plugins/Nudge/resources/NudgeMSN.ico deleted file mode 100644 index c52057bc9e..0000000000 Binary files a/plugins/Nudge/resources/NudgeMSN.ico and /dev/null differ diff --git a/plugins/Nudge/resources/NudgeMeta.ico b/plugins/Nudge/resources/NudgeMeta.ico deleted file mode 100644 index fabd329f70..0000000000 Binary files a/plugins/Nudge/resources/NudgeMeta.ico and /dev/null differ diff --git a/plugins/Nudge/resources/NudgeTlen.ico b/plugins/Nudge/resources/NudgeTlen.ico deleted file mode 100644 index d4a2c06930..0000000000 Binary files a/plugins/Nudge/resources/NudgeTlen.ico and /dev/null differ diff --git a/plugins/Nudge/resources/NudgeYahoo.ico b/plugins/Nudge/resources/NudgeYahoo.ico deleted file mode 100644 index 7bed3ca103..0000000000 Binary files a/plugins/Nudge/resources/NudgeYahoo.ico and /dev/null differ diff --git a/plugins/Nudge/resources/nudge msn.ico b/plugins/Nudge/resources/nudge msn.ico deleted file mode 100644 index 77ad817b45..0000000000 Binary files a/plugins/Nudge/resources/nudge msn.ico and /dev/null differ diff --git a/plugins/Nudge/shake.cpp b/plugins/Nudge/shake.cpp deleted file mode 100644 index f396c4f535..0000000000 --- a/plugins/Nudge/shake.cpp +++ /dev/null @@ -1,189 +0,0 @@ -#include "headers.h" -#include "shake.h" - -extern CShake shake; - -void CShake::Load(void) -{ - - Shaking = false; - ShakingChat = false; - nScaleClist = DBGetContactSettingDword(NULL, "Nudge", "ScaleClist", 5); - nScaleChat = DBGetContactSettingDword(NULL, "Nudge", "ScaleChat", 2); - nMoveClist = DBGetContactSettingDword(NULL, "Nudge", "MoveClist", 15); - nMoveChat = DBGetContactSettingDword(NULL, "Nudge", "MoveChat", 15); -} -void CShake::Save(void) -{ - DBWriteContactSettingDword(NULL, "Nudge", "ScaleClist", this->nScaleClist); - DBWriteContactSettingDword(NULL, "Nudge", "ScaleChat", this->nScaleChat); - DBWriteContactSettingDword(NULL, "Nudge", "MoveClist", this->nMoveClist); - DBWriteContactSettingDword(NULL, "Nudge", "MoveChat", this->nMoveChat); -} - -DWORD WINAPI ShakeChatWindow(LPVOID Param) -{ - HWND hWnd = (HWND) Param; - shake.ShakeChat(hWnd); - return 1; -} - -DWORD WINAPI ShakeClistWindow(LPVOID Param) -{ - HWND hWnd = (HWND) Param; - shake.ShakeClist(hWnd); - return 0; -} - -INT_PTR ShakeClist( WPARAM wParam, LPARAM lParam ) -{ - DWORD tid; - HWND hWnd = (HWND) CallService( MS_CLUI_GETHWND, 0, 0 ); - - CreateThread(NULL,0,ShakeClistWindow,(LPVOID) hWnd,0,&tid); - return 0; -} - -INT_PTR ShakeChat( WPARAM wParam, LPARAM lParam ) -{ - if (((HANDLE) wParam) == NULL) return -1; - - DWORD tid; - //char srmmName[100]; - MessageWindowData mwd; - MessageWindowInputData mwid; - - mwd.cbSize = sizeof(MessageWindowData); - mwd.hContact = Nudge_GethContact((HANDLE) wParam); - mwd.uFlags = MSG_WINDOW_UFLAG_MSG_BOTH; - - mwid.cbSize = sizeof(MessageWindowInputData); - mwid.hContact = mwd.hContact; - mwid.uFlags = MSG_WINDOW_UFLAG_MSG_BOTH; - - - CallService( MS_MSG_GETWINDOWDATA, (WPARAM)&mwid, (LPARAM)&mwd ); - //CallService(MS_MSG_GETWINDOWCLASS,(WPARAM)srmmName,(LPARAM)100 ); - - HWND parent; - HWND hWnd = mwd.hwndWindow; - while((parent = GetParent(hWnd)) != 0) hWnd = parent; // ensure we have the top level window (need parent window for scriver & tabsrmm) - - CreateThread(NULL,0,ShakeChatWindow,(LPVOID) hWnd,0,&tid); - return 0; -} - -/* - -int TriggerShakeClist( WPARAM wParam, LPARAM lParam ) -{ - DWORD tid; - HWND hWnd; - int flags; - flags = (int)wParam; - - if (!flags&ACT_PERFORM) - return 0; - - hWnd = (HWND) CallService( MS_CLUI_GETHWND, 0, 0 ); - - CreateThread(NULL,0,ShakeClistWindow,(LPVOID) hWnd,0,&tid); - return 0; -} - -int TriggerShakeChat( WPARAM wParam, LPARAM lParam ) -{ - DWORD tid; - HWND hWnd; - char srmmName[100]; - MessageWindowData mwd; - MessageWindowInputData mwid; - int flags; - flags = (int)wParam; - - if (!flags&ACT_PERFORM) - return 0; - - SPECIFICACTIONINFO *sai; - HANDLE hContact; - - - sai = (SPECIFICACTIONINFO *) lParam; - - if ( (sai->td != NULL) && (sai->td->dFlags&DF_CONTACT)) - hContact = sai->td->hContact; - else - return 0; - - mwd.cbSize = sizeof(MessageWindowData); - mwd.hContact = Nudge_GethContact((HANDLE) hContact); - mwd.uFlags = MSG_WINDOW_UFLAG_MSG_BOTH; - - mwid.cbSize = sizeof(MessageWindowInputData); - mwid.hContact = Nudge_GethContact((HANDLE) hContact); - mwid.uFlags = MSG_WINDOW_UFLAG_MSG_BOTH; - - CallService( MS_MSG_GETWINDOWDATA, (WPARAM)&mwid, (LPARAM)&mwd ); - CallService(MS_MSG_GETWINDOWCLASS,(WPARAM)srmmName,(LPARAM)100 ); - - if ( !strnicmp( srmmName,"tabSRMM ", 7 )) - hWnd = GetParent(GetParent(mwd.hwndWindow)); - - if ( !strnicmp( srmmName,"SRMM ", 4)) - hWnd = mwd.hwndWindow; - - if ( !strnicmp( srmmName,"Scriver ", 7 )) - hWnd = GetParent(mwd.hwndWindow); - - CreateThread(NULL,0,ShakeChatWindow,(LPVOID) hWnd,0,&tid); - return 0; -} -*/ - -int CShake::ShakeChat(HWND hWnd) -{ - if (!ShakingChat) - { - ShakingChat = true; - RECT rect; - GetWindowRect(hWnd, &rect); - for(int i = 0; i < nMoveChat; i++) - { - SetWindowPos(hWnd, 0, rect.left - nScaleChat, rect.top, 0, 0, SWP_NOSIZE); - Sleep(10); - SetWindowPos(hWnd, 0, rect.left, rect.top - nScaleChat, 0, 0, SWP_NOSIZE); - Sleep(10); - SetWindowPos(hWnd, 0, rect.left + nScaleChat, rect.top, 0, 0, SWP_NOSIZE); - Sleep(10); - SetWindowPos(hWnd, 0, rect.left, rect.top + nScaleChat, 0, 0, SWP_NOSIZE); - Sleep(10); - } - SetWindowPos(hWnd, 0, rect.left, rect.top, 0, 0, SWP_NOSIZE); //SWP_DRAWFRAME - ShakingChat = false; - } - return 0; -} - -int CShake::ShakeClist(HWND hWnd) -{ - if (!Shaking) - { - Shaking = true; - RECT rect; - GetWindowRect(hWnd, &rect); - for(int i = 0; i < nMoveClist; i++) - { - SetWindowPos(hWnd, 0, rect.left - nScaleClist, rect.top, 0, 0, SWP_NOSIZE); - Sleep(10); - SetWindowPos(hWnd, 0, rect.left, rect.top - nScaleClist, 0, 0, SWP_NOSIZE); - Sleep(10); - SetWindowPos(hWnd, 0, rect.left + nScaleClist, rect.top, 0, 0, SWP_NOSIZE); - Sleep(10); - SetWindowPos(hWnd, 0, rect.left, rect.top + nScaleClist, 0, 0, SWP_NOSIZE); - Sleep(10); - } - SetWindowPos(hWnd, 0, rect.left, rect.top, 0, 0, SWP_NOSIZE); - Shaking = false; - } - return 0; -} \ No newline at end of file diff --git a/plugins/Nudge/shake.h b/plugins/Nudge/shake.h deleted file mode 100644 index 73e460cb41..0000000000 --- a/plugins/Nudge/shake.h +++ /dev/null @@ -1,27 +0,0 @@ -#ifndef SHAKE_H -#define SHAKE_H - -class CShake -{ -public: - bool Shaking; - bool ShakingChat; - int nScaleClist; - int nScaleChat; - int nMoveClist; - int nMoveChat; - - void Load(void); - void Save(void); - int ShakeClist(HWND hWnd); - int ShakeChat(HWND hWnd); -}; - -INT_PTR ShakeClist(WPARAM,LPARAM); -INT_PTR ShakeChat(WPARAM,LPARAM); -/* -int TriggerShakeChat(WPARAM,LPARAM); -int TriggerShakeClist(WPARAM,LPARAM); -int TriggerAction(WPARAM,LPARAM);*/ - -#endif \ No newline at end of file diff --git a/plugins/Nudge/src/headers.h b/plugins/Nudge/src/headers.h new file mode 100644 index 0000000000..eb931c6da8 --- /dev/null +++ b/plugins/Nudge/src/headers.h @@ -0,0 +1,70 @@ +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#define _CRT_SECURE_NO_WARNINGS + +#pragma once + +// Modify the following defines if you have to target a platform prior to the ones specified below. +// Refer to MSDN for the latest info on corresponding values for different platforms. +#ifndef WINVER // Allow use of features specific to Windows XP or later. +#define WINVER 0x0501 // Change this to the appropriate value to target other versions of Windows. +#endif + +#ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later. +#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows. +#endif + +#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later. +#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later. +#endif + +#ifndef _WIN32_IE // Allow use of features specific to IE 6.0 or later. +#define _WIN32_IE 0x0600 // Change this to the appropriate value to target other versions of IE. +#endif + +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +// Windows Header Files: + +#include +#include +#include + +#define MIRANDA_VER 0x0A00 +#include //CallService,UnHookEvent +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "resource.h" +#include "m_nudge.h" + + +/* +* +****************************/ +int NudgeOptInit(WPARAM wParam,LPARAM lParam); + +/* +* +****************************/ +int Preview(); + +/* +* +****************************/ +HANDLE Nudge_GethContact(HANDLE); \ No newline at end of file diff --git a/plugins/Nudge/src/main.cpp b/plugins/Nudge/src/main.cpp new file mode 100644 index 0000000000..c673ebe0c5 --- /dev/null +++ b/plugins/Nudge/src/main.cpp @@ -0,0 +1,789 @@ +#include "headers.h" +#include "main.h" +#include "shake.h" +#include "m_msg_buttonsbar.h" + + +int nProtocol = 0; +static HANDLE g_hEventModulesLoaded = NULL, hEventOptionsInitialize = NULL, g_hIcon = NULL, g_hEventDbWindowEvent = NULL, g_hEventToolbarLoaded = NULL, g_hEventButtonPressed = NULL, g_hEventAccountsChanged = NULL; +HINSTANCE hInst; + +NudgeElementList *NudgeList = NULL; +CNudgeElement DefaultNudge; +CShake shake; +CNudge GlobalNudge; + + + +int hLangpack = 0; + + +//======================== +// MirandaPluginInfo +//======================== +PLUGININFOEX pluginInfo={ + sizeof(PLUGININFOEX), + "Nudge", + PLUGIN_MAKE_VERSION(0,0,2,0), + "Plugin to shake the clist and chat window", + "Tweety/GouZ, FREAK_THEMIGHTY", + "francois.mean@skynet.be, Sylvain.gougouzian@gmail.com, wishmaster51@googlemail.com", + "copyright to the miranda community", + "http://nightly.miranda.im/", // www + UNICODE_AWARE, //doesn't replace anything built-in + { 0xe47cc215, 0xd28, 0x462d, { 0xa0, 0xf6, 0x3a, 0xe4, 0x44, 0x3d, 0x29, 0x26 } } // {E47CC215-0D28-462D-A0F6-3AE4443D2926} +}; + +INT_PTR NudgeShowMenu(WPARAM wParam,LPARAM lParam) +{ + + for(NudgeElementList *n = NudgeList;n != NULL; n = n->next) + { + if (!strcmp((char *) wParam,n->item.ProtocolName)) + { + return n->item.ShowContactMenu(lParam != 0); + } + } + return 0; +} + +INT_PTR NudgeSend(WPARAM wParam,LPARAM lParam) +{ + + char *protoName = (char*) CallService(MS_PROTO_GETCONTACTBASEPROTO,wParam,0); + int diff = time(NULL) - DBGetContactSettingDword((HANDLE) wParam, "Nudge", "LastSent", time(NULL)-30); + + if(diff < GlobalNudge.sendTimeSec) + { + TCHAR msg[500]; + mir_sntprintf(msg,500, TranslateT("You are not allowed to send too much nudge (only 1 each %d sec, %d sec left)"),GlobalNudge.sendTimeSec, 30 - diff); + //MessageBox(NULL,msg,NULL,0); + if(GlobalNudge.useByProtocol) + { + for(NudgeElementList *n = NudgeList;n != NULL; n = n->next) + { + if (!strcmp(protoName,n->item.ProtocolName)) + { + Nudge_ShowPopup(n->item, (HANDLE) wParam, msg); + } + } + } + else + { + Nudge_ShowPopup(DefaultNudge, (HANDLE) wParam, msg); + } + return 0; + } + + DBWriteContactSettingDword((HANDLE) wParam, "Nudge", "LastSent", time(NULL)); + + if(GlobalNudge.useByProtocol) + { + NudgeElementList *n; + for(n = NudgeList;n != NULL; n = n->next) + { + if (!strcmp(protoName,n->item.ProtocolName)) + { + //if(n->item.showPopup) + // Nudge_ShowPopup(n->item, (HANDLE) wParam, n->item.senText); + if(n->item.showStatus) + Nudge_SentStatus(n->item, (HANDLE) wParam); + } + } + } + else + { + //if(DefaultNudge.showPopup) + // Nudge_ShowPopup(DefaultNudge, (HANDLE) wParam, DefaultNudge.senText); + if(DefaultNudge.showStatus) + Nudge_SentStatus(DefaultNudge, (HANDLE) wParam); + } + + CallProtoService(protoName,"/SendNudge",wParam,lParam); + return 0; +} + +void OpenContactList() +{ + HWND hWnd = (HWND) CallService(MS_CLUI_GETHWND,0,0); + ShowWindow(hWnd, SW_RESTORE); + ShowWindow(hWnd, SW_SHOW); +} + +int NudgeRecieved(WPARAM wParam,LPARAM lParam) +{ + + char *protoName = (char*) CallService(MS_PROTO_GETCONTACTBASEPROTO,wParam,0); + + DWORD currentTimestamp = time(NULL); + DWORD nudgeSentTimestamp = lParam ? (DWORD)lParam : currentTimestamp; + + int diff = currentTimestamp - DBGetContactSettingDword((HANDLE) wParam, "Nudge", "LastReceived", currentTimestamp-30); + int diff2 = nudgeSentTimestamp - DBGetContactSettingDword((HANDLE) wParam, "Nudge", "LastReceived2", nudgeSentTimestamp-30); + + if(diff >= GlobalNudge.recvTimeSec) + DBWriteContactSettingDword((HANDLE) wParam, "Nudge", "LastReceived", currentTimestamp); + if(diff2 >= GlobalNudge.recvTimeSec) + DBWriteContactSettingDword((HANDLE) wParam, "Nudge", "LastReceived2", nudgeSentTimestamp); + + if(GlobalNudge.useByProtocol) + { + for(NudgeElementList *n = NudgeList;n != NULL; n = n->next) + { + if (!strcmp(protoName,n->item.ProtocolName)) + { + + if(n->item.enabled) + { + if(n->item.useIgnoreSettings && CallService(MS_IGNORE_ISIGNORED,wParam,IGNOREEVENT_USERONLINE)) + return 0; + + DWORD Status = CallProtoService(protoName,PS_GETSTATUS,0,0); + + if ( ((n->item.statusFlags & NUDGE_ACC_ST0) && (Status<=ID_STATUS_OFFLINE)) || + ((n->item.statusFlags & NUDGE_ACC_ST1) && (Status==ID_STATUS_ONLINE)) || + ((n->item.statusFlags & NUDGE_ACC_ST2) && (Status==ID_STATUS_AWAY)) || + ((n->item.statusFlags & NUDGE_ACC_ST3) && (Status==ID_STATUS_DND)) || + ((n->item.statusFlags & NUDGE_ACC_ST4) && (Status==ID_STATUS_NA)) || + ((n->item.statusFlags & NUDGE_ACC_ST5) && (Status==ID_STATUS_OCCUPIED)) || + ((n->item.statusFlags & NUDGE_ACC_ST6) && (Status==ID_STATUS_FREECHAT)) || + ((n->item.statusFlags & NUDGE_ACC_ST7) && (Status==ID_STATUS_INVISIBLE)) || + ((n->item.statusFlags & NUDGE_ACC_ST8) && (Status==ID_STATUS_ONTHEPHONE)) || + ((n->item.statusFlags & NUDGE_ACC_ST9) && (Status==ID_STATUS_OUTTOLUNCH))) + { + if(diff >= GlobalNudge.recvTimeSec) + { + if(n->item.showPopup) + Nudge_ShowPopup(n->item, (HANDLE) wParam, n->item.recText); + if(n->item.openContactList) + OpenContactList(); + if(n->item.shakeClist) + ShakeClist(wParam,lParam); + if(n->item.openMessageWindow) + CallService(MS_MSG_SENDMESSAGET,wParam,0); + if(n->item.shakeChat) + ShakeChat(wParam,lParam); + if(n->item.autoResend) + mir_forkthread(AutoResendNudge,(void *)wParam); + + SkinPlaySound( n->item.NudgeSoundname ); + } + } + if(diff2 >= GlobalNudge.recvTimeSec) + { + if(n->item.showStatus) + Nudge_ShowStatus(n->item, (HANDLE) wParam, nudgeSentTimestamp); + } + + } + break; + } + } + } + else + { + if(DefaultNudge.enabled) + { + if(DefaultNudge.useIgnoreSettings && CallService(MS_IGNORE_ISIGNORED,wParam,IGNOREEVENT_USERONLINE)) + return 0; + DWORD Status = CallService(MS_CLIST_GETSTATUSMODE,0,0); + if ( ((DefaultNudge.statusFlags & NUDGE_ACC_ST0) && (Status<=ID_STATUS_OFFLINE)) || + ((DefaultNudge.statusFlags & NUDGE_ACC_ST1) && (Status==ID_STATUS_ONLINE)) || + ((DefaultNudge.statusFlags & NUDGE_ACC_ST2) && (Status==ID_STATUS_AWAY)) || + ((DefaultNudge.statusFlags & NUDGE_ACC_ST3) && (Status==ID_STATUS_DND)) || + ((DefaultNudge.statusFlags & NUDGE_ACC_ST4) && (Status==ID_STATUS_NA)) || + ((DefaultNudge.statusFlags & NUDGE_ACC_ST5) && (Status==ID_STATUS_OCCUPIED)) || + ((DefaultNudge.statusFlags & NUDGE_ACC_ST6) && (Status==ID_STATUS_FREECHAT)) || + ((DefaultNudge.statusFlags & NUDGE_ACC_ST7) && (Status==ID_STATUS_INVISIBLE)) || + ((DefaultNudge.statusFlags & NUDGE_ACC_ST8) && (Status==ID_STATUS_ONTHEPHONE)) || + ((DefaultNudge.statusFlags & NUDGE_ACC_ST9) && (Status==ID_STATUS_OUTTOLUNCH))) + { + if(diff >= GlobalNudge.recvTimeSec) + { + if(DefaultNudge.showPopup) + Nudge_ShowPopup(DefaultNudge, (HANDLE) wParam, DefaultNudge.recText); + if(DefaultNudge.openContactList) + OpenContactList(); + if(DefaultNudge.shakeClist) + ShakeClist(wParam,lParam); + if(DefaultNudge.openMessageWindow) + CallService(MS_MSG_SENDMESSAGET,wParam,0); + if(DefaultNudge.shakeChat) + ShakeChat(wParam,lParam); + if(DefaultNudge.autoResend) + mir_forkthread(AutoResendNudge,(void *)wParam); + + SkinPlaySound( DefaultNudge.NudgeSoundname ); + } + } + if(diff2 >= GlobalNudge.recvTimeSec) + { + if(DefaultNudge.showStatus) + Nudge_ShowStatus(DefaultNudge, (HANDLE) wParam, nudgeSentTimestamp); + } + } + } + return 0; +} + +extern "C" BOOL WINAPI DllMain(HINSTANCE hinstDLL,DWORD fdwReason,LPVOID lpvReserved) +{ + hInst=hinstDLL; + return TRUE; +} + +extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion) +{ + return &pluginInfo; +} + +static INT_PTR CALLBACK DlgProcOptsTrigger(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { + + switch (msg) { + case WM_INITDIALOG: { + // lParam = (LPARAM)(DWORD)actionID or 0 if this is a new trigger entry + BOOL bshakeClist,bshakeChat; + + DWORD actionID = (DWORD)lParam; + TranslateDialogDefault(hwnd); + // Initialize the dialog according to the action ID + bshakeClist = DBGetActionSettingByte(actionID, NULL, "Nudge", "ShakeClist",FALSE); + bshakeChat = DBGetActionSettingByte(actionID, NULL, "Nudge", "ShakeChat",FALSE); + CheckDlgButton(hwnd, IDC_TRIGGER_SHAKECLIST, bshakeClist ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwnd, IDC_TRIGGER_SHAKECHAT, bshakeChat ? BST_CHECKED : BST_UNCHECKED); + break; + } + + case TM_ADDACTION: { + // save your settings + // wParam = (WPARAM)(DWORD)actionID + bool bshakeClist,bshakeChat; + + DWORD actionID = (DWORD)wParam; + bshakeClist = (IsDlgButtonChecked(hwnd,IDC_TRIGGER_SHAKECLIST)==BST_CHECKED); + bshakeChat = (IsDlgButtonChecked(hwnd,IDC_TRIGGER_SHAKECHAT)==BST_CHECKED); + DBWriteActionSettingByte(actionID, NULL, "Nudge", "ShakeClist",bshakeClist); + DBWriteActionSettingByte(actionID, NULL, "Nudge", "ShakeChat",bshakeChat); + break; + } + } + + return FALSE; +} + +int TriggerActionRecv( DWORD actionID, REPORTINFO *ri) +{ + // check how to process this call + if (ri->flags&ACT_PERFORM) { + BOOL bshakeClist,bshakeChat; + HANDLE hContact = ((ri->td!=NULL)&&(ri->td->dFlags&DF_CONTACT))?ri->td->hContact:NULL; + bshakeClist = DBGetActionSettingByte(actionID, NULL, "Nudge", "ShakeClist",FALSE); + bshakeChat = DBGetActionSettingByte(actionID, NULL, "Nudge", "ShakeChat",FALSE); + + if(bshakeClist) + ShakeClist(NULL,NULL); + if(bshakeChat && (hContact != NULL)) + ShakeChat((WPARAM)hContact,NULL); + } + + if (ri->flags&ACT_CLEANUP) // request to delete all associated settings + RemoveAllActionSettings(actionID, "Nudge"); + + return FALSE; +} + +int TriggerActionSend( DWORD actionID, REPORTINFO *ri) +{ + if (ri->flags & ACT_PERFORM) { + HANDLE hContact = ((ri->td!=NULL)&&(ri->td->dFlags&DF_CONTACT))?ri->td->hContact:NULL; + if(hContact != NULL) + NudgeSend((WPARAM)hContact,NULL); + } + + return FALSE; +} + +void LoadProtocols(void) +{ + //Load the default nudge + mir_snprintf(DefaultNudge.ProtocolName,sizeof(DefaultNudge.ProtocolName),"Default"); + mir_snprintf(DefaultNudge.NudgeSoundname,sizeof(DefaultNudge.NudgeSoundname),"Nudge : Default"); + SkinAddNewSoundEx( DefaultNudge.NudgeSoundname, LPGEN("Nudge"), LPGEN("Default Nudge")); + DefaultNudge.Load(); + + GlobalNudge.Load(); + + int numberOfProtocols = 0; + PROTOACCOUNT **ppProtocolDescriptors; + INT_PTR ret = ProtoEnumAccounts(&numberOfProtocols,&ppProtocolDescriptors); + if(ret == 0) + { + for(int i = 0; i < numberOfProtocols ; i++) + { + Nudge_AddAccount(ppProtocolDescriptors[i]); + } + + } + + shake.Load(); + + /*CNudgeElement *n; + for(n = NudgeList;n != NULL; n = n->next) + { + MessageBox(NULL,n->ProtocolName,n->NudgeSoundname,0); + }*/ +} + +void RegisterToTrigger(void) +{ + if ( ServiceExists(MS_TRIGGER_REGISTERACTION)) + { + ACTIONREGISTER ar; + ZeroMemory(&ar, sizeof(ar)); + ar.cbSize = sizeof(ar); + ar.hInstance = hInst; + ar.flags = ARF_TCHAR|ARF_FUNCTION; + ar.actionFunction = TriggerActionRecv; + ar.pfnDlgProc = DlgProcOptsTrigger; + ar.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_TRIGGER); + ar.pszName = Translate("Nudge : Shake contact list/chat window"); + + // register the action + CallService(MS_TRIGGER_REGISTERACTION, 0, (LPARAM)&ar); + + ar.actionFunction = TriggerActionSend; + ar.pszName = Translate("Nudge : Send a nudge"); + ar.pfnDlgProc = NULL; + ar.pszTemplate = NULL; + + // register the action + CallService(MS_TRIGGER_REGISTERACTION, 0, (LPARAM)&ar); + } +} + +void RegisterToDbeditorpp(void) +{ + // known modules list + if (ServiceExists("DBEditorpp/RegisterSingleModule")) + CallService("DBEditorpp/RegisterSingleModule", (WPARAM)"Nudge", 0); +} + +void LoadIcons(void) +{ + //Load icons + SKINICONDESC sid = {0}; + TCHAR szFilename[MAX_PATH]; + GetModuleFileName(hInst,szFilename,MAX_PATH); + + sid.cbSize = sizeof(sid); + sid.flags = SIDF_ALL_TCHAR; + sid.ptszSection = LPGENT("Nudge"); + sid.ptszDefaultFile = szFilename; + + sid.pszName = "Nudge_Default"; + sid.ptszDescription = LPGENT("Nudge as Default"); + sid.iDefaultIndex = -IDI_NUDGE; + sid.hDefaultIcon = LoadIcon(hInst,MAKEINTRESOURCE(IDI_NUDGE)); + g_hIcon = Skin_AddIcon(&sid); +} + +// Nudge support +static int TabsrmmButtonPressed(WPARAM wParam, LPARAM lParam) +{ + CustomButtonClickData *cbcd=(CustomButtonClickData *)lParam; + + if (!strcmp(cbcd->pszModule,"Nudge")) + NudgeSend(wParam, 0); + + return 0; +} + +static int TabsrmmButtonInit(WPARAM wParam, LPARAM lParam) +{ + BBButton bbd = {0}; + + bbd.cbSize = sizeof(BBButton); + bbd.pszModuleName = "Nudge"; + bbd.ptszTooltip = LPGENT("Send Nudge"); + bbd.dwDefPos = 300; + bbd.bbbFlags = BBBF_ISIMBUTTON|BBBF_ISLSIDEBUTTON|BBBF_CANBEHIDDEN; + bbd.hIcon = g_hIcon; + bbd.dwButtonID = 6000; + bbd.iButtonWidth = 0; + CallService (MS_BB_ADDBUTTON, 0, (LPARAM)&bbd); + + return 0; +} + +void HideNudgeButton(HANDLE hContact) +{ + char str[MAXMODULELABELLENGTH + 12] = {0}; + char *szProto = (char*) CallService(MS_PROTO_GETCONTACTBASEPROTO,(WPARAM)hContact,0); + mir_snprintf(str,MAXMODULELABELLENGTH + 12,"%s/SendNudge", szProto); + + if (!ServiceExists(str)) + { + BBButton bbd={0}; + bbd.cbSize=sizeof(BBButton); + bbd.bbbFlags=BBSF_HIDDEN|BBSF_DISABLED; + bbd.pszModuleName="Nudge"; + bbd.dwButtonID = 6000; + CallService(MS_BB_SETBUTTONSTATE, (WPARAM)hContact, (LPARAM)&bbd); + } +} + +static int ContactWindowOpen(WPARAM wparam,LPARAM lParam) +{ + MessageWindowEventData *MWeventdata = (MessageWindowEventData*)lParam; + + if(MWeventdata->uType == MSG_WINDOW_EVT_OPENING&&MWeventdata->hContact) + { + HideNudgeButton(MWeventdata->hContact); + } + return 0; +} + +int ModulesLoaded(WPARAM,LPARAM) +{ + RegisterToTrigger(); + RegisterToDbeditorpp(); + LoadProtocols(); + LoadIcons(); + LoadPopupClass(); + + g_hEventToolbarLoaded = HookEvent(ME_MSG_TOOLBARLOADED, TabsrmmButtonInit); + if (g_hEventToolbarLoaded) + { + g_hEventButtonPressed = HookEvent(ME_MSG_BUTTONPRESSED, TabsrmmButtonPressed); + g_hEventDbWindowEvent = HookEvent(ME_MSG_WINDOWEVENT,ContactWindowOpen); + } + return 0; +} + +int AccListChanged(WPARAM wParam,LPARAM lParam) +{ + PROTOACCOUNT *proto = (PROTOACCOUNT*) wParam; + if (proto==NULL) + return 0; + + switch (lParam) + { + case PRAC_ADDED: + Nudge_AddAccount(proto); + break; + } + return 0; +} + +HANDLE hShakeClist=NULL,hShakeChat=NULL,hNudgeSend=NULL,hNudgeShowMenu=NULL; +extern "C" int __declspec(dllexport) Load(void) +{ + + mir_getLP(&pluginInfo); + + g_hEventModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED,ModulesLoaded); + g_hEventAccountsChanged = HookEvent(ME_PROTO_ACCLISTCHANGED,AccListChanged); + hEventOptionsInitialize = HookEvent(ME_OPT_INITIALISE, NudgeOptInit); + + //Create function for plugins + hShakeClist=CreateServiceFunction(MS_SHAKE_CLIST,ShakeClist); + hShakeChat=CreateServiceFunction(MS_SHAKE_CHAT,ShakeChat); + hNudgeSend=CreateServiceFunction(MS_NUDGE_SEND,NudgeSend); + hNudgeShowMenu=CreateServiceFunction(MS_NUDGE_SHOWMENU,NudgeShowMenu); + return 0; +} + +extern "C" int __declspec(dllexport) Unload(void) +{ + if(g_hEventToolbarLoaded) UnhookEvent(g_hEventToolbarLoaded); + if(g_hEventDbWindowEvent) UnhookEvent(g_hEventButtonPressed); + if(g_hEventDbWindowEvent) UnhookEvent(g_hEventDbWindowEvent); + + UnhookEvent(g_hEventModulesLoaded); + UnhookEvent(g_hEventAccountsChanged); + UnhookEvent(hEventOptionsInitialize); + + DestroyServiceFunction(hShakeClist); + DestroyServiceFunction(hShakeChat); + DestroyServiceFunction(hNudgeSend); + DestroyServiceFunction(hNudgeShowMenu); + + NudgeElementList* p = NudgeList; + while ( p != NULL ) + { + if(p->item.hEvent) UnhookEvent(p->item.hEvent); + NudgeElementList* p1 = p->next; + //free( p ); + delete p; + p = p1; + } + return 0; +} + +LRESULT CALLBACK NudgePopUpProc(HWND hWnd,UINT msg,WPARAM wParam,LPARAM lParam) +{ + switch(msg) + { + case WM_COMMAND: + { + HANDLE hContact = PUGetContact(hWnd); + CallService(MS_MSG_SENDMESSAGET, (WPARAM)hContact, 0); + PUDeletePopUp(hWnd); + break; + } + + case WM_CONTEXTMENU: + PUDeletePopUp(hWnd); + break; + case UM_FREEPLUGINDATA: + //Here we'd free our own data, if we had it. + return FALSE; + case UM_INITPOPUP: + break; + case UM_DESTROYPOPUP: + break; + case WM_NOTIFY: + default: + break; + } + return DefWindowProc(hWnd,msg,wParam,lParam); +} + +void LoadPopupClass() +{ + if(ServiceExists(MS_POPUP_REGISTERCLASS)) + { + POPUPCLASS ppc = {0}; + ppc.cbSize = sizeof(ppc); + ppc.flags = PCF_TCHAR; + ppc.pszName = "nudge"; + ppc.ptszDescription = LPGENT("Show Nudge"); + ppc.hIcon = (HICON) CallService(MS_SKIN2_GETICONBYHANDLE,0,(LPARAM)g_hIcon); + ppc.colorBack = NULL; + ppc.colorText = NULL; + ppc.iSeconds = 0; + ppc.PluginWindowProc = NudgePopUpProc; + CallService(MS_POPUP_REGISTERCLASS,0,(LPARAM)&ppc); + } +} + +int Preview() +{ + HANDLE hContact = (HANDLE) CallService(MS_DB_CONTACT_FINDFIRST,0,0); + if ( GlobalNudge.useByProtocol ) + { + for(NudgeElementList *n = NudgeList;n != NULL; n = n->next) + { + if(n->item.enabled) + { + SkinPlaySound( n->item.NudgeSoundname ); + if(n->item.showPopup) + Nudge_ShowPopup(n->item, hContact, n->item.recText); + if(n->item.openContactList) + OpenContactList(); + if(n->item.shakeClist) + ShakeClist(0,0); + if(n->item.openMessageWindow) + CallService(MS_MSG_SENDMESSAGET,(WPARAM)hContact,NULL); + if(n->item.shakeChat) + ShakeChat((WPARAM)hContact,(LPARAM)time(NULL)); + } + } + } + else + { + if(DefaultNudge.enabled) + { + SkinPlaySound( DefaultNudge.NudgeSoundname ); + if(DefaultNudge.showPopup) + Nudge_ShowPopup(DefaultNudge, hContact, DefaultNudge.recText); + if(DefaultNudge.openContactList) + OpenContactList(); + if(DefaultNudge.shakeClist) + ShakeClist(0,0); + if(DefaultNudge.openMessageWindow) + CallService(MS_MSG_SENDMESSAGET,(WPARAM)hContact,NULL); + if(DefaultNudge.shakeChat) + ShakeChat((WPARAM)hContact,(LPARAM)time(NULL)); + } + } + return 0; +} + +void Nudge_ShowPopup(CNudgeElement n, HANDLE hContact, TCHAR * Message) +{ + hContact = Nudge_GethContact(hContact); + TCHAR * lpzContactName = (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME,(WPARAM)hContact,GCDNF_TCHAR); + + if(ServiceExists(MS_POPUP_ADDPOPUPCLASS)) + { + POPUPDATACLASS NudgePopUp = {0}; + NudgePopUp.cbSize = sizeof(NudgePopUp); + NudgePopUp.hContact = hContact; + NudgePopUp.ptszText = Message; + NudgePopUp.ptszTitle = lpzContactName; + NudgePopUp.pszClassName = "nudge"; + CallService(MS_POPUP_ADDPOPUPCLASS, 0, (LPARAM)&NudgePopUp); + } + else if(ServiceExists(MS_POPUP_ADDPOPUPT)) + { + POPUPDATAT NudgePopUp = {0}; + + NudgePopUp.lchContact = hContact; + NudgePopUp.lchIcon = (HICON) CallService(MS_SKIN2_GETICON,0,(LPARAM) n.hIcoLibItem ); + NudgePopUp.colorBack = 0; + NudgePopUp.colorText = 0; + NudgePopUp.iSeconds = 0; + NudgePopUp.PluginWindowProc = NudgePopUpProc; + NudgePopUp.PluginData = (void *)1; + + //lstrcpy(NudgePopUp.lpzText, Translate(Message)); + lstrcpy(NudgePopUp.lptzText, Message); + + lstrcpy(NudgePopUp.lptzContactName, lpzContactName); + + CallService(MS_POPUP_ADDPOPUPT,(WPARAM)&NudgePopUp,0); + } + else + { + MessageBox(NULL,Message,lpzContactName,0); + } +} + +void Nudge_SentStatus(CNudgeElement n, HANDLE hContact) +{ + DBEVENTINFO NudgeEvent = { 0 }; + + NudgeEvent.cbSize = sizeof(NudgeEvent); + NudgeEvent.szModule = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); + + char *buff = mir_utf8encodeT(n.senText); + NudgeEvent.flags = DBEF_SENT | DBEF_UTF; + + NudgeEvent.timestamp = ( DWORD )time(NULL); + NudgeEvent.eventType = EVENTTYPE_STATUSCHANGE; + NudgeEvent.cbBlob = (DWORD)strlen(buff) + 1; + NudgeEvent.pBlob = ( PBYTE ) buff; + + INT_PTR res = CallService( MS_MC_GETMETACONTACT, (WPARAM)hContact, 0 ); //try to retrieve the metacontact if some + if(res != CALLSERVICE_NOTFOUND) + { + HANDLE hMetaContact = (HANDLE) res; + if(hMetaContact != NULL) //metacontact + CallService(MS_DB_EVENT_ADD,(WPARAM)hMetaContact,(LPARAM)&NudgeEvent); + } + + + CallService(MS_DB_EVENT_ADD,(WPARAM)hContact,(LPARAM)&NudgeEvent); +} + +void Nudge_ShowStatus(CNudgeElement n, HANDLE hContact, DWORD timestamp) +{ + DBEVENTINFO NudgeEvent = { 0 }; + + NudgeEvent.cbSize = sizeof(NudgeEvent); + NudgeEvent.szModule = (char*)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0); + + char *buff = mir_utf8encodeT(n.recText); + NudgeEvent.flags = DBEF_UTF; + + NudgeEvent.timestamp = timestamp; + NudgeEvent.eventType = EVENTTYPE_STATUSCHANGE; + NudgeEvent.cbBlob = (DWORD)strlen(buff) + 1; + NudgeEvent.pBlob = ( PBYTE ) buff; + + + INT_PTR res = CallService( MS_MC_GETMETACONTACT, (WPARAM)hContact, 0 ); //try to retrieve the metacontact if some + if(res != CALLSERVICE_NOTFOUND) + { + HANDLE hMetaContact = (HANDLE) res; + if(hMetaContact != NULL) //metacontact + { + CallService(MS_DB_EVENT_ADD,(WPARAM)hMetaContact,(LPARAM)&NudgeEvent); + NudgeEvent.flags |= DBEF_READ; + } + } + + CallService(MS_DB_EVENT_ADD,(WPARAM)hContact,(LPARAM)&NudgeEvent); +} + +HANDLE Nudge_GethContact(HANDLE hContact) +{ + INT_PTR res = CallService( MS_MC_GETMETACONTACT, (WPARAM)hContact, 0 ); + if(res!=CALLSERVICE_NOTFOUND) + { + HANDLE hMetaContact = (HANDLE) res; + if(hMetaContact!=NULL) + return hMetaContact; + } + + return hContact; +} + +void Nudge_AddAccount(PROTOACCOUNT *proto) +{ + char str[MAXMODULELABELLENGTH + 10]; + mir_snprintf(str,sizeof(str),"%s/Nudge",proto->szModuleName); + HANDLE hevent = HookEvent(str, NudgeRecieved); + if(hevent == NULL) + return; + + nProtocol ++; + + //Add a specific sound per protocol + NudgeElementList *newNudge = new NudgeElementList; + //newNudge = (NudgeElementList*) malloc(sizeof(NudgeElementList)); + mir_snprintf(newNudge->item.NudgeSoundname,sizeof(newNudge->item.NudgeSoundname),"%s: Nudge",proto->szModuleName); + + strcpy( newNudge->item.ProtocolName, proto->szProtoName ); + _tcscpy(newNudge->item.AccountName, proto->tszAccountName ); + + newNudge->item.Load(); + + newNudge->item.hEvent = hevent; + + TCHAR soundDesc[MAXMODULELABELLENGTH + 10]; + mir_sntprintf(soundDesc,sizeof(soundDesc),_T("Nudge for %s"),proto->tszAccountName); + SkinAddNewSoundExT(newNudge->item.NudgeSoundname, LPGENT("Nudge"), soundDesc); + + newNudge->next = NudgeList; + NudgeList = newNudge; + + char iconName[MAXMODULELABELLENGTH + 10]; + mir_snprintf(iconName,sizeof(iconName),"Nudge_%s",proto->szModuleName); + + TCHAR szFilename[MAX_PATH], iconDesc[MAXMODULELABELLENGTH + 10]; + GetModuleFileName(hInst,szFilename,MAX_PATH); + mir_sntprintf(iconDesc, SIZEOF(iconDesc), TranslateT("Nudge for %s"), proto->tszAccountName); + + SKINICONDESC sid = {0}; + sid.cbSize = sizeof(sid); + sid.flags = SIDF_ALL_TCHAR; + sid.ptszSection = LPGENT("Nudge"); + sid.ptszDefaultFile = szFilename; + sid.pszName = iconName; + sid.ptszDescription = iconDesc; + sid.iDefaultIndex = -IDI_NUDGE; + sid.hDefaultIcon = LoadIcon(hInst,MAKEINTRESOURCE(IDI_NUDGE)); + newNudge->item.hIcoLibItem = Skin_AddIcon(&sid); + + //Add contact menu entry + CLISTMENUITEM mi = {0}; + mi.cbSize = sizeof(mi); + mi.popupPosition = 500085000; + mi.pszContactOwner = proto->szModuleName; + mi.pszPopupName = proto->szModuleName; + mi.flags = CMIF_NOTOFFLINE | CMIF_TCHAR | CMIF_ICONFROMICOLIB; + mi.position = -500050004; + mi.icolibItem = newNudge->item.hIcoLibItem; + mi.ptszName = LPGENT( "Send &Nudge" ); + mi.pszService = MS_NUDGE_SEND; + newNudge->item.hContactMenu = Menu_AddContactMenuItem(&mi); +} + +void AutoResendNudge(void *wParam) +{ + + Sleep(GlobalNudge.resendDelaySec * 1000); + NudgeSend((WPARAM) wParam,NULL); +} diff --git a/plugins/Nudge/src/main.h b/plugins/Nudge/src/main.h new file mode 100644 index 0000000000..556ee0070b --- /dev/null +++ b/plugins/Nudge/src/main.h @@ -0,0 +1,31 @@ +#include "nudge.h" + +/* +* +****************************/ +void Nudge_ShowPopup(CNudgeElement, HANDLE, TCHAR *); + +/* +* +****************************/ +void Nudge_ShowStatus(CNudgeElement, HANDLE, DWORD timestamp); + +/* +* +****************************/ +void Nudge_SentStatus(CNudgeElement, HANDLE); + +/* +* +****************************/ +void Nudge_AddAccount(PROTOACCOUNT *proto); + +/* +* +****************************/ +void LoadPopupClass(); + +/* +* +****************************/ +void AutoResendNudge(void *wParam) ; diff --git a/plugins/Nudge/src/nudge.cpp b/plugins/Nudge/src/nudge.cpp new file mode 100644 index 0000000000..0afa6edee0 --- /dev/null +++ b/plugins/Nudge/src/nudge.cpp @@ -0,0 +1,117 @@ +#include "headers.h" +#include "nudge.h" + +void CNudge::Save(void) +{ + char SectionName[512]; + mir_snprintf(SectionName,512,"useByProtocol"); + DBWriteContactSettingByte(NULL, "Nudge", SectionName, this->useByProtocol); + mir_snprintf(SectionName,512,"RecvTimeSec"); + DBWriteContactSettingDword(NULL, "Nudge", SectionName, this->recvTimeSec); + mir_snprintf(SectionName,512,"SendTimeSec"); + DBWriteContactSettingDword(NULL, "Nudge", SectionName, this->sendTimeSec); + mir_snprintf(SectionName,512,"ResendDelaySec"); + DBWriteContactSettingDword(NULL, "Nudge", SectionName, this->resendDelaySec); +} + + +void CNudge::Load(void) +{ + char SectionName[512]; + mir_snprintf(SectionName,512,"useByProtocol"); + this->useByProtocol = DBGetContactSettingByte(NULL, "Nudge", SectionName, FALSE) != 0; + mir_snprintf(SectionName,512,"RecvTimeSec"); + this->recvTimeSec = DBGetContactSettingDword(NULL, "Nudge", SectionName, 30); + mir_snprintf(SectionName,512,"SendTimeSec"); + this->sendTimeSec = DBGetContactSettingDword(NULL, "Nudge", SectionName, 30); + mir_snprintf(SectionName,512,"ResendDelaySec"); + this->resendDelaySec = DBGetContactSettingDword(NULL, "Nudge", SectionName, 3); +} + +int CNudgeElement::ShowContactMenu(bool show) +{ + + CLISTMENUITEM mi; + memset( &mi, 0, sizeof( mi )); + mi.cbSize = sizeof( mi ); + mi.flags = show? CMIM_FLAGS : CMIM_FLAGS | CMIF_HIDDEN ; + CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hContactMenu, (LPARAM)&mi); + + return 0; +} + +void CNudgeElement::Save(void) +{ + char SectionName[512]; + mir_snprintf(SectionName,512,"%s-openMessageWindow", ProtocolName); + DBWriteContactSettingByte(NULL, "Nudge", SectionName, this->openMessageWindow); + mir_snprintf(SectionName,512,"%s-openContactList", ProtocolName); + DBWriteContactSettingByte(NULL, "Nudge", SectionName, this->openContactList); + mir_snprintf(SectionName,512,"%s-useIgnore", ProtocolName); + DBWriteContactSettingByte(NULL, "Nudge", SectionName, this->useIgnoreSettings); + mir_snprintf(SectionName,512,"%s-showStatus", ProtocolName); + DBWriteContactSettingByte(NULL, "Nudge", SectionName, this->showStatus); + mir_snprintf(SectionName,512,"%s-showPopup", ProtocolName); + DBWriteContactSettingByte(NULL, "Nudge", SectionName, this->showPopup); + mir_snprintf(SectionName,512,"%s-shakeClist", ProtocolName); + DBWriteContactSettingByte(NULL, "Nudge", SectionName, this->shakeClist); + mir_snprintf(SectionName,512,"%s-shakeChat", ProtocolName); + DBWriteContactSettingByte(NULL, "Nudge", SectionName, this->shakeChat); + mir_snprintf(SectionName,512,"%s-enabled", ProtocolName); + DBWriteContactSettingByte(NULL, "Nudge", SectionName, this->enabled); + mir_snprintf(SectionName,512,"%s-autoResend", ProtocolName); + DBWriteContactSettingByte(NULL, "Nudge", SectionName, this->autoResend); + mir_snprintf(SectionName,512,"%s-statusFlags", ProtocolName); + DBWriteContactSettingDword(NULL, "Nudge", SectionName, this->statusFlags); + mir_snprintf(SectionName,512,"%s-recText", ProtocolName); + DBWriteContactSettingTString(NULL, "Nudge", SectionName, this->recText); + mir_snprintf(SectionName,512,"%s-senText", ProtocolName); + DBWriteContactSettingTString(NULL, "Nudge", SectionName, this->senText); +} + + +void CNudgeElement::Load(void) +{ + DBVARIANT dbv; + char SectionName[512]; + mir_snprintf(SectionName,512,"%s-openMessageWindow", ProtocolName); + this->openMessageWindow = DBGetContactSettingByte(NULL, "Nudge", SectionName, TRUE) != 0; + mir_snprintf(SectionName,512,"%s-openContactList", ProtocolName); + this->openContactList = DBGetContactSettingByte(NULL, "Nudge", SectionName, TRUE) != 0; + mir_snprintf(SectionName,512,"%s-useIgnore", ProtocolName); + this->useIgnoreSettings = DBGetContactSettingByte(NULL, "Nudge", SectionName, TRUE) != 0; + mir_snprintf(SectionName,512,"%s-showStatus", ProtocolName); + this->showStatus = DBGetContactSettingByte(NULL, "Nudge", SectionName, TRUE) != 0; + mir_snprintf(SectionName,512,"%s-showPopup", ProtocolName); + this->showPopup = DBGetContactSettingByte(NULL, "Nudge", SectionName, TRUE) != 0; + mir_snprintf(SectionName,512,"%s-shakeClist", ProtocolName); + this->shakeClist = DBGetContactSettingByte(NULL, "Nudge", SectionName, TRUE) != 0; + mir_snprintf(SectionName,512,"%s-shakeChat", ProtocolName); + this->shakeChat = DBGetContactSettingByte(NULL, "Nudge", SectionName, TRUE) != 0; + mir_snprintf(SectionName,512,"%s-enabled", ProtocolName); + this->enabled = DBGetContactSettingByte(NULL, "Nudge", SectionName, TRUE) != 0; + mir_snprintf(SectionName,512,"%s-autoResend", ProtocolName); + this->autoResend = DBGetContactSettingByte(NULL, "Nudge", SectionName, FALSE) != 0; + mir_snprintf(SectionName,512,"%s-statusFlags", ProtocolName); + this->statusFlags = DBGetContactSettingDword(NULL, "Nudge", SectionName, 967); + mir_snprintf(SectionName,512,"%s-recText", ProtocolName); + if (!DBGetContactSettingTString(NULL,"Nudge",SectionName,&dbv)) + { + _tcsncpy(this->recText,dbv.ptszVal,TEXT_LEN); + if(_tcsclen(this->recText) < 1) + _tcsncpy(this->recText,TranslateT("You received a nudge"),TEXT_LEN); + DBFreeVariant(&dbv); + } + else + _tcsncpy(this->recText,TranslateT("You received a nudge"),TEXT_LEN); + mir_snprintf(SectionName,512,"%s-senText", ProtocolName); + if (!DBGetContactSettingTString(NULL,"Nudge",SectionName,&dbv)) + { + _tcsncpy(this->senText,dbv.ptszVal,TEXT_LEN); + if(_tcsclen(this->senText) < 1) + _tcsncpy(this->senText,TranslateT("You sent a nudge"),TEXT_LEN); + DBFreeVariant(&dbv); + } + else + _tcsncpy(this->senText,TranslateT("You sent a nudge"),TEXT_LEN); +} \ No newline at end of file diff --git a/plugins/Nudge/src/nudge.h b/plugins/Nudge/src/nudge.h new file mode 100644 index 0000000000..8a531639ca --- /dev/null +++ b/plugins/Nudge/src/nudge.h @@ -0,0 +1,67 @@ +#ifndef NUDGE_H +#define NUDGE_H + +// NUDGE account status flags +#define NUDGE_ACC_ST0 0x00000001 //Check (countdown) when Offline +#define NUDGE_ACC_ST1 0x00000002 //Check (countdown) when Online +#define NUDGE_ACC_ST2 0x00000004 //Check (countdown) when Away +#define NUDGE_ACC_ST3 0x00000008 //Check (countdown) when N/A +#define NUDGE_ACC_ST4 0x00000010 //Check (countdown) when Occupied +#define NUDGE_ACC_ST5 0x00000020 //Check (countdown) when DND +#define NUDGE_ACC_ST6 0x00000040 //Check (countdown) when Free for chat +#define NUDGE_ACC_ST7 0x00000080 //Check (countdown) when Invisible +#define NUDGE_ACC_ST8 0x00000100 //Check (countdown) when On the phone +#define NUDGE_ACC_ST9 0x00000200 //Check (countdown) when Out to lunch + +// For status log +#define EVENTTYPE_STATUSCHANGE 25368 + +#define TEXT_LEN 1024 + +class CNudge +{ +public: + bool useByProtocol; + int sendTimeSec; + int recvTimeSec; + int resendDelaySec; + + void Load(void); + void Save(void); +}; + +class CNudgeElement +{ +public: + char ProtocolName[64]; + TCHAR AccountName[128]; + char NudgeSoundname[100]; + TCHAR recText[TEXT_LEN]; + TCHAR senText[TEXT_LEN]; + bool showPopup; + bool showStatus; + bool openMessageWindow; + bool openContactList; + bool useIgnoreSettings; + bool shakeClist; + bool shakeChat; + bool enabled; + bool autoResend; + DWORD statusFlags; + int iProtoNumber; + HANDLE hIcoLibItem; + HANDLE hEvent; + HANDLE hContactMenu; + + void Load(void); + void Save(void); + int ShowContactMenu(bool show); +}; + +typedef struct NudgeElementList +{ + CNudgeElement item; + NudgeElementList *next; +} NUDGEELEMENTLIST; + +#endif \ No newline at end of file diff --git a/plugins/Nudge/src/options.cpp b/plugins/Nudge/src/options.cpp new file mode 100644 index 0000000000..b0369143dc --- /dev/null +++ b/plugins/Nudge/src/options.cpp @@ -0,0 +1,435 @@ +#include "headers.h" +#include "main.h" +#include "shake.h" +#include "options.h" + +CNudgeElement* ActualNudge = NULL; + + + +int NudgeOptInit(WPARAM wParam,LPARAM lParam) +{ + OPTIONSDIALOGPAGE odp = { 0 }; + odp.cbSize = sizeof(odp); + odp.position = -790000000; + odp.hInstance = hInst; + odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_NUDGE); + odp.pszTitle = LPGEN("Nudge"); + odp.pszGroup = LPGEN("Events"); + odp.pszTab = LPGEN("Nudge"); + odp.flags = ODPF_BOLDGROUPS; + odp.pfnDlgProc = DlgProcNudgeOpt; + Options_AddPage(wParam, &odp); + + odp.position = -790000001; + odp.pszTab = LPGEN("Window Shaking"); + odp.pfnDlgProc = DlgProcShakeOpt; + odp.flags |= ODPF_EXPERTONLY; + odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_SHAKE); + Options_AddPage(wParam, &odp); + return 0; +} + +INT_PTR CALLBACK DlgProcShakeOpt(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam) +{ + switch(msg) + { + case WM_INITDIALOG: + TCHAR szBuf[20]; + TranslateDialogDefault(hwnd); + mir_sntprintf(szBuf, 10, _T("%d"), shake.nMoveClist); + SetDlgItemText(hwnd,IDC_LNUMBER_CLIST,szBuf); + mir_sntprintf(szBuf, 10, _T("%d"), shake.nMoveChat); + SetDlgItemText(hwnd,IDC_LNUMBER_CHAT,szBuf); + + mir_sntprintf(szBuf, 10, _T("%d"), shake.nScaleClist); + SetDlgItemText(hwnd,IDC_LSCALE_CLIST,szBuf); + mir_sntprintf(szBuf, 10, _T("%d"), shake.nScaleChat); + SetDlgItemText(hwnd,IDC_LSCALE_CHAT,szBuf); + + SendDlgItemMessage(hwnd, IDC_SNUMBER_CLIST, TBM_SETRANGE, 0, (LPARAM)MAKELONG(1, 60)); + SendDlgItemMessage(hwnd, IDC_SNUMBER_CHAT, TBM_SETRANGE, 0, (LPARAM)MAKELONG(1, 60)); + + SendDlgItemMessage(hwnd, IDC_SSCALE_CLIST, TBM_SETRANGE, 0, (LPARAM)MAKELONG(1, 40)); + SendDlgItemMessage(hwnd, IDC_SSCALE_CHAT, TBM_SETRANGE, 0, (LPARAM)MAKELONG(1, 40)); + + SendDlgItemMessage(hwnd, IDC_SNUMBER_CLIST, TBM_SETPOS, TRUE, shake.nMoveClist); + SendDlgItemMessage(hwnd, IDC_SNUMBER_CHAT, TBM_SETPOS, TRUE, shake.nMoveChat); + + SendDlgItemMessage(hwnd, IDC_SSCALE_CLIST, TBM_SETPOS, TRUE, shake.nScaleClist); + SendDlgItemMessage(hwnd, IDC_SSCALE_CHAT, TBM_SETPOS, TRUE, shake.nScaleChat); + + break; + case WM_COMMAND: + { + WORD wNotifyCode = HIWORD(wParam); + switch(LOWORD(wParam)) + { + case IDC_PREVIEW: + ShakeClist(0,0); + //SendMessage(GetParent(hwnd),PSM_CHANGED,0,0); + break; + } + break; + } + case WM_HSCROLL: + if ((HWND)lParam == GetDlgItem(hwnd, IDC_SNUMBER_CLIST) || (HWND)lParam == GetDlgItem(hwnd, IDC_SNUMBER_CHAT) + || (HWND)lParam == GetDlgItem(hwnd, IDC_SSCALE_CLIST) || (HWND)lParam == GetDlgItem(hwnd, IDC_SSCALE_CHAT)) + { + TCHAR szBuf[20]; + DWORD dwPos = SendMessage((HWND) lParam, TBM_GETPOS, 0, 0); + mir_sntprintf(szBuf, sizeof(szBuf), _T("%d"), dwPos); + if ((HWND)lParam == GetDlgItem(hwnd, IDC_SNUMBER_CLIST)) + SetDlgItemText(hwnd,IDC_LNUMBER_CLIST,szBuf); + if ((HWND)lParam == GetDlgItem(hwnd, IDC_SNUMBER_CHAT)) + SetDlgItemText(hwnd,IDC_LNUMBER_CHAT,szBuf); + if ((HWND)lParam == GetDlgItem(hwnd, IDC_SSCALE_CLIST)) + SetDlgItemText(hwnd,IDC_LSCALE_CLIST,szBuf); + if ((HWND)lParam == GetDlgItem(hwnd, IDC_SSCALE_CHAT)) + SetDlgItemText(hwnd,IDC_LSCALE_CHAT,szBuf); + SendMessage(GetParent(hwnd), PSM_CHANGED, 0, 0); + } + break; + + case WM_SHOWWINDOW: + break; + + case WM_NOTIFY: + switch(((LPNMHDR)lParam)->idFrom) + { + case 0: + switch(((LPNMHDR)lParam)->code) + { + case PSN_APPLY: + { + shake.nMoveClist = (int) SendMessage(GetDlgItem(hwnd, IDC_SNUMBER_CLIST), TBM_GETPOS, 0, 0); + shake.nMoveChat = (int) SendMessage(GetDlgItem(hwnd, IDC_SNUMBER_CHAT), TBM_GETPOS, 0, 0); + shake.nScaleClist = (int) SendMessage(GetDlgItem(hwnd, IDC_SSCALE_CLIST), TBM_GETPOS, 0, 0); + shake.nScaleChat = (int) SendMessage(GetDlgItem(hwnd, IDC_SSCALE_CHAT), TBM_GETPOS, 0, 0); + shake.Save(); + } + } + } + break; + } + + return FALSE; +} + +void CreateImageList(HWND hWnd) +{ + // Create and populate image list + HIMAGELIST hImList = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_MASK | ILC_COLOR32, nProtocol, 0); + + for(NudgeElementList *n = NudgeList;n != NULL; n = n->next) + { + INT_PTR res = CallProtoService(n->item.ProtocolName, PS_LOADICON,PLI_PROTOCOL | PLIF_SMALL | PLIF_ICOLIB, 0); + if(res==CALLSERVICE_NOTFOUND) + { + res = CallService(MS_SKIN2_GETICONBYHANDLE,0,(LPARAM)n->item.hIcoLibItem); + } + + HICON hIcon = (HICON) res; + ImageList_AddIcon(hImList, hIcon); + } + //ADD default Icon for nudge + HICON hIcon = (HICON) LoadImage(hInst, MAKEINTRESOURCE(IDI_NUDGE), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0); + ImageList_AddIcon(hImList, hIcon); + DestroyIcon(hIcon); + + HWND hLstView = GetDlgItem(hWnd, IDC_PROTOLIST); + TreeView_SetImageList(hLstView, hImList, TVSIL_NORMAL); +} + +void PopulateProtocolList(HWND hWnd) +{ + bool useOne = IsDlgButtonChecked(hWnd, IDC_USEBYPROTOCOL) == BST_UNCHECKED; + + HWND hLstView = GetDlgItem(hWnd, IDC_PROTOLIST); + + TreeView_DeleteAllItems(hLstView); + + TVINSERTSTRUCT tvi = {0}; + tvi.hParent = TVI_ROOT; + tvi.hInsertAfter = TVI_LAST; + tvi.item.mask = TVIF_TEXT | TVIF_IMAGE | TVIF_STATE | TVIF_SELECTEDIMAGE; + tvi.item.stateMask = TVIS_STATEIMAGEMASK; + + int i = 0; + if (GlobalNudge.useByProtocol) + { + for(NudgeElementList *n = NudgeList;n != NULL; n = n->next) + { + tvi.item.pszText = n->item.AccountName; + tvi.item.iImage = i; + n->item.iProtoNumber = i; + tvi.item.iSelectedImage = i; + tvi.item.state = INDEXTOSTATEIMAGEMASK(n->item.enabled?2:1); + TreeView_InsertItem(hLstView, &tvi); + i++; + } + } + else + { + tvi.item.pszText = TranslateT("Nudge"); + tvi.item.iImage = nProtocol; + DefaultNudge.iProtoNumber = nProtocol; + tvi.item.iSelectedImage = nProtocol; + tvi.item.state = INDEXTOSTATEIMAGEMASK(DefaultNudge.enabled?2:1); + TreeView_InsertItem(hLstView, &tvi); + + } + TreeView_SelectItem(hLstView, TreeView_GetRoot(hLstView)); + //TreeView_SetCheckState(hLstView, TreeView_GetRoot(hLstView), TRUE) +} + + +INT_PTR CALLBACK DlgProcNudgeOpt(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam) +{ + static bool iInitDone = true; + switch(msg) + { + case WM_INITDIALOG: + iInitDone = false; + TranslateDialogDefault(hwnd); + CreateImageList(hwnd); + PopulateProtocolList(hwnd); + UpdateControls(hwnd); + iInitDone = true; + break; + case WM_DESTROY: + { + HIMAGELIST hImList = TreeView_GetImageList(GetDlgItem(hwnd, IDC_PROTOLIST), TVSIL_NORMAL); + if (hImList) + { + TreeView_SetImageList(GetDlgItem(hwnd, IDC_PROTOLIST), NULL, TVSIL_NORMAL); // Avoiding Access Violation in CommonControls DLL + ImageList_Destroy(hImList); + } + break; + } + case WM_COMMAND: + { + WORD wNotifyCode = HIWORD(wParam); + switch(LOWORD(wParam)) + { + case IDC_PREVIEW: + Preview(); + break; + case IDC_USEBYPROTOCOL: + GlobalNudge.useByProtocol = (IsDlgButtonChecked(hwnd,IDC_USEBYPROTOCOL)==BST_CHECKED); + PopulateProtocolList(hwnd); + UpdateControls(hwnd); + SendMessage(GetParent(hwnd),PSM_CHANGED,0,0); + break; + case IDC_AUTORESEND: + if (ActualNudge)// fix NULL pointer then no nudge support protocols + { + ActualNudge->autoResend = (IsDlgButtonChecked(hwnd,IDC_AUTORESEND)==BST_CHECKED); + EnableWindow(GetDlgItem(hwnd,IDC_RESENDDELAY),ActualNudge->autoResend); + } + SendMessage(GetParent(hwnd),PSM_CHANGED,0,0); + break; + case IDC_CHECKST0: + case IDC_CHECKST1: + case IDC_CHECKST2: + case IDC_CHECKST3: + case IDC_CHECKST4: + case IDC_CHECKST5: + case IDC_CHECKST6: + case IDC_CHECKST7: + case IDC_CHECKST8: + case IDC_CHECKST9: + case IDC_CHECKPOP: + case IDC_OPENMESSAGE: + case IDC_CHECKCLIST: + case IDC_CHECKCHAT: + case IDC_CHECKSTATUS: + case IDC_IGNORE: + case IDC_OPENCONTACTLIST: + SendMessage(GetParent(hwnd),PSM_CHANGED,0,0); + break; + case IDC_RESENDDELAY: + case IDC_SENDTEXT: + case IDC_RECVTEXT: + case IDC_SENDTIME: + case IDC_RECVTIME: + if(iInitDone && (wNotifyCode == EN_CHANGE)) + SendMessage(GetParent(hwnd),PSM_CHANGED,0,0); + break; + } + break; + } + case WM_SHOWWINDOW: + break; + + case WM_NOTIFY: + switch(((LPNMHDR)lParam)->idFrom) + { + case 0: + switch(((LPNMHDR)lParam)->code) + { + case PSN_APPLY: + { + BOOL Translated; + GlobalNudge.sendTimeSec = GetDlgItemInt(hwnd,IDC_SENDTIME,&Translated,FALSE); + GlobalNudge.recvTimeSec = GetDlgItemInt(hwnd,IDC_RECVTIME,&Translated,FALSE); + GlobalNudge.resendDelaySec = GetDlgItemInt(hwnd,IDC_RESENDDELAY,&Translated,FALSE); + if(GlobalNudge.resendDelaySec > 10 ) GlobalNudge.resendDelaySec = 10; + if(GlobalNudge.resendDelaySec < 1 ) GlobalNudge.resendDelaySec = 1; + if (ActualNudge)// fix NULL pointer then no nudge support protocols + { + ActualNudge->shakeClist = (IsDlgButtonChecked(hwnd,IDC_CHECKCLIST)==BST_CHECKED); + ActualNudge->shakeChat = (IsDlgButtonChecked(hwnd,IDC_CHECKCHAT)==BST_CHECKED); + ActualNudge->openMessageWindow = (IsDlgButtonChecked(hwnd,IDC_OPENMESSAGE)==BST_CHECKED); + ActualNudge->openContactList = (IsDlgButtonChecked(hwnd,IDC_OPENCONTACTLIST)==BST_CHECKED); + ActualNudge->useIgnoreSettings = (IsDlgButtonChecked(hwnd,IDC_IGNORE)==BST_CHECKED); + ActualNudge->showStatus = (IsDlgButtonChecked(hwnd,IDC_CHECKSTATUS)==BST_CHECKED); + ActualNudge->showPopup = (IsDlgButtonChecked(hwnd,IDC_CHECKPOP)==BST_CHECKED); + ActualNudge->statusFlags = + ((IsDlgButtonChecked(hwnd,IDC_CHECKST0)==BST_CHECKED) ? NUDGE_ACC_ST0 : 0) | + ((IsDlgButtonChecked(hwnd,IDC_CHECKST1)==BST_CHECKED) ? NUDGE_ACC_ST1 : 0) | + ((IsDlgButtonChecked(hwnd,IDC_CHECKST2)==BST_CHECKED) ? NUDGE_ACC_ST2 : 0) | + ((IsDlgButtonChecked(hwnd,IDC_CHECKST3)==BST_CHECKED) ? NUDGE_ACC_ST3 : 0) | + ((IsDlgButtonChecked(hwnd,IDC_CHECKST4)==BST_CHECKED) ? NUDGE_ACC_ST4 : 0) | + ((IsDlgButtonChecked(hwnd,IDC_CHECKST5)==BST_CHECKED) ? NUDGE_ACC_ST5 : 0) | + ((IsDlgButtonChecked(hwnd,IDC_CHECKST6)==BST_CHECKED) ? NUDGE_ACC_ST6 : 0) | + ((IsDlgButtonChecked(hwnd,IDC_CHECKST7)==BST_CHECKED) ? NUDGE_ACC_ST7 : 0) | + ((IsDlgButtonChecked(hwnd,IDC_CHECKST8)==BST_CHECKED) ? NUDGE_ACC_ST8 : 0) | + ((IsDlgButtonChecked(hwnd,IDC_CHECKST9)==BST_CHECKED) ? NUDGE_ACC_ST9 : 0) ; + + GetDlgItemText(hwnd,IDC_SENDTEXT,ActualNudge->senText,TEXT_LEN); + GetDlgItemText(hwnd,IDC_RECVTEXT,ActualNudge->recText,TEXT_LEN); + ActualNudge->Save(); + } + GlobalNudge.Save(); + } + } + case IDC_PROTOLIST: + switch (((LPNMHDR)lParam)->code) + { + case NM_CLICK: + { + TVHITTESTINFO ht = {0}; + + DWORD dwpos = GetMessagePos(); + POINTSTOPOINT(ht.pt, MAKEPOINTS(dwpos)); + MapWindowPoints(HWND_DESKTOP, ((LPNMHDR)lParam)->hwndFrom, &ht.pt, 1); + + TreeView_HitTest(((LPNMHDR)lParam)->hwndFrom, &ht); + /*if (TVHT_ONITEM & ht.flags) + CheckChange(hwnd,ht.hItem);*/ + if (TVHT_ONITEMSTATEICON & ht.flags) + CheckChange(hwnd,ht.hItem); + } + + case TVN_KEYDOWN: + if (((LPNMTVKEYDOWN) lParam)->wVKey == VK_SPACE) + CheckChange(hwnd, TreeView_GetSelection(((LPNMHDR)lParam)->hwndFrom)); + break; + + case TVN_SELCHANGED: + { + LPNMTREEVIEW pnmtv = (LPNMTREEVIEW) lParam; + if (pnmtv->itemNew.state & TVIS_SELECTED) + UpdateControls(hwnd); + } + break; + } + break; + } + break; + } + + return FALSE; +} + +void CheckChange(HWND hwnd, HTREEITEM hItem) +{ + HWND hLstView = GetDlgItem(hwnd, IDC_PROTOLIST); + bool isChecked = !TreeView_GetCheckState(hLstView, hItem); + + TreeView_SelectItem(hLstView, hItem); + + int proto = nProtocol; + if (GlobalNudge.useByProtocol) + { + proto = GetSelProto(hwnd, hItem); + ActualNudge = NULL; + for(NudgeElementList *n = NudgeList;n != NULL; n = n->next) + { + if(n->item.iProtoNumber == proto) + ActualNudge = &n->item; + } + } + else + ActualNudge = &DefaultNudge; + + if (ActualNudge)// fix NULL pointer then no nudge support protocols + ActualNudge->enabled = isChecked; + + UpdateControls(hwnd); +} + +void UpdateControls(HWND hwnd) +{ + int proto = nProtocol; + if (GlobalNudge.useByProtocol) + { + proto = GetSelProto(hwnd,NULL); + ActualNudge = NULL; + for(NudgeElementList *n = NudgeList;n != NULL; n = n->next) + { + if(n->item.iProtoNumber == proto) + ActualNudge = &n->item; + } + } + else + ActualNudge = &DefaultNudge; + + SetDlgItemInt(hwnd, IDC_SENDTIME, GlobalNudge.sendTimeSec,FALSE); + SetDlgItemInt(hwnd, IDC_RECVTIME, GlobalNudge.recvTimeSec,FALSE); + SetDlgItemInt(hwnd, IDC_RESENDDELAY, GlobalNudge.resendDelaySec,FALSE); + CheckDlgButton(hwnd, IDC_USEBYPROTOCOL, (WPARAM) GlobalNudge.useByProtocol); + + if (ActualNudge)// fix NULL pointer then no nudge support protocols + { + CheckDlgButton(hwnd, IDC_CHECKPOP, (WPARAM) ActualNudge->showPopup); + CheckDlgButton(hwnd, IDC_CHECKCLIST, (WPARAM) ActualNudge->shakeClist); + CheckDlgButton(hwnd, IDC_CHECKCHAT, (WPARAM) ActualNudge->shakeChat); + CheckDlgButton(hwnd, IDC_CHECKSTATUS, (WPARAM) ActualNudge->showStatus); + CheckDlgButton(hwnd, IDC_AUTORESEND, (WPARAM) ActualNudge->autoResend); + CheckDlgButton(hwnd, IDC_OPENMESSAGE, (WPARAM) ActualNudge->openMessageWindow); + CheckDlgButton(hwnd, IDC_OPENCONTACTLIST, (WPARAM) ActualNudge->openContactList); + CheckDlgButton(hwnd, IDC_IGNORE, (WPARAM) ActualNudge->useIgnoreSettings); + EnableWindow(GetDlgItem(hwnd,IDC_RESENDDELAY),ActualNudge->autoResend); + CheckDlgButton(hwnd,IDC_CHECKST0,ActualNudge->statusFlags & NUDGE_ACC_ST0 ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwnd,IDC_CHECKST1,ActualNudge->statusFlags & NUDGE_ACC_ST1 ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwnd,IDC_CHECKST2,ActualNudge->statusFlags & NUDGE_ACC_ST2 ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwnd,IDC_CHECKST3,ActualNudge->statusFlags & NUDGE_ACC_ST3 ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwnd,IDC_CHECKST4,ActualNudge->statusFlags & NUDGE_ACC_ST4 ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwnd,IDC_CHECKST5,ActualNudge->statusFlags & NUDGE_ACC_ST5 ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwnd,IDC_CHECKST6,ActualNudge->statusFlags & NUDGE_ACC_ST6 ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwnd,IDC_CHECKST7,ActualNudge->statusFlags & NUDGE_ACC_ST7 ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwnd,IDC_CHECKST8,ActualNudge->statusFlags & NUDGE_ACC_ST8 ? BST_CHECKED : BST_UNCHECKED); + CheckDlgButton(hwnd,IDC_CHECKST9,ActualNudge->statusFlags & NUDGE_ACC_ST9 ? BST_CHECKED : BST_UNCHECKED); + SetDlgItemText(hwnd,IDC_SENDTEXT,ActualNudge->senText); + SetDlgItemText(hwnd,IDC_RECVTEXT,ActualNudge->recText); + } + else + { + EnableWindow(GetDlgItem(hwnd,IDC_PROTOLIST),FALSE); + } +} + +int GetSelProto(HWND hwnd, HTREEITEM hItem) +{ + HWND hLstView = GetDlgItem(hwnd, IDC_PROTOLIST); + TVITEM tvi = {0}; + + tvi.mask = TVIF_IMAGE; + tvi.hItem = hItem == NULL ? TreeView_GetSelection(hLstView) : hItem; + + TreeView_GetItem(hLstView, &tvi); + + return tvi.iImage; +} \ No newline at end of file diff --git a/plugins/Nudge/src/options.h b/plugins/Nudge/src/options.h new file mode 100644 index 0000000000..68f648a0bb --- /dev/null +++ b/plugins/Nudge/src/options.h @@ -0,0 +1,14 @@ +extern HINSTANCE hInst; +extern NudgeElementList* NudgeList; +extern int nProtocol; +extern CNudgeElement DefaultNudge; +extern CShake shake; +extern CNudge GlobalNudge; + +static INT_PTR CALLBACK OptionsDlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam); +static INT_PTR CALLBACK DlgProcNudgeOpt(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam); +static INT_PTR CALLBACK DlgProcShakeOpt(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam); + +void UpdateControls(HWND hwnd); +int GetSelProto(HWND hwnd, HTREEITEM hItem); +void CheckChange(HWND hwnd, HTREEITEM hItem); diff --git a/plugins/Nudge/src/resource.h b/plugins/Nudge/src/resource.h new file mode 100644 index 0000000000..60a56388e2 --- /dev/null +++ b/plugins/Nudge/src/resource.h @@ -0,0 +1,89 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by resource.rc +// +#define IDD_DIALOG1 101 +#define IDI_NUDGE 102 +#define IDI_NUGDE_YAHOO 107 +#define IDI_NUDGE_IRC 109 +#define IDI_NUDGE_MSN 110 +#define IDI_NUDGE_TLEN 111 +#define IDI_NUDGE_META 113 +#define IDD_SHAKEOPT 126 +#define IDD_OPT_NUDGE 126 +#define IDD_OPT_SHAKE 128 +#define IDD_OPT_TRIGGER 129 +#define IDC_BUTTON1 1000 +#define IDC_PREVIEW 1000 +#define IDC_EDIT1 1001 +#define IDC_SENDTEXT 1001 +#define IDC_BUTTON2 1002 +#define IDC_SENDTEXT2 1002 +#define IDC_RECVTEXT 1002 +#define IDC_BUTTON3 1003 +#define IDC_BUTTON4 1004 +#define IDC_BUTTON5 1005 +#define IDC_BUTTON6 1006 +#define IDC_BUTTON7 1007 +#define IDC_USEWINCOLORS 1007 +#define IDC_LABEL_FN 1008 +#define IDC_LABEL_IMAGESIZE 1009 +#define IDC_SLIDER_CLIST 1009 +#define IDC_SNUMBER_CLIST 1009 +#define IDC_SLIDER_CHAT 1010 +#define IDC_SNUMBER_CHAT 1010 +#define IDC_LABEL_ERRSTATE 1011 +#define IDC_SSCALE_CLIST 1011 +#define IDC_LABEL_TOTALBLOCKS 1012 +#define IDC_LNUMBER_CLIST 1012 +#define IDC_LABEL_WRITTENBLOCKS 1013 +#define IDC_LABEL_RESULT 1013 +#define IDC_LNUMBER_CHAT 1013 +#define IDC_LSCALE_CLIST 1014 +#define IDC_SSCALE_CHAT 1015 +#define IDC_LSCALE_CHAT 1016 +#define IDC_CHECKCLIST 1018 +#define IDC_CHECKST0 1019 +#define IDC_CHECKST1 1020 +#define IDC_CHECKST2 1021 +#define IDC_CHECKST3 1022 +#define IDC_CHECKST4 1023 +#define IDC_CHECKST5 1024 +#define IDC_CHECKST6 1025 +#define IDC_CHECKST7 1026 +#define IDC_POPUPTEXTCOLOR 1027 +#define IDC_CHECKST8 1028 +#define IDC_CHECKST9 1029 +#define IDC_BGCOLOUR 1030 +#define IDC_PROTOLIST 1031 +#define IDC_TEXTCOLOUR 1032 +#define IDC_USEBYPROTOCOL 1033 +#define IDC_CHECKCHAT2 1034 +#define IDC_CHECKCHAT 1034 +#define IDC_CHECKCOL 1035 +#define IDC_CHECKEVENT 1035 +#define IDC_POPUPBACKCOLOR 1036 +#define IDC_CHECKPOP 1037 +#define IDC_POPUPTIME 1038 +#define IDC_SENDTIME 1039 +#define IDC_RECVTIME 1040 +#define IDC_TRIGGER_SHAKECLIST 1040 +#define IDC_CHECKEVENT2 1041 +#define IDC_CHECKSTATUS 1041 +#define IDC_TRIGGER_SHAKECHAT 1041 +#define IDC_AUTORESEND 1042 +#define IDC_RESENDDELAY 1043 +#define IDC_OPENMESSAGE 1044 +#define IDC_OPENCONTACTLIST 1046 +#define IDC_IGNORE 1047 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 114 +#define _APS_NEXT_COMMAND_VALUE 40001 +#define _APS_NEXT_CONTROL_VALUE 1048 +#define _APS_NEXT_SYMED_VALUE 101 +#endif +#endif diff --git a/plugins/Nudge/src/shake.cpp b/plugins/Nudge/src/shake.cpp new file mode 100644 index 0000000000..f396c4f535 --- /dev/null +++ b/plugins/Nudge/src/shake.cpp @@ -0,0 +1,189 @@ +#include "headers.h" +#include "shake.h" + +extern CShake shake; + +void CShake::Load(void) +{ + + Shaking = false; + ShakingChat = false; + nScaleClist = DBGetContactSettingDword(NULL, "Nudge", "ScaleClist", 5); + nScaleChat = DBGetContactSettingDword(NULL, "Nudge", "ScaleChat", 2); + nMoveClist = DBGetContactSettingDword(NULL, "Nudge", "MoveClist", 15); + nMoveChat = DBGetContactSettingDword(NULL, "Nudge", "MoveChat", 15); +} +void CShake::Save(void) +{ + DBWriteContactSettingDword(NULL, "Nudge", "ScaleClist", this->nScaleClist); + DBWriteContactSettingDword(NULL, "Nudge", "ScaleChat", this->nScaleChat); + DBWriteContactSettingDword(NULL, "Nudge", "MoveClist", this->nMoveClist); + DBWriteContactSettingDword(NULL, "Nudge", "MoveChat", this->nMoveChat); +} + +DWORD WINAPI ShakeChatWindow(LPVOID Param) +{ + HWND hWnd = (HWND) Param; + shake.ShakeChat(hWnd); + return 1; +} + +DWORD WINAPI ShakeClistWindow(LPVOID Param) +{ + HWND hWnd = (HWND) Param; + shake.ShakeClist(hWnd); + return 0; +} + +INT_PTR ShakeClist( WPARAM wParam, LPARAM lParam ) +{ + DWORD tid; + HWND hWnd = (HWND) CallService( MS_CLUI_GETHWND, 0, 0 ); + + CreateThread(NULL,0,ShakeClistWindow,(LPVOID) hWnd,0,&tid); + return 0; +} + +INT_PTR ShakeChat( WPARAM wParam, LPARAM lParam ) +{ + if (((HANDLE) wParam) == NULL) return -1; + + DWORD tid; + //char srmmName[100]; + MessageWindowData mwd; + MessageWindowInputData mwid; + + mwd.cbSize = sizeof(MessageWindowData); + mwd.hContact = Nudge_GethContact((HANDLE) wParam); + mwd.uFlags = MSG_WINDOW_UFLAG_MSG_BOTH; + + mwid.cbSize = sizeof(MessageWindowInputData); + mwid.hContact = mwd.hContact; + mwid.uFlags = MSG_WINDOW_UFLAG_MSG_BOTH; + + + CallService( MS_MSG_GETWINDOWDATA, (WPARAM)&mwid, (LPARAM)&mwd ); + //CallService(MS_MSG_GETWINDOWCLASS,(WPARAM)srmmName,(LPARAM)100 ); + + HWND parent; + HWND hWnd = mwd.hwndWindow; + while((parent = GetParent(hWnd)) != 0) hWnd = parent; // ensure we have the top level window (need parent window for scriver & tabsrmm) + + CreateThread(NULL,0,ShakeChatWindow,(LPVOID) hWnd,0,&tid); + return 0; +} + +/* + +int TriggerShakeClist( WPARAM wParam, LPARAM lParam ) +{ + DWORD tid; + HWND hWnd; + int flags; + flags = (int)wParam; + + if (!flags&ACT_PERFORM) + return 0; + + hWnd = (HWND) CallService( MS_CLUI_GETHWND, 0, 0 ); + + CreateThread(NULL,0,ShakeClistWindow,(LPVOID) hWnd,0,&tid); + return 0; +} + +int TriggerShakeChat( WPARAM wParam, LPARAM lParam ) +{ + DWORD tid; + HWND hWnd; + char srmmName[100]; + MessageWindowData mwd; + MessageWindowInputData mwid; + int flags; + flags = (int)wParam; + + if (!flags&ACT_PERFORM) + return 0; + + SPECIFICACTIONINFO *sai; + HANDLE hContact; + + + sai = (SPECIFICACTIONINFO *) lParam; + + if ( (sai->td != NULL) && (sai->td->dFlags&DF_CONTACT)) + hContact = sai->td->hContact; + else + return 0; + + mwd.cbSize = sizeof(MessageWindowData); + mwd.hContact = Nudge_GethContact((HANDLE) hContact); + mwd.uFlags = MSG_WINDOW_UFLAG_MSG_BOTH; + + mwid.cbSize = sizeof(MessageWindowInputData); + mwid.hContact = Nudge_GethContact((HANDLE) hContact); + mwid.uFlags = MSG_WINDOW_UFLAG_MSG_BOTH; + + CallService( MS_MSG_GETWINDOWDATA, (WPARAM)&mwid, (LPARAM)&mwd ); + CallService(MS_MSG_GETWINDOWCLASS,(WPARAM)srmmName,(LPARAM)100 ); + + if ( !strnicmp( srmmName,"tabSRMM ", 7 )) + hWnd = GetParent(GetParent(mwd.hwndWindow)); + + if ( !strnicmp( srmmName,"SRMM ", 4)) + hWnd = mwd.hwndWindow; + + if ( !strnicmp( srmmName,"Scriver ", 7 )) + hWnd = GetParent(mwd.hwndWindow); + + CreateThread(NULL,0,ShakeChatWindow,(LPVOID) hWnd,0,&tid); + return 0; +} +*/ + +int CShake::ShakeChat(HWND hWnd) +{ + if (!ShakingChat) + { + ShakingChat = true; + RECT rect; + GetWindowRect(hWnd, &rect); + for(int i = 0; i < nMoveChat; i++) + { + SetWindowPos(hWnd, 0, rect.left - nScaleChat, rect.top, 0, 0, SWP_NOSIZE); + Sleep(10); + SetWindowPos(hWnd, 0, rect.left, rect.top - nScaleChat, 0, 0, SWP_NOSIZE); + Sleep(10); + SetWindowPos(hWnd, 0, rect.left + nScaleChat, rect.top, 0, 0, SWP_NOSIZE); + Sleep(10); + SetWindowPos(hWnd, 0, rect.left, rect.top + nScaleChat, 0, 0, SWP_NOSIZE); + Sleep(10); + } + SetWindowPos(hWnd, 0, rect.left, rect.top, 0, 0, SWP_NOSIZE); //SWP_DRAWFRAME + ShakingChat = false; + } + return 0; +} + +int CShake::ShakeClist(HWND hWnd) +{ + if (!Shaking) + { + Shaking = true; + RECT rect; + GetWindowRect(hWnd, &rect); + for(int i = 0; i < nMoveClist; i++) + { + SetWindowPos(hWnd, 0, rect.left - nScaleClist, rect.top, 0, 0, SWP_NOSIZE); + Sleep(10); + SetWindowPos(hWnd, 0, rect.left, rect.top - nScaleClist, 0, 0, SWP_NOSIZE); + Sleep(10); + SetWindowPos(hWnd, 0, rect.left + nScaleClist, rect.top, 0, 0, SWP_NOSIZE); + Sleep(10); + SetWindowPos(hWnd, 0, rect.left, rect.top + nScaleClist, 0, 0, SWP_NOSIZE); + Sleep(10); + } + SetWindowPos(hWnd, 0, rect.left, rect.top, 0, 0, SWP_NOSIZE); + Shaking = false; + } + return 0; +} \ No newline at end of file diff --git a/plugins/Nudge/src/shake.h b/plugins/Nudge/src/shake.h new file mode 100644 index 0000000000..73e460cb41 --- /dev/null +++ b/plugins/Nudge/src/shake.h @@ -0,0 +1,27 @@ +#ifndef SHAKE_H +#define SHAKE_H + +class CShake +{ +public: + bool Shaking; + bool ShakingChat; + int nScaleClist; + int nScaleChat; + int nMoveClist; + int nMoveChat; + + void Load(void); + void Save(void); + int ShakeClist(HWND hWnd); + int ShakeChat(HWND hWnd); +}; + +INT_PTR ShakeClist(WPARAM,LPARAM); +INT_PTR ShakeChat(WPARAM,LPARAM); +/* +int TriggerShakeChat(WPARAM,LPARAM); +int TriggerShakeClist(WPARAM,LPARAM); +int TriggerAction(WPARAM,LPARAM);*/ + +#endif \ No newline at end of file -- cgit v1.2.3