summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-11-03 20:16:42 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-11-03 20:16:42 +0000
commitf12d8b56f2894e94491bd7424d69f595d285f01f (patch)
tree3f54d66c8c248bb456da1cb0c5cc31661f144e5f
parent1b1a54dc156bec90be3ddc337c17b4e67179d4ea (diff)
no more MS_CLIST_EXTRA_ADD_ICON in the application code
git-svn-id: http://svn.miranda-ng.org/main/trunk@2175 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--plugins/AuthState/res/authstate.rc5
-rw-r--r--plugins/AuthState/src/commonheaders.h7
-rw-r--r--plugins/AuthState/src/main.cpp86
-rw-r--r--plugins/AuthState/src/options.cpp140
-rw-r--r--plugins/AuthState/src/resource.h2
-rw-r--r--plugins/BuddyExpectator/src/BuddyExpectator.cpp6
-rw-r--r--plugins/BuddyExpectator/src/options.cpp50
-rw-r--r--plugins/Clist_modern/src/modern_extraimage.cpp10
-rw-r--r--plugins/Clist_mw/src/CLUIFrames/extraimage.cpp23
-rw-r--r--plugins/CountryFlags/res/resource.rc2
-rw-r--r--plugins/CountryFlags/src/extraimg.cpp257
-rw-r--r--plugins/CountryFlags/src/flags.h1
-rw-r--r--plugins/CountryFlags/src/resource.h1
-rw-r--r--plugins/Gender/res/gender.rc6
-rw-r--r--plugins/Gender/src/commonheaders.h1
-rw-r--r--plugins/Gender/src/main.cpp141
-rw-r--r--plugins/Gender/src/options.cpp128
-rw-r--r--plugins/Gender/src/resource.h4
-rw-r--r--plugins/ListeningTo/src/listeningto.cpp213
-rw-r--r--plugins/ListeningTo/src/options.cpp2
-rwxr-xr-xplugins/New_GPG/src/clist.cpp15
-rwxr-xr-xplugins/New_GPG/src/icons.cpp21
-rwxr-xr-xplugins/New_GPG/src/init.cpp5
-rw-r--r--plugins/UserInfoEx/src/Flags/svc_flags.cpp4
-rw-r--r--plugins/UserInfoEx/src/Flags/svc_flags.h9
-rw-r--r--plugins/UserInfoEx/src/svc_reminder.cpp118
-rw-r--r--plugins/WhenWasIt/src/commonheaders.h1
-rw-r--r--plugins/WhenWasIt/src/dlg_handlers.cpp568
-rw-r--r--plugins/WhenWasIt/src/hooked_events.cpp184
-rw-r--r--plugins/WhenWasIt/src/hooked_events.h1
-rw-r--r--plugins/WhenWasIt/src/icons.cpp31
-rw-r--r--plugins/WhenWasIt/src/icons.h2
-rw-r--r--plugins/WhenWasIt/src/notifiers.cpp207
-rw-r--r--plugins/WhenWasIt/src/notifiers.h4
-rw-r--r--plugins/WhenWasIt/src/services.cpp1
-rw-r--r--plugins/Zlib/zlib_10.vcxproj3
-rw-r--r--plugins/Zlib/zlib_10.vcxproj.filters5
-rw-r--r--protocols/AimOscar/src/aim.cpp8
-rw-r--r--protocols/AimOscar/src/theme.cpp121
-rw-r--r--protocols/AimOscar/src/theme.h2
-rw-r--r--protocols/AimOscar/src/utility.h1
-rw-r--r--protocols/JabberG/src/jabber.cpp1
-rw-r--r--protocols/JabberG/src/jabber.h2
-rw-r--r--protocols/JabberG/src/jabber_icolib.cpp54
-rw-r--r--protocols/JabberG/src/jabber_icolib.h5
-rw-r--r--protocols/JabberG/src/jabber_proto.h2
-rw-r--r--protocols/JabberG/src/jabber_xstatus.cpp49
-rw-r--r--protocols/MRA/src/Mra.h2
-rw-r--r--protocols/MRA/src/MraProto.cpp13
-rw-r--r--protocols/MRA/src/MraProto.h1
-rw-r--r--protocols/MRA/src/Mra_functions.cpp12
-rw-r--r--protocols/MRA/src/Mra_svcs.cpp15
-rw-r--r--protocols/Quotes/src/ExtraImages.cpp122
-rw-r--r--protocols/Quotes/src/ExtraImages.h1
-rw-r--r--protocols/Quotes/src/Forex.cpp7
55 files changed, 776 insertions, 1906 deletions
diff --git a/plugins/AuthState/res/authstate.rc b/plugins/AuthState/res/authstate.rc
index 071abc75d3..50f067b1c0 100644
--- a/plugins/AuthState/res/authstate.rc
+++ b/plugins/AuthState/res/authstate.rc
@@ -79,8 +79,6 @@ IDD_AUTHSTATE_OPT DIALOGEX 0, 0, 314, 240
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
- COMBOBOX IDC_ADVICON,95,127,78,81,CBS_DROPDOWNLIST | WS_VSCROLL |
- WS_TABSTOP,WS_EX_CLIENTEDGE
CONTROL "Show Auth icon",IDC_AUTHICON,"Button",BS_AUTOCHECKBOX |
BS_LEFTTEXT | WS_TABSTOP,76,93,167,18
CONTROL "Show Grant icon",IDC_GRANTICON,"Button",BS_AUTOCHECKBOX |
@@ -93,9 +91,6 @@ BEGIN
CONTROL "Show icons only for recently added contacts",
IDC_ICONSFORRECENT,"Button",BS_AUTOCHECKBOX |
BS_LEFTTEXT | WS_TABSTOP,76,78,167,17
- RTEXT "* Restart of Miranda required",IDC_STATIC,58,171,210,11
- LTEXT "Note: if you still don't see the icons try changing icon slot. Perhaps its used by some other plugin.",
- IDC_NOTICE,54,143,198,20
END
diff --git a/plugins/AuthState/src/commonheaders.h b/plugins/AuthState/src/commonheaders.h
index 3e8e85c51c..7d199a835b 100644
--- a/plugins/AuthState/src/commonheaders.h
+++ b/plugins/AuthState/src/commonheaders.h
@@ -53,13 +53,10 @@
static const int DefaultSlot = EXTRA_ICON_ADV2;
#define MODULENAME "AuthState"
-extern int onOptInitialise(WPARAM wParam, LPARAM lParam);
-extern int onExtraImageApplying(WPARAM wParam, LPARAM lParam);
-extern int onExtraImageListRebuild(WPARAM wParam, LPARAM lParam);
+int onOptInitialise(WPARAM wParam, LPARAM lParam);
+int onExtraImageApplying(WPARAM wParam, LPARAM lParam);
extern HINSTANCE g_hInst;
-extern IconExtraColumn g_IECAuth, g_IECGrant, g_IECAuthGrant, g_IECClear;
-extern INT clistIcon;
extern byte bUseAuthIcon, bUseGrantIcon, bContactMenuItem, bIconsForRecentContacts;
extern HANDLE hExtraIcon;
diff --git a/plugins/AuthState/src/main.cpp b/plugins/AuthState/src/main.cpp
index 842d2c912b..0917db41fb 100644
--- a/plugins/AuthState/src/main.cpp
+++ b/plugins/AuthState/src/main.cpp
@@ -33,11 +33,6 @@ static HANDLE hUserMenu = NULL;
HANDLE hExtraIcon = NULL;
int hLangpack;
-IconExtraColumn g_IECAuth = {0};
-IconExtraColumn g_IECGrant = {0};
-IconExtraColumn g_IECAuthGrant = {0};
-IconExtraColumn g_IECClear = {0};
-INT clistIcon = 0; //Icon slot to use
BYTE bUseAuthIcon = 0, bUseGrantIcon = 0, bContactMenuItem = 0, bIconsForRecentContacts = 0, bUseAuthGroup = 0;
enum {
@@ -101,50 +96,16 @@ int onExtraImageApplying(WPARAM wParam, LPARAM lParam)
if (wParam == NULL)
return 0;
- int usedIcon;
- usedIcon = getIconToUse((HANDLE) wParam, lParam);
+ int usedIcon = getIconToUse((HANDLE) wParam, lParam);
- if (hExtraIcon != NULL)
- {
- const char *icon;
- switch (usedIcon)
- {
- case icon_both: icon = "authgrant_icon"; break;
- case icon_grant: icon = "grant_icon"; break;
- case icon_auth: icon = "auth_icon"; break;
- default: icon = NULL; break;
- }
- ExtraIcon_SetIcon(hExtraIcon, (HANDLE)wParam, icon);
- }
- else
- {
- switch (usedIcon)
- {
- case icon_both: CallService(MS_CLIST_EXTRA_SET_ICON, wParam, (LPARAM) &g_IECAuthGrant); break;
- case icon_grant: CallService(MS_CLIST_EXTRA_SET_ICON, wParam, (LPARAM) &g_IECGrant); break;
- case icon_auth: CallService(MS_CLIST_EXTRA_SET_ICON, wParam, (LPARAM) &g_IECAuth); break;
- default: CallService(MS_CLIST_EXTRA_SET_ICON, wParam, (LPARAM) &g_IECClear); break;
- }
- }
-
- return 0;
-}
-
-int onExtraImageListRebuild(WPARAM wParam, LPARAM lParam)
-{
- g_IECAuth.cbSize = sizeof(IconExtraColumn);
- g_IECAuth.ColumnType = clistIcon;
- g_IECGrant.cbSize = sizeof(IconExtraColumn);
- g_IECGrant.ColumnType = clistIcon;
- g_IECAuthGrant.cbSize = sizeof(IconExtraColumn);
- g_IECAuthGrant.ColumnType = clistIcon;
-
- if (ServiceExists(MS_CLIST_EXTRA_ADD_ICON)) {
- g_IECAuth.hImage = (HANDLE)CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM)Skin_GetIcon("auth_icon"), 0);
- g_IECGrant.hImage = (HANDLE)CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM)Skin_GetIcon("grant_icon"), 0);
- g_IECAuthGrant.hImage = (HANDLE)CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM)Skin_GetIcon("authgrant_icon"), 0);
+ const char *icon;
+ switch (usedIcon) {
+ case icon_both: icon = "authgrant_icon"; break;
+ case icon_grant: icon = "grant_icon"; break;
+ case icon_auth: icon = "auth_icon"; break;
+ default: icon = NULL; break;
}
-
+ ExtraIcon_SetIcon(hExtraIcon, (HANDLE)wParam, icon);
return 0;
}
@@ -175,11 +136,7 @@ INT_PTR onAuthMenuSelected(WPARAM wParam, LPARAM lParam)
byte enabled = DBGetContactSettingByte((HANDLE)wParam,"AuthState","ShowIcons",1);
DBWriteContactSettingByte((HANDLE)wParam, MODULENAME, "ShowIcons", !enabled);
- if (enabled)
- CallService(MS_CLIST_EXTRA_SET_ICON, (WPARAM) wParam, (LPARAM) &g_IECClear);
- else
- onExtraImageApplying(wParam, 0);
-
+ onExtraImageApplying(wParam, 0);
return 0;
}
@@ -242,20 +199,14 @@ int onModulesLoaded(WPARAM wParam,LPARAM lParam)
// extra icons
hExtraIcon = ExtraIcon_Register("authstate", "Auth State", "authgrant_icon");
- if (hExtraIcon != NULL) {
- // Set initial value for all contacts
- HANDLE hContact = db_find_first();
- while (hContact != NULL) {
- onExtraImageApplying((WPARAM)hContact, 1);
- hContact = db_find_next(hContact);
- }
- }
- else {
- hIcoLibIconsChanged = HookEvent(ME_SKIN2_ICONSCHANGED, onExtraImageListRebuild);
- hHookExtraIconsRebuild = HookEvent(ME_CLIST_EXTRA_LIST_REBUILD, onExtraImageListRebuild);
- hHookExtraIconsApply = HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY, onExtraImageApplying);
- onExtraImageListRebuild(0,0);
+
+ // Set initial value for all contacts
+ HANDLE hContact = db_find_first();
+ while (hContact != NULL) {
+ onExtraImageApplying((WPARAM)hContact, 1);
+ hContact = db_find_next(hContact);
}
+
hOptInitialise = HookEvent(ME_OPT_INITIALISE, onOptInitialise);
if (bContactMenuItem) hPrebuildContactMenu = HookEvent(ME_CLIST_PREBUILDCONTACTMENU, onPrebuildContactMenu);
@@ -290,7 +241,6 @@ extern "C" int __declspec(dllexport) Load(void)
hSystemOKToExit = HookEvent(ME_SYSTEM_OKTOEXIT,onSystemOKToExit);
hContactSettingChanged = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, onContactSettingChanged);
- clistIcon = DBGetContactSettingByte(NULL, MODULENAME, "AdvancedIcon", DefaultSlot);
bUseAuthIcon = DBGetContactSettingByte(NULL, MODULENAME, "EnableAuthIcon", 1);
bUseGrantIcon = DBGetContactSettingByte(NULL, MODULENAME, "EnableGrantIcon", 1);
bContactMenuItem = DBGetContactSettingByte(NULL, MODULENAME, "MenuItem", 0);
@@ -311,10 +261,6 @@ extern "C" int __declspec(dllexport) Load(void)
hUserMenu = Menu_AddContactMenuItem(&mi);
}
- g_IECClear.cbSize = sizeof(IconExtraColumn);
- g_IECClear.ColumnType = clistIcon;
- g_IECClear.hImage = (HANDLE) -1;
-
return 0;
}
diff --git a/plugins/AuthState/src/options.cpp b/plugins/AuthState/src/options.cpp
index cef1db78b8..bc4a3dcf1e 100644
--- a/plugins/AuthState/src/options.cpp
+++ b/plugins/AuthState/src/options.cpp
@@ -25,112 +25,56 @@
#include "commonheaders.h"
-const TCHAR* szAdvancedIcons[] = {_T("Email"), _T("Protocol"), _T("SMS"), _T("Advanced 1"), _T("Advanced 2"), _T("Web"), _T("Client"), _T("Advanced 3"), _T("Advanced 4"), _T("Advanced 5")};
-const INT cAdvancedIcons = sizeof(szAdvancedIcons) / sizeof(szAdvancedIcons[0]);
-
INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
static int bInitializing = 0;
- switch (msg)
- {
- case WM_INITDIALOG:
- {
- TranslateDialogDefault(hwndDlg);
- bInitializing = 1;
- if (hExtraIcon==NULL)
- {
- for (int i = 0; i < cAdvancedIcons; i++)
- {
- SendMessage(GetDlgItem(hwndDlg, IDC_ADVICON), CB_ADDSTRING, 0, (LPARAM) TranslateTS(szAdvancedIcons[i]));
- }
- SendMessage(GetDlgItem(hwndDlg, IDC_ADVICON), CB_SETCURSEL, clistIcon-1, 0);
- }
- else
- {
- SendDlgItemMessage(hwndDlg,IDC_NOTICE, WM_SETTEXT,0,(LPARAM)TranslateT("Extraicons plugin is used, use Contact list > Extraicons for customize."));
- ShowWindow(GetDlgItem(hwndDlg, IDC_NOTICE), SW_SHOW);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ADVICON), 0);
- }
-
- CheckDlgButton(hwndDlg, IDC_AUTHICON, bUseAuthIcon ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_GRANTICON, bUseGrantIcon ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_ENABLEMENUITEM, bContactMenuItem ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_ICONSFORRECENT, bIconsForRecentContacts ? BST_CHECKED : BST_UNCHECKED);
-
- bInitializing = 0;
- return TRUE;
- }
-
- case WM_COMMAND:
- {
- switch (LOWORD(wParam))
- {
- case IDC_AUTHICON:
- case IDC_GRANTICON:
- case IDC_ENABLEMENUITEM:
- case IDC_ICONSFORRECENT:
- {
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
- }
- case IDC_ADVICON:
- {
- if ((HIWORD(wParam) == EN_CHANGE) && (!bInitializing) || (HIWORD(wParam) == CBN_SELENDOK))
- {
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- }
- break;
- }
- }
- break;
+ switch (msg) {
+ case WM_INITDIALOG:
+ TranslateDialogDefault(hwndDlg);
+ bInitializing = 1;
+
+ CheckDlgButton(hwndDlg, IDC_AUTHICON, bUseAuthIcon ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_GRANTICON, bUseGrantIcon ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_ENABLEMENUITEM, bContactMenuItem ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_ICONSFORRECENT, bIconsForRecentContacts ? BST_CHECKED : BST_UNCHECKED);
+
+ bInitializing = 0;
+ return TRUE;
+
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+ case IDC_AUTHICON:
+ case IDC_GRANTICON:
+ case IDC_ENABLEMENUITEM:
+ case IDC_ICONSFORRECENT:
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
}
-
- case WM_NOTIFY:
- {
- if (((LPNMHDR)lParam)->idFrom == 0)
- switch (((LPNMHDR)lParam)->code)
+ break;
+
+ case WM_NOTIFY:
+ if (((LPNMHDR)lParam)->idFrom == 0)
+ switch (((LPNMHDR)lParam)->code) {
+ case PSN_APPLY:
+ bUseAuthIcon = IsDlgButtonChecked(hwndDlg, IDC_AUTHICON);
+ bUseGrantIcon = IsDlgButtonChecked(hwndDlg, IDC_GRANTICON);
+ bContactMenuItem = IsDlgButtonChecked(hwndDlg, IDC_ENABLEMENUITEM);
+ bIconsForRecentContacts = IsDlgButtonChecked(hwndDlg, IDC_ICONSFORRECENT);
{
- case PSN_APPLY:
- {
- bUseAuthIcon = IsDlgButtonChecked(hwndDlg, IDC_AUTHICON);
- bUseGrantIcon = IsDlgButtonChecked(hwndDlg, IDC_GRANTICON);
- bContactMenuItem = IsDlgButtonChecked(hwndDlg, IDC_ENABLEMENUITEM);
- bIconsForRecentContacts = IsDlgButtonChecked(hwndDlg, IDC_ICONSFORRECENT);
-
- clistIcon = SendMessage(GetDlgItem(hwndDlg, IDC_ADVICON), CB_GETCURSEL, 0, 0);
- clistIcon++;
-
- HANDLE hContact = db_find_first();
- while (hContact)
- {
- CallService(MS_CLIST_EXTRA_SET_ICON, (WPARAM)hContact, (LPARAM)&g_IECClear);
- hContact = db_find_next(hContact);
- }
-
- g_IECClear.ColumnType = clistIcon;
- onExtraImageListRebuild(0,0);
-
- hContact = db_find_first();
- while (hContact)
- {
- onExtraImageApplying((WPARAM)hContact,0);
- hContact = db_find_next(hContact);
- }
-
- //Store options values to DB
- DBWriteContactSettingByte(NULL, MODULENAME, "AdvancedIcon", clistIcon);
- DBWriteContactSettingByte(NULL, MODULENAME, "EnableAuthIcon", bUseAuthIcon);
- DBWriteContactSettingByte(NULL, MODULENAME, "EnableGrantIcon", bUseGrantIcon);
- DBWriteContactSettingByte(NULL, MODULENAME, "MenuItem", bContactMenuItem);
- DBWriteContactSettingByte(NULL, MODULENAME, "EnableOnlyForRecent", bIconsForRecentContacts);
+ HANDLE hContact = db_find_first();
+ while (hContact) {
+ onExtraImageApplying((WPARAM)hContact,0);
+ hContact = db_find_next(hContact);
}
- return TRUE;
}
- }
-
- case WM_DESTROY:
- break;
+ //Store options values to DB
+ DBWriteContactSettingByte(NULL, MODULENAME, "EnableAuthIcon", bUseAuthIcon);
+ DBWriteContactSettingByte(NULL, MODULENAME, "EnableGrantIcon", bUseGrantIcon);
+ DBWriteContactSettingByte(NULL, MODULENAME, "MenuItem", bContactMenuItem);
+ DBWriteContactSettingByte(NULL, MODULENAME, "EnableOnlyForRecent", bIconsForRecentContacts);
+ return TRUE;
+ }
}
return FALSE;
}
diff --git a/plugins/AuthState/src/resource.h b/plugins/AuthState/src/resource.h
index 49c8f2fb6a..9e3a220c78 100644
--- a/plugins/AuthState/src/resource.h
+++ b/plugins/AuthState/src/resource.h
@@ -6,12 +6,10 @@
#define IDI_GRANT 102
#define IDI_AUTHGRANT 103
#define IDD_AUTHSTATE_OPT 103
-#define IDC_ADVICON 1001
#define IDC_AUTHICON 1002
#define IDC_GRANTICON 1003
#define IDC_ENABLEMENUITEM 1005
#define IDC_ICONSFORRECENT 1006
-#define IDC_NOTICE 1009
// Next default values for new objects
//
diff --git a/plugins/BuddyExpectator/src/BuddyExpectator.cpp b/plugins/BuddyExpectator/src/BuddyExpectator.cpp
index 044808c013..a1fa12e3b7 100644
--- a/plugins/BuddyExpectator/src/BuddyExpectator.cpp
+++ b/plugins/BuddyExpectator/src/BuddyExpectator.cpp
@@ -160,7 +160,8 @@ LRESULT CALLBACK MissYouPopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPA
if (!DBGetContactSettingByte(PUGetContact(hWnd), MODULE_NAME, "MissYouNotifyAlways", 0))
{
DBWriteContactSettingByte(PUGetContact(hWnd), MODULE_NAME, "MissYou", 0);
- if (options.MissYouIcon) CallService(MS_CLIST_EXTRA_SET_ICON, (WPARAM) PUGetContact(hWnd), (LPARAM) &g_IECClear);
+ if (options.MissYouIcon)
+ CallService(MS_CLIST_EXTRA_SET_ICON, (WPARAM) PUGetContact(hWnd), (LPARAM) &g_IECClear);
}
PUDeletePopUp(hWnd);
}
@@ -172,7 +173,8 @@ LRESULT CALLBACK MissYouPopupDlgProc(HWND hWnd, UINT message, WPARAM wParam, LPA
if (wParam == 1)
{
DBWriteContactSettingByte(PUGetContact(hWnd), MODULE_NAME, "MissYou", 0);
- if (options.MissYouIcon) CallService(MS_CLIST_EXTRA_SET_ICON, (WPARAM) PUGetContact(hWnd), (LPARAM) &g_IECClear);
+ if (options.MissYouIcon)
+ CallService(MS_CLIST_EXTRA_SET_ICON, (WPARAM) PUGetContact(hWnd), (LPARAM) &g_IECClear);
PUDeletePopUp(hWnd);
}
break;
diff --git a/plugins/BuddyExpectator/src/options.cpp b/plugins/BuddyExpectator/src/options.cpp
index 7ca92deeca..23c0acdea9 100644
--- a/plugins/BuddyExpectator/src/options.cpp
+++ b/plugins/BuddyExpectator/src/options.cpp
@@ -38,22 +38,22 @@ Options options;
void LoadOptions()
{
- options.iAbsencePeriod = DBGetContactSettingDword(NULL, MODULE_NAME, "iAbsencePeriod", 14);
- options.iAbsencePeriod2 = DBGetContactSettingDword(NULL, MODULE_NAME, "iAbsencePeriod2", 30 * 3);
+ options.iAbsencePeriod = DBGetContactSettingDword(NULL, MODULE_NAME, "iAbsencePeriod", 14);
+ options.iAbsencePeriod2 = DBGetContactSettingDword(NULL, MODULE_NAME, "iAbsencePeriod2", 30 * 3);
options.iSilencePeriod = DBGetContactSettingDword(NULL, MODULE_NAME, "iSilencePeriod", 30);
- options.iShowPopUp = DBGetContactSettingByte(NULL, MODULE_NAME, "iShowPopUp", 1);
- options.iShowEvent = DBGetContactSettingByte(NULL, MODULE_NAME, "iShowEvent", 0);
- options.iShowUDetails = DBGetContactSettingByte(NULL, MODULE_NAME, "iShowUDetails", 0);
- options.iShowMessageWindow = DBGetContactSettingByte(NULL, MODULE_NAME, "iShowMessageWindow", 1);
- options.iPopUpColorBack = DBGetContactSettingDword(NULL, MODULE_NAME, "iPopUpColorBack", DEF_COLOR_BACK);
- options.iPopUpColorFore = DBGetContactSettingDword(NULL, MODULE_NAME, "iPopUpColorFore", DEF_COLOR_FORE);
+ options.iShowPopUp = DBGetContactSettingByte(NULL, MODULE_NAME, "iShowPopUp", 1);
+ options.iShowEvent = DBGetContactSettingByte(NULL, MODULE_NAME, "iShowEvent", 0);
+ options.iShowUDetails = DBGetContactSettingByte(NULL, MODULE_NAME, "iShowUDetails", 0);
+ options.iShowMessageWindow = DBGetContactSettingByte(NULL, MODULE_NAME, "iShowMessageWindow", 1);
+ options.iPopUpColorBack = DBGetContactSettingDword(NULL, MODULE_NAME, "iPopUpColorBack", DEF_COLOR_BACK);
+ options.iPopUpColorFore = DBGetContactSettingDword(NULL, MODULE_NAME, "iPopUpColorFore", DEF_COLOR_FORE);
options.iUsePopupColors = DBGetContactSettingByte(NULL, MODULE_NAME, "iUsePopupColors", 0);
options.iUseWinColors = DBGetContactSettingByte(NULL, MODULE_NAME, "iUseWinColors", 0);
- options.iPopUpDelay = DBGetContactSettingByte(NULL, MODULE_NAME, "iPopUpDelay", 0);
+ options.iPopUpDelay = DBGetContactSettingByte(NULL, MODULE_NAME, "iPopUpDelay", 0);
- options.iShowPopUp2 = DBGetContactSettingByte(NULL, MODULE_NAME, "iShowPopUp2", 1);
- options.iShowEvent2 = DBGetContactSettingByte(NULL, MODULE_NAME, "iShowEvent2", 0);
- options.action2 = (GoneContactAction)DBGetContactSettingByte(NULL, MODULE_NAME, "Action2", (BYTE)GCA_NOACTION);
+ options.iShowPopUp2 = DBGetContactSettingByte(NULL, MODULE_NAME, "iShowPopUp2", 1);
+ options.iShowEvent2 = DBGetContactSettingByte(NULL, MODULE_NAME, "iShowEvent2", 0);
+ options.action2 = (GoneContactAction)DBGetContactSettingByte(NULL, MODULE_NAME, "Action2", (BYTE)GCA_NOACTION);
options.notifyFirstOnline = DBGetContactSettingByte(NULL, MODULE_NAME, "bShowFirstSight", 0) ? true : false;
options.hideInactive = DBGetContactSettingByte(NULL, MODULE_NAME, "bHideInactive", 0) ? true : false;
options.enableMissYou = DBGetContactSettingByte(NULL, MODULE_NAME, "bMissYouEnabled", 1) ? true : false;
@@ -62,17 +62,17 @@ void LoadOptions()
void SaveOptions()
{
- DBWriteContactSettingDword(NULL, MODULE_NAME, "iAbsencePeriod", options.iAbsencePeriod);
- DBWriteContactSettingDword(NULL, MODULE_NAME, "iAbsencePeriod2", options.iAbsencePeriod2);
+ DBWriteContactSettingDword(NULL, MODULE_NAME, "iAbsencePeriod", options.iAbsencePeriod);
+ DBWriteContactSettingDword(NULL, MODULE_NAME, "iAbsencePeriod2", options.iAbsencePeriod2);
DBWriteContactSettingDword(NULL, MODULE_NAME, "iSilencePeriod", options.iSilencePeriod);
- DBWriteContactSettingByte(NULL, MODULE_NAME, "iShowPopUp", options.iShowPopUp);
- DBWriteContactSettingByte(NULL, MODULE_NAME, "iShowEvent", options.iShowEvent);
- DBWriteContactSettingByte(NULL, MODULE_NAME, "iShowUDetails", options.iShowUDetails);
- DBWriteContactSettingByte(NULL, MODULE_NAME, "iShowMessageWindow", options.iShowMessageWindow);
-
- DBWriteContactSettingByte(NULL, MODULE_NAME, "iShowPopUp2", options.iShowPopUp2);
- DBWriteContactSettingByte(NULL, MODULE_NAME, "iShowEvent2", options.iShowEvent2);
- DBWriteContactSettingByte(NULL, MODULE_NAME, "Action2", (BYTE)options.action2);
+ DBWriteContactSettingByte(NULL, MODULE_NAME, "iShowPopUp", options.iShowPopUp);
+ DBWriteContactSettingByte(NULL, MODULE_NAME, "iShowEvent", options.iShowEvent);
+ DBWriteContactSettingByte(NULL, MODULE_NAME, "iShowUDetails", options.iShowUDetails);
+ DBWriteContactSettingByte(NULL, MODULE_NAME, "iShowMessageWindow", options.iShowMessageWindow);
+
+ DBWriteContactSettingByte(NULL, MODULE_NAME, "iShowPopUp2", options.iShowPopUp2);
+ DBWriteContactSettingByte(NULL, MODULE_NAME, "iShowEvent2", options.iShowEvent2);
+ DBWriteContactSettingByte(NULL, MODULE_NAME, "Action2", (BYTE)options.action2);
DBWriteContactSettingByte(NULL, MODULE_NAME, "bShowFirstSight", options.notifyFirstOnline ? 1 : 0);
DBWriteContactSettingByte(NULL, MODULE_NAME, "bHideInactive", options.hideInactive ? 1 : 0);
DBWriteContactSettingByte(NULL, MODULE_NAME, "bMissYouEnabled", options.enableMissYou ? 1 : 0);
@@ -81,11 +81,11 @@ void SaveOptions()
void SavePopupOptions()
{
- DBWriteContactSettingDword(NULL, MODULE_NAME, "iPopUpColorBack", options.iPopUpColorBack);
- DBWriteContactSettingDword(NULL, MODULE_NAME, "iPopUpColorFore", options.iPopUpColorFore);
+ DBWriteContactSettingDword(NULL, MODULE_NAME, "iPopUpColorBack", options.iPopUpColorBack);
+ DBWriteContactSettingDword(NULL, MODULE_NAME, "iPopUpColorFore", options.iPopUpColorFore);
DBWriteContactSettingByte(NULL, MODULE_NAME, "iUsePopupColors", options.iUsePopupColors);
DBWriteContactSettingByte(NULL, MODULE_NAME, "iUseWinColors", options.iUseWinColors);
- DBWriteContactSettingByte(NULL, MODULE_NAME, "iPopUpDelay", options.iPopUpDelay);
+ DBWriteContactSettingByte(NULL, MODULE_NAME, "iPopUpDelay", options.iPopUpDelay);
}
/**
diff --git a/plugins/Clist_modern/src/modern_extraimage.cpp b/plugins/Clist_modern/src/modern_extraimage.cpp
index 05f0efc970..aca86ad0ea 100644
--- a/plugins/Clist_modern/src/modern_extraimage.cpp
+++ b/plugins/Clist_modern/src/modern_extraimage.cpp
@@ -31,12 +31,6 @@ INT_PTR AddIconToExtraImageList(WPARAM wParam,LPARAM lParam)
return (res > 254) ? -1 : res;
}
-void SetNewExtraColumnCount()
-{
- db_set_b(NULL, CLUIFrameModule, "EnabledColumnCount", (BYTE)EXTRACOLUMNCOUNT);
- SendMessage(pcli->hwndContactTree,CLM_SETEXTRACOLUMNS, EXTRACOLUMNCOUNT, 0);
-}
-
void ExtraImage_ReloadExtraIcons()
{
SendMessage(pcli->hwndContactTree,CLM_SETEXTRACOLUMNSSPACE,db_get_b(NULL,"CLUI","ExtraColumnSpace",18),0);
@@ -50,7 +44,7 @@ void ExtraImage_ReloadExtraIcons()
hWideExtraImageList = ImageList_Create(GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),ILC_COLOR32|ILC_MASK,1,256);
SendMessage(pcli->hwndContactTree,CLM_SETEXTRAIMAGELIST,(WPARAM)hWideExtraImageList,(LPARAM)hExtraImageList);
- SetNewExtraColumnCount();
+ SendMessage(pcli->hwndContactTree,CLM_SETEXTRACOLUMNS, EXTRACOLUMNCOUNT, 0);
NotifyEventHooks(g_CluiData.hEventExtraImageListRebuilding,0,0);
ImageCreated = TRUE;
}
@@ -66,7 +60,7 @@ void ExtraImage_SetAllExtraIcons(HWND hwndList,HANDLE hContact)
if (ImageCreated == FALSE)
ExtraImage_ReloadExtraIcons();
- SetNewExtraColumnCount();
+ SendMessage(pcli->hwndContactTree,CLM_SETEXTRACOLUMNS, EXTRACOLUMNCOUNT, 0);
if (hContact == NULL)
hContact = db_find_first();
diff --git a/plugins/Clist_mw/src/CLUIFrames/extraimage.cpp b/plugins/Clist_mw/src/CLUIFrames/extraimage.cpp
index d84b30a9fa..70f4560856 100644
--- a/plugins/Clist_mw/src/CLUIFrames/extraimage.cpp
+++ b/plugins/Clist_mw/src/CLUIFrames/extraimage.cpp
@@ -159,17 +159,6 @@ INT_PTR AddIconToExtraImageList(WPARAM wParam,LPARAM lParam)
return((int)ImageList_AddIcon(hExtraImageList,(HICON)wParam));
}
-void SetNewExtraColumnCount()
-{
- int newcount;
-
- GetVisColumns();
- newcount = colsum(0,EXTRACOLUMNCOUNT-1);
- DBWriteContactSettingByte(NULL,CLUIFrameModule,"EnabledColumnCount",(BYTE)newcount);
- EnabledColumnCount = newcount;
- SendMessage(pcli->hwndContactTree,CLM_SETEXTRACOLUMNS,EnabledColumnCount,0);
-}
-
int OnIconLibIconChanged(WPARAM wParam,LPARAM lParam)
{
HICON hicon;
@@ -221,9 +210,7 @@ void ReloadExtraIcons()
}
SendMessage(pcli->hwndContactTree,CLM_SETEXTRAIMAGELIST,0,(LPARAM)hExtraImageList);
-
- //SetAllExtraIcons(hImgList);
- SetNewExtraColumnCount();
+ SendMessage(pcli->hwndContactTree,CLM_SETEXTRACOLUMNS,EnabledColumnCount,0);
NotifyEventHooks(hExtraImageListRebuilding,0,0);
ImageCreated = TRUE;
}
@@ -233,7 +220,7 @@ void ClearExtraIcons();
void ReAssignExtraIcons()
{
ClearExtraIcons();
- SetNewExtraColumnCount();
+ SendMessage(pcli->hwndContactTree,CLM_SETEXTRACOLUMNS, EXTRACOLUMNCOUNT, 0);
SetAllExtraIcons(pcli->hwndContactTree,0);
SendMessage(pcli->hwndContactTree,CLM_AUTOREBUILD,0,0);
}
@@ -243,9 +230,7 @@ void ClearExtraIcons()
int i;
HANDLE hContact,hItem;
- //EnabledColumnCount = DBGetContactSettingByte(NULL,CLUIFrameModule,"EnabledColumnCount",5);
- //SendMessage(pcli->hwndContactTree,CLM_SETEXTRACOLUMNS,EnabledColumnCount,0);
- SetNewExtraColumnCount();
+ SendMessage(pcli->hwndContactTree,CLM_SETEXTRACOLUMNS, EXTRACOLUMNCOUNT, 0);
hContact = db_find_first();
do {
@@ -278,7 +263,7 @@ void SetAllExtraIcons(HWND hwndList,HANDLE hContact)
tick = GetTickCount();
if (ImageCreated == FALSE) ReloadExtraIcons();
- SetNewExtraColumnCount();
+ SendMessage(pcli->hwndContactTree,CLM_SETEXTRACOLUMNS, EXTRACOLUMNCOUNT, 0);
hasExtraIconsService = HasExtraIconsService();
if (!hasExtraIconsService) {
diff --git a/plugins/CountryFlags/res/resource.rc b/plugins/CountryFlags/res/resource.rc
index 4e0440e0e6..b1ebe9685f 100644
--- a/plugins/CountryFlags/res/resource.rc
+++ b/plugins/CountryFlags/res/resource.rc
@@ -74,8 +74,6 @@ BEGIN
WS_GROUP | WS_TABSTOP,12,27,206,10
LTEXT "In following contact list &column:",
IDC_TEXT_EXTRAIMGFLAGCOLUMN,24,42,110,8
- COMBOBOX IDC_COMBO_EXTRAIMGFLAGCOLUMN,135,40,77,117,
- CBS_DROPDOWNLIST | CBS_SORT | WS_VSCROLL | WS_TABSTOP
CONTROL "Use &unknown flag if the country can not be determined",
IDC_CHECK_USEUNKNOWNFLAG,"Button",BS_AUTOCHECKBOX |
WS_GROUP | WS_TABSTOP,12,77,206,10
diff --git a/plugins/CountryFlags/src/extraimg.cpp b/plugins/CountryFlags/src/extraimg.cpp
index 7c633ef8d1..c3397349fa 100644
--- a/plugins/CountryFlags/src/extraimg.cpp
+++ b/plugins/CountryFlags/src/extraimg.cpp
@@ -21,17 +21,11 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
/* Services */
static HANDLE hServiceDetectContactOrigin;
-/* Extra Image */
-static HANDLE hHookExtraRebuild,hHookExtraApply;
-/* Status Icon */
-static HANDLE hHookMsgWndEvent,hHookIconsChanged;
-/* Options */
-static HANDLE hHookOptInit,hHookSettingChanged;
+
/* Misc */
extern HINSTANCE hInst;
extern int nCountriesCount;
extern struct CountryListEntry *countries;
-static HANDLE hHookModulesLoaded;
/************************* Services *******************************/
@@ -55,50 +49,25 @@ static INT_PTR ServiceDetectContactOriginCountry(WPARAM wParam,LPARAM lParam)
#define EXTRAIMAGE_REFRESHDELAY 100 /* time for which setting changes are buffered */
-static HANDLE *phExtraImages;
-static BYTE idExtraColumn;
+static HANDLE hExtraIcon;
-static void CALLBACK SetExtraImage(LPARAM lParam)
+static void CALLBACK SetExtraImage(HANDLE hContact)
{
if ( !db_get_b(NULL, "Flags", "ShowExtraImgFlag", SETTING_SHOWEXTRAIMGFLAG_DEFAULT))
return;
- /* get contact's country */
- IconExtraColumn iec;
- iec.hImage = INVALID_HANDLE_VALUE;
- int countryNumber = ServiceDetectContactOriginCountry((WPARAM)lParam,0);
- /* get icon */
- if (phExtraImages != NULL) /* too early? */
- if (countryNumber != 0xFFFF || db_get_b(NULL,"Flags","UseUnknownFlag",SETTING_USEUNKNOWNFLAG_DEFAULT)) {
- int index=CountryNumberToIndex(countryNumber);
- /* icon not yet loaded? */
- if (phExtraImages[index] == INVALID_HANDLE_VALUE) {
- HICON hIcon = LoadFlagIcon(countryNumber);
- if (hIcon != NULL)
- phExtraImages[index]=(HANDLE)CallService(MS_CLIST_EXTRA_ADD_ICON,(WPARAM)hIcon,0);
- Skin_ReleaseIcon(hIcon); /* does NULL check */
- }
- iec.hImage=phExtraImages[index];
- }
- /* choose column */
- iec.cbSize=sizeof(iec);
- iec.ColumnType=idExtraColumn;
- CallService(MS_CLIST_EXTRA_SET_ICON,(WPARAM)lParam,(LPARAM)&iec);
+ int countryNumber = ServiceDetectContactOriginCountry((WPARAM)hContact, 0);
+ char szId[20];
+ wsprintfA(szId, (countryNumber == 0xFFFF) ? "%s0x%X" : "%s%i", "flags_", countryNumber);
+ ExtraIcon_SetIcon(hExtraIcon, hContact, szId);
}
// always call in context of main thread
static void RemoveExtraImages(void)
{
- /* choose column */
- IconExtraColumn iec;
- iec.cbSize = sizeof(iec);
- iec.ColumnType = idExtraColumn;
- iec.hImage = INVALID_HANDLE_VALUE;
- /* enum all contacts */
HANDLE hContact = db_find_first();
while (hContact != NULL) {
- /* invalidate icon */
- CallService(MS_CLIST_EXTRA_SET_ICON,(WPARAM)hContact,(LPARAM)&iec);
+ ExtraIcon_SetIcon(hExtraIcon, hContact, (HANDLE)0);
hContact = db_find_next(hContact);
}
}
@@ -106,19 +75,9 @@ static void RemoveExtraImages(void)
// always call in context of main thread
static void EnsureExtraImages(void)
{
- BYTE idMaxExtraCol,idExtraColumnNew;
- /* choose column */
- idMaxExtraCol=(BYTE)CallService(MS_CLUI_GETCAPS,0,CLUIF2_EXTRACOLUMNCOUNT); /* 1-based count */
- if (idMaxExtraCol == (BYTE)CallService(MS_CLUI_GETCAPS,0,CLUIF2_USEREXTRASTART)) /* same flags if not present */
- idMaxExtraCol=EXTRA_ICON_ADV2; /* zero if not present */
- idExtraColumnNew=DBGetContactSettingRangedByte(NULL,"Flags","ExtraImgFlagColumn",SETTING_EXTRAIMGFLAGCOLUMN_DEFAULT,1,idMaxExtraCol);
- /* clear previous column */
- if (idExtraColumnNew != idExtraColumn) RemoveExtraImages();
- idExtraColumn=idExtraColumnNew;
- /* enum all contacts */
HANDLE hContact = db_find_first();
while (hContact != NULL) {
- CallFunctionBuffered(SetExtraImage,(LPARAM)hContact,TRUE,EXTRAIMAGE_REFRESHDELAY);
+ SetExtraImage(hContact);
hContact = db_find_next(hContact);
}
}
@@ -131,26 +90,10 @@ static void CALLBACK UpdateExtraImages(LPARAM lParam)
RemoveExtraImages();
}
-static int ExtraListRebuild(WPARAM wParam,LPARAM lParam)
-{
- OutputDebugStringA("REBUILD EXTRA\n");
- /* invalidate icons */
- if (phExtraImages != NULL)
- for(int i=0; i < nCountriesCount; ++i)
- phExtraImages[i] = INVALID_HANDLE_VALUE;
- /* choose column */
- BYTE idMaxExtraCol = (BYTE)CallService(MS_CLUI_GETCAPS,0,CLUIF2_EXTRACOLUMNCOUNT); /* 1-based count */
- if (idMaxExtraCol == (BYTE)CallService(MS_CLUI_GETCAPS,0,CLUIF2_USEREXTRASTART)) /* same flags if not present */
- idMaxExtraCol=EXTRA_ICON_ADV2; /* zero if not present */
- idExtraColumn = DBGetContactSettingRangedByte(NULL,"Flags","ExtraImgFlagColumn",SETTING_EXTRAIMGFLAGCOLUMN_DEFAULT,1,idMaxExtraCol);
- return 0;
-}
-
static int ExtraImageApply(WPARAM wParam,LPARAM lParam)
{
- OutputDebugStringA("APPLY EXTRA\n");
if ( db_get_b(NULL,"Flags","ShowExtraImgFlag",SETTING_SHOWEXTRAIMGFLAG_DEFAULT))
- SetExtraImage((LPARAM)wParam); /* unbuffered */
+ SetExtraImage((HANDLE)wParam); /* unbuffered */
return 0;
}
@@ -267,93 +210,58 @@ static int StatusIconsChanged(WPARAM wParam,LPARAM lParam)
static INT_PTR CALLBACK ExtraImgOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lParam)
{
switch(msg) {
- case WM_INITDIALOG:
- TranslateDialogDefault(hwndDlg);
- /* init checkboxes */
- { BOOL val;
- /* Status Icon */
- if (ServiceExists(MS_MSG_ADDICON)) val=db_get_b(NULL,"Flags","ShowStatusIconFlag",SETTING_SHOWSTATUSICONFLAG_DEFAULT) != 0;
- else EnableWindow(GetDlgItem(hwndDlg,IDC_CHECK_SHOWSTATUSICONFLAG),val=FALSE);
- CheckDlgButton(hwndDlg,IDC_CHECK_SHOWSTATUSICONFLAG,val);
- /* Extra Image */
- if (ServiceExists(MS_CLIST_EXTRA_ADD_ICON)) val=db_get_b(NULL,"Flags","ShowExtraImgFlag",SETTING_SHOWEXTRAIMGFLAG_DEFAULT) != 0;
- else EnableWindow(GetDlgItem(hwndDlg,IDC_CHECK_SHOWEXTRAIMGFLAG),val=FALSE);
- CheckDlgButton(hwndDlg,IDC_CHECK_SHOWEXTRAIMGFLAG,val);
- /* Unknown Flag */
- val=db_get_b(NULL,"Flags","UseUnknownFlag",SETTING_USEUNKNOWNFLAG_DEFAULT) != 0;
- CheckDlgButton(hwndDlg,IDC_CHECK_USEUNKNOWNFLAG,val);
- /* IP-to-country */
- val=db_get_b(NULL,"Flags","UseIpToCountry",SETTING_USEIPTOCOUNTRY_DEFAULT) != 0;
- CheckDlgButton(hwndDlg,IDC_CHECK_USEIPTOCOUNTRY,val);
- }
- /* init combobox */
- { HWND hwndCombo;
- TCHAR szItem[64];
- BYTE idColumn,idSavedColumn;
- BYTE idMaxExtraCol,idAdvExtraColStart;
- int index;
- hwndCombo=GetDlgItem(hwndDlg,IDC_COMBO_EXTRAIMGFLAGCOLUMN);
- idSavedColumn=db_get_b(NULL,"Flags","ExtraImgFlagColumn",SETTING_EXTRAIMGFLAGCOLUMN_DEFAULT);
- idMaxExtraCol=(BYTE)CallService(MS_CLUI_GETCAPS,0,CLUIF2_EXTRACOLUMNCOUNT); /* 1-based count */
- idAdvExtraColStart=(BYTE)CallService(MS_CLUI_GETCAPS,0,CLUIF2_USEREXTRASTART); /* 1-based id */
- /* init */
- SendMessage(hwndCombo,CB_SETLOCALE,(LCID)CallService(MS_LANGPACK_GETLOCALE,0,0),0); /* for sort order */
- SendMessage(hwndCombo,CB_INITSTORAGE,idMaxExtraCol-idAdvExtraColStart+3,(idMaxExtraCol-idAdvExtraColStart+3)*SIZEOF(szItem));
- /* Advanced #1,#2 */
- { const BYTE columnIds[]={EXTRA_ICON_ADV1,EXTRA_ICON_ADV2};
- for(idColumn=0;idColumn<SIZEOF(columnIds);++idColumn) {
- mir_sntprintf(szItem,SIZEOF(szItem),TranslateT("Advanced #%u"),idColumn+1); /* buffer safe */
- index=SendMessage(hwndCombo,CB_ADDSTRING,0,(LPARAM)szItem);
- if (index != LB_ERR) {
- SendMessage(hwndCombo,CB_SETITEMDATA,index,columnIds[idColumn]);
- if (idColumn == 0 || columnIds[idColumn] == idSavedColumn) SendMessage(hwndCombo,CB_SETCURSEL,index,0);
- }
- }
- }
- /* Advanced #3+: clist_modern */
- if (idMaxExtraCol != idAdvExtraColStart) /* same flags if not present */
- for(idColumn=idAdvExtraColStart;idColumn<=idMaxExtraCol;++idColumn) {
- mir_sntprintf(szItem,SIZEOF(szItem),TranslateT("Advanced #%u"),idColumn-idAdvExtraColStart+3); /* buffer safe */
- index=SendMessage(hwndCombo,CB_ADDSTRING,0,(LPARAM)szItem);
- if (index != LB_ERR) {
- SendMessage(hwndCombo,CB_SETITEMDATA,index,idColumn);
- if (idColumn == idSavedColumn) SendMessage(hwndCombo,CB_SETCURSEL,index,0);
- }
- }
- }
- SendMessage(hwndDlg,M_ENABLE_SUBCTLS,0,0);
- return TRUE; /* default focus */
- case M_ENABLE_SUBCTLS:
- { BOOL checked=IsDlgButtonChecked(hwndDlg,IDC_CHECK_SHOWEXTRAIMGFLAG);
+ case WM_INITDIALOG:
+ TranslateDialogDefault(hwndDlg);
+ /* init checkboxes */
+ {
+ BOOL val;
+ /* Status Icon */
+ if (ServiceExists(MS_MSG_ADDICON)) val=db_get_b(NULL,"Flags","ShowStatusIconFlag",SETTING_SHOWSTATUSICONFLAG_DEFAULT) != 0;
+ else EnableWindow(GetDlgItem(hwndDlg,IDC_CHECK_SHOWSTATUSICONFLAG),val=FALSE);
+ CheckDlgButton(hwndDlg,IDC_CHECK_SHOWSTATUSICONFLAG,val);
+ /* Extra Image */
+ val=db_get_b(NULL,"Flags","ShowExtraImgFlag",SETTING_SHOWEXTRAIMGFLAG_DEFAULT) != 0;
+ CheckDlgButton(hwndDlg,IDC_CHECK_SHOWEXTRAIMGFLAG,val);
+ /* Unknown Flag */
+ val=db_get_b(NULL,"Flags","UseUnknownFlag",SETTING_USEUNKNOWNFLAG_DEFAULT) != 0;
+ CheckDlgButton(hwndDlg,IDC_CHECK_USEUNKNOWNFLAG,val);
+ /* IP-to-country */
+ val=db_get_b(NULL,"Flags","UseIpToCountry",SETTING_USEIPTOCOUNTRY_DEFAULT) != 0;
+ CheckDlgButton(hwndDlg,IDC_CHECK_USEIPTOCOUNTRY,val);
+ }
+ SendMessage(hwndDlg,M_ENABLE_SUBCTLS,0,0);
+ return TRUE; /* default focus */
+
+ case M_ENABLE_SUBCTLS:
+ {
+ BOOL checked = IsDlgButtonChecked(hwndDlg,IDC_CHECK_SHOWEXTRAIMGFLAG);
EnableWindow(GetDlgItem(hwndDlg,IDC_TEXT_EXTRAIMGFLAGCOLUMN),checked);
- EnableWindow(GetDlgItem(hwndDlg,IDC_COMBO_EXTRAIMGFLAGCOLUMN),checked);
- if (!checked) checked=IsDlgButtonChecked(hwndDlg,IDC_CHECK_SHOWSTATUSICONFLAG);
+ if (!checked)
+ checked = IsDlgButtonChecked(hwndDlg,IDC_CHECK_SHOWSTATUSICONFLAG);
EnableWindow(GetDlgItem(hwndDlg,IDC_CHECK_USEUNKNOWNFLAG),checked);
EnableWindow(GetDlgItem(hwndDlg,IDC_CHECK_USEIPTOCOUNTRY),checked);
return TRUE;
}
- case WM_COMMAND:
- PostMessage(hwndDlg,M_ENABLE_SUBCTLS,0,0);
- PostMessage(GetParent(hwndDlg),PSM_CHANGED,0,0); /* enable apply */
- return FALSE;
- case WM_NOTIFY:
- switch(((NMHDR*)lParam)->code) {
- case PSN_APPLY: /* setting change hook will pick these up */
- DBWriteContactSettingByte(NULL,"Flags","UseUnknownFlag",(BYTE)(IsDlgButtonChecked(hwndDlg,IDC_CHECK_USEUNKNOWNFLAG) != 0));
- DBWriteContactSettingByte(NULL,"Flags","UseIpToCountry",(BYTE)(IsDlgButtonChecked(hwndDlg,IDC_CHECK_USEIPTOCOUNTRY) != 0));
- /* Status Icon */
- if (IsWindowEnabled(GetDlgItem(hwndDlg,IDC_CHECK_SHOWSTATUSICONFLAG)))
- DBWriteContactSettingByte(NULL,"Flags","ShowStatusIconFlag",(BYTE)(IsDlgButtonChecked(hwndDlg,IDC_CHECK_SHOWSTATUSICONFLAG) != 0));
- /* Extra Image */
- if (IsWindowEnabled(GetDlgItem(hwndDlg,IDC_CHECK_SHOWEXTRAIMGFLAG)))
- DBWriteContactSettingByte(NULL,"Flags","ShowExtraImgFlag",(BYTE)(IsDlgButtonChecked(hwndDlg,IDC_CHECK_SHOWEXTRAIMGFLAG) != 0));
- { int index;
- index=SendDlgItemMessage(hwndDlg,IDC_COMBO_EXTRAIMGFLAGCOLUMN,CB_GETCURSEL,0,0);
- if (index != LB_ERR) DBWriteContactSettingByte(NULL,"Flags","ExtraImgFlagColumn",(BYTE)SendDlgItemMessage(hwndDlg,IDC_COMBO_EXTRAIMGFLAGCOLUMN,CB_GETITEMDATA,index,0));
- }
- return TRUE;
- }
- break;
+
+ case WM_COMMAND:
+ PostMessage(hwndDlg,M_ENABLE_SUBCTLS,0,0);
+ PostMessage(GetParent(hwndDlg),PSM_CHANGED,0,0); /* enable apply */
+ return FALSE;
+
+ case WM_NOTIFY:
+ switch(((NMHDR*)lParam)->code) {
+ case PSN_APPLY: /* setting change hook will pick these up */
+ DBWriteContactSettingByte(NULL,"Flags","UseUnknownFlag",(BYTE)(IsDlgButtonChecked(hwndDlg,IDC_CHECK_USEUNKNOWNFLAG) != 0));
+ DBWriteContactSettingByte(NULL,"Flags","UseIpToCountry",(BYTE)(IsDlgButtonChecked(hwndDlg,IDC_CHECK_USEIPTOCOUNTRY) != 0));
+ /* Status Icon */
+ if (IsWindowEnabled(GetDlgItem(hwndDlg,IDC_CHECK_SHOWSTATUSICONFLAG)))
+ DBWriteContactSettingByte(NULL,"Flags","ShowStatusIconFlag",(BYTE)(IsDlgButtonChecked(hwndDlg,IDC_CHECK_SHOWSTATUSICONFLAG) != 0));
+ /* Extra Image */
+ if (IsWindowEnabled(GetDlgItem(hwndDlg,IDC_CHECK_SHOWEXTRAIMGFLAG)))
+ DBWriteContactSettingByte(NULL,"Flags","ShowExtraImgFlag",(BYTE)(IsDlgButtonChecked(hwndDlg,IDC_CHECK_SHOWEXTRAIMGFLAG) != 0));
+ return TRUE;
+ }
+ break;
}
return FALSE;
}
@@ -399,8 +307,7 @@ static int ExtraImgSettingChanged(WPARAM wParam,LPARAM lParam)
!lstrcmpA(dbcws->szSetting,"Country") ||
!lstrcmpA(dbcws->szSetting,"CompanyCountry")) {
/* Extra Image */
- if (ServiceExists(MS_CLIST_EXTRA_SET_ICON))
- CallFunctionBuffered(SetExtraImage,(LPARAM)wParam,TRUE,EXTRAIMAGE_REFRESHDELAY);
+ SetExtraImage((HANDLE)wParam);
/* Status Icon */
if (ServiceExists(MS_MSG_ADDICON))
CallFunctionBuffered(UpdateStatusIcons,0,FALSE,STATUSICON_REFRESHDELAY);
@@ -415,26 +322,13 @@ static int ExtraImgModulesLoaded(WPARAM wParam,LPARAM lParam)
/* Options */
if (ServiceExists("DBEditorpp/RegisterSingleModule"))
CallService("DBEditorpp/RegisterSingleModule",(WPARAM)"Flags",0);
+
/* Extra Image */
- if (ServiceExists(MS_CLIST_EXTRA_SET_ICON)) {
- int i;
- BYTE idMaxExtraCol;
- phExtraImages=(HANDLE*)mir_alloc(nCountriesCount*sizeof(HANDLE));
- /* invalidate icons */
- if (phExtraImages != NULL)
- for(i=0;i<nCountriesCount;++i)
- phExtraImages[i]=INVALID_HANDLE_VALUE;
- /* choose column */
- idMaxExtraCol=(BYTE)CallService(MS_CLUI_GETCAPS,0,CLUIF2_EXTRACOLUMNCOUNT); /* 1-based count */
- if (idMaxExtraCol == (BYTE)CallService(MS_CLUI_GETCAPS,0,CLUIF2_USEREXTRASTART)) /* same flags if not present */
- idMaxExtraCol=EXTRA_ICON_ADV2; /* zero if not present */
- idExtraColumn=DBGetContactSettingRangedByte(NULL,"Flags","ExtraImgFlagColumn",SETTING_EXTRAIMGFLAGCOLUMN_DEFAULT,1,idMaxExtraCol);
- /* hook */
- hHookExtraRebuild=HookEvent(ME_CLIST_EXTRA_LIST_REBUILD,ExtraListRebuild);
- hHookExtraApply=HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY,ExtraImageApply);
- }
+ hExtraIcon = ExtraIcon_Register("flags_extra", "Country flag");
+ HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY,ExtraImageApply);
+
/* Status Icon */
- hHookMsgWndEvent=HookEvent(ME_MSG_WINDOWEVENT,MsgWndEvent);
+ HookEvent(ME_MSG_WINDOWEVENT,MsgWndEvent);
return 0;
}
@@ -443,33 +337,16 @@ void InitExtraImg(void)
/* Services */
hServiceDetectContactOrigin=CreateServiceFunction(MS_FLAGS_DETECTCONTACTORIGINCOUNTRY,ServiceDetectContactOriginCountry);
/* Misc */
- hHookModulesLoaded=HookEvent(ME_SYSTEM_MODULESLOADED,ExtraImgModulesLoaded);
- /* Extra Image */
- phExtraImages=NULL;
- hHookExtraRebuild=hHookExtraApply=NULL;
+ HookEvent(ME_SYSTEM_MODULESLOADED,ExtraImgModulesLoaded);
/* Status icon */
- hHookMsgWndEvent=NULL;
- hHookIconsChanged=HookEvent(ME_SKIN2_ICONSCHANGED,StatusIconsChanged);
+ HookEvent(ME_SKIN2_ICONSCHANGED,StatusIconsChanged);
/* Options */
- hHookOptInit=HookEvent(ME_OPT_INITIALISE,ExtraImgOptInit);
- hHookSettingChanged=HookEvent(ME_DB_CONTACT_SETTINGCHANGED,ExtraImgSettingChanged);
+ HookEvent(ME_OPT_INITIALISE,ExtraImgOptInit);
+ HookEvent(ME_DB_CONTACT_SETTINGCHANGED,ExtraImgSettingChanged);
}
void UninitExtraImg(void)
{
/* Services */
DestroyServiceFunction(hServiceDetectContactOrigin);
- /* Misc */
- UnhookEvent(hHookModulesLoaded);
- /* Extra Image */
- UnhookEvent(hHookSettingChanged);
- UnhookEvent(hHookExtraRebuild);
- UnhookEvent(hHookExtraApply);
- mir_free(phExtraImages); /* does NULL check */
- /* Status icon */
- UnhookEvent(hHookMsgWndEvent);
- UnhookEvent(hHookIconsChanged);
- /* Options */
- UnhookEvent(hHookOptInit);
- UnhookEvent(hHookSettingChanged);
}
diff --git a/plugins/CountryFlags/src/flags.h b/plugins/CountryFlags/src/flags.h
index 464dcfae54..e5a693cd07 100644
--- a/plugins/CountryFlags/src/flags.h
+++ b/plugins/CountryFlags/src/flags.h
@@ -38,6 +38,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <m_options.h>
#include <m_contacts.h>
#include <m_protocols.h>
+#include <m_extraicons.h>
#define FLAGS_NOHELPERFUNCTIONS
#include "m_flags.h"
#include "resource.h"
diff --git a/plugins/CountryFlags/src/resource.h b/plugins/CountryFlags/src/resource.h
index a2cd0496d8..fff651792c 100644
--- a/plugins/CountryFlags/src/resource.h
+++ b/plugins/CountryFlags/src/resource.h
@@ -8,7 +8,6 @@
#define IDC_CHECK_SHOWSTATUSICONFLAG 1001
#define IDC_CHECK_SHOWEXTRAIMGFLAG 1002
#define IDC_TEXT_EXTRAIMGFLAGCOLUMN 1003
-#define IDC_COMBO_EXTRAIMGFLAGCOLUMN 1004
#define IDC_CHECK_USEUNKNOWNFLAG 1005
#define IDC_CHECK_USEIPTOCOUNTRY 1006
diff --git a/plugins/Gender/res/gender.rc b/plugins/Gender/res/gender.rc
index 7907593e0b..8497a110e9 100644
--- a/plugins/Gender/res/gender.rc
+++ b/plugins/Gender/res/gender.rc
@@ -79,15 +79,9 @@ IDD_GENDER_OPT DIALOGEX 0, 0, 314, 240
STYLE DS_SETFONT | DS_FIXEDSYS | WS_CHILD
FONT 8, "MS Shell Dlg", 0, 0, 0x0
BEGIN
- COMBOBOX IDC_ADVICON,95,102,78,81,CBS_DROPDOWNLIST | WS_VSCROLL |
- WS_TABSTOP,WS_EX_CLIENTEDGE
GROUPBOX "Plugin settings",IDC_STATIC,46,78,222,100
- RTEXT "Use",IDC_USE_L,56,104,33,12
- LTEXT "slot to draw the icon",IDC_SLOT_L,179,104,76,17
CONTROL "Enable menu items",IDC_MENUITEMS,"Button",
BS_AUTOCHECKBOX | WS_TABSTOP,76,122,167,12
- LTEXT "Note: if you still don't see the icons try changing icon slot. Perhaps its used by some other plugin.",
- IDC_NOTE_L,53,152,200,18
CONTROL "Draw an icon when gender info not found",
IDC_DRAWUNDEFICON,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,
76,138,167,12
diff --git a/plugins/Gender/src/commonheaders.h b/plugins/Gender/src/commonheaders.h
index bdea1613da..1971484888 100644
--- a/plugins/Gender/src/commonheaders.h
+++ b/plugins/Gender/src/commonheaders.h
@@ -59,7 +59,6 @@
#include "m_metacontacts.h"
#include "m_extraicons.h"
-static const int DefaultSlot = EXTRA_ICON_ADV2;
#define MODULENAME "Gender"
#endif //COMMHEADERS_H
diff --git a/plugins/Gender/src/main.cpp b/plugins/Gender/src/main.cpp
index 9f8c46f623..7a3d2297d7 100644
--- a/plugins/Gender/src/main.cpp
+++ b/plugins/Gender/src/main.cpp
@@ -27,19 +27,12 @@
HINSTANCE g_hInst;
-static HANDLE hHookModulesLoaded = NULL, hSystemOKToExit = NULL, hOptInitialise = NULL, hIcoLibIconsChanged = NULL;
-static HANDLE hHookExtraIconsRebuild = NULL, hHookExtraIconsApply = NULL, hContactMenu = NULL;
-static HANDLE hContactMenuMale = NULL, hContactMenuFemale = NULL, hContactMenuNotDef = NULL, hHookPrebuildContactMenu = NULL;
+static HANDLE hContactMenu = NULL, hContactMenuMale = NULL, hContactMenuFemale = NULL, hContactMenuNotDef = NULL;
static HANDLE hSetMale = NULL, hSetFemale = NULL, hSetUndef = NULL, hGenderGetIcon = NULL;
HANDLE g_hExtraIcon = NULL;
HANDLE g_hIconMale, g_hIconFemale, g_hIconMenu;
-IconExtraColumn g_IECMale = {0};
-IconExtraColumn g_IECFemale = {0};
-IconExtraColumn g_IECUndef = {0};
-IconExtraColumn g_IECClear = {0};
-int clistIcon = 0; // Icon slot to use
byte bEnableClistIcon = 1; // do we need clist icon?
byte bDrawNoGenderIcon = 0; // enable icon when no info?
byte bContactMenuItems = 1; // do we need a contact menu items?
@@ -79,74 +72,35 @@ extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD miranda
void setIcon(HANDLE hContact, unsigned int gender)
{
- if (g_hExtraIcon != NULL)
- {
- char *ico;
- switch (gender)
- {
- case 77: ico = "male_icon"; break;
- case 70: ico = "female_icon"; break;
- default: ico = (bDrawNoGenderIcon ? "menu_icon" : NULL); break;
- }
- ExtraIcon_SetIcon(g_hExtraIcon, hContact, ico);
- }
- else
- {
- IconExtraColumn *col;
- switch (gender)
- {
- case 77: col = &g_IECMale; break;
- case 70: col = &g_IECFemale; break;
- default: col = (bDrawNoGenderIcon ? &g_IECUndef : &g_IECClear); break;
- }
- CallService(MS_CLIST_EXTRA_SET_ICON, (WPARAM)hContact, (LPARAM)col);
+ char *ico;
+ switch (gender) {
+ case 77: ico = "male_icon"; break;
+ case 70: ico = "female_icon"; break;
+ default: ico = (bDrawNoGenderIcon ? "menu_icon" : NULL); break;
}
+ ExtraIcon_SetIcon(g_hExtraIcon, hContact, ico);
}
-int onExtraImageApplying(WPARAM wParam, LPARAM lParam)
+int applyExtraImage(HANDLE hContact)
{
- if (g_hExtraIcon == NULL && !bEnableClistIcon) return 0;
+ if (!bEnableClistIcon) return 0;
- HANDLE hContact = (HANDLE)wParam;
- if (bMetaAvail)
- {
- HANDLE hMetacontact = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, wParam, 0);
- if (hMetacontact != NULL) hContact = hMetacontact;
+ if (bMetaAvail) {
+ HANDLE hMetacontact = (HANDLE)CallService(MS_MC_GETMOSTONLINECONTACT, (WPARAM)hContact, 0);
+ if (hMetacontact != NULL)
+ hContact = hMetacontact;
}
- char *proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, wParam, 0);
- if (!proto) return 0;
+ char *proto = (char *)CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM)hContact, 0);
+ if (!proto)
+ return 0;
- if (DBGetContactSettingByte((HANDLE)wParam, proto, "ChatRoom", 0)) return 0;
+ if ( DBGetContactSettingByte(hContact, proto, "ChatRoom", 0))
+ return 0;
unsigned int gender = DBGetContactSettingByte(hContact, "UserInfo", "Gender", DBGetContactSettingByte(hContact, proto, "Gender", 0));
setIcon(hContact, gender);
- if ((HANDLE)wParam != hContact)
- setIcon((HANDLE)wParam, gender);
-
- return 0;
-}
-
-int onExtraImageListRebuild(WPARAM wParam, LPARAM lParam)
-{
- g_IECMale.cbSize = sizeof(IconExtraColumn);
- g_IECMale.ColumnType = clistIcon;
- g_IECFemale.cbSize = sizeof(IconExtraColumn);
- g_IECFemale.ColumnType = clistIcon;
- g_IECUndef.cbSize = sizeof(IconExtraColumn);
- g_IECUndef.ColumnType = clistIcon;
-
- if (ServiceExists(MS_CLIST_EXTRA_ADD_ICON))
- {
- if(hIcoLibIconsChanged)
- {
- g_IECMale.hImage = (HANDLE)CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM)Skin_GetIconByHandle(g_hIconMale), 0);
- g_IECFemale.hImage = (HANDLE)CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM)Skin_GetIconByHandle(g_hIconFemale), 0);
- g_IECUndef.hImage = (HANDLE)CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM)Skin_GetIconByHandle(g_hIconMenu), 0);
- }
- }
-
return 0;
}
@@ -240,14 +194,14 @@ INT_PTR onSetFemale(WPARAM wParam,LPARAM lParam)
INT_PTR onSetUndef(WPARAM wParam,LPARAM lParam)
{
DBDeleteContactSetting((HANDLE)wParam, "UserInfo", "Gender");
- onExtraImageApplying(wParam, 0);
+ applyExtraImage((HANDLE)wParam);
int metasnum = (bMetaAvail ? CallService(MS_MC_GETNUMCONTACTS,wParam,0) : 0);
for(int i=0; i<metasnum; i++)
{
HANDLE hContact = (HANDLE)CallService(MS_MC_GETSUBCONTACT, wParam, i);
DBDeleteContactSetting(hContact, "UserInfo", "Gender");
- onExtraImageApplying((WPARAM)hContact, 0);
+ applyExtraImage(hContact);
}
return 0;
@@ -255,8 +209,9 @@ INT_PTR onSetUndef(WPARAM wParam,LPARAM lParam)
int onModulesLoaded(WPARAM wParam,LPARAM lParam)
{
- hOptInitialise = HookEvent(ME_OPT_INITIALISE, onOptInitialise);
- if (bContactMenuItems) hHookPrebuildContactMenu = HookEvent(ME_CLIST_PREBUILDCONTACTMENU, onPrebuildContactMenu);
+ HookEvent(ME_OPT_INITIALISE, onOptInitialise);
+ if (bContactMenuItems)
+ HookEvent(ME_CLIST_PREBUILDCONTACTMENU, onPrebuildContactMenu);
bMetaAvail = (ServiceExists(MS_MC_GETMETACONTACT) != 0);
TCHAR szFile[MAX_PATH];
@@ -284,25 +239,13 @@ int onModulesLoaded(WPARAM wParam,LPARAM lParam)
sid.iDefaultIndex = -IDI_UNDEF;
g_hIconMenu = Skin_AddIcon(&sid);
- hIcoLibIconsChanged = HookEvent(ME_SKIN2_ICONSCHANGED, onExtraImageListRebuild);
-
+ // Adding clist extra icon
g_hExtraIcon = ExtraIcon_Register("gender", "Gender", "menu_icon");
- if (g_hExtraIcon != NULL)
- {
- HANDLE hContact = db_find_first();
- while (hContact != NULL)
- {
- onExtraImageApplying((WPARAM) hContact, 0);
- hContact = db_find_next(hContact);
- }
- }
- else
- {
- hHookExtraIconsRebuild = HookEvent(ME_CLIST_EXTRA_LIST_REBUILD, onExtraImageListRebuild);
- hHookExtraIconsApply = HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY, onExtraImageApplying);
-
- onExtraImageListRebuild(0,0);
+ HANDLE hContact = db_find_first();
+ while (hContact != NULL) {
+ applyExtraImage(hContact);
+ hContact = db_find_next(hContact);
}
// Adding menu items, submenu even if clist supports that
@@ -371,53 +314,29 @@ int onModulesLoaded(WPARAM wParam,LPARAM lParam)
int onSystemOKToExit(WPARAM wParam,LPARAM lParam)
{
- UnhookEvent(hHookModulesLoaded);
- UnhookEvent(hHookExtraIconsRebuild);
- UnhookEvent(hHookExtraIconsApply);
- UnhookEvent(hHookPrebuildContactMenu);
- UnhookEvent(hOptInitialise);
- UnhookEvent(hSystemOKToExit);
- if (hIcoLibIconsChanged)
- UnhookEvent(hIcoLibIconsChanged);
-
DestroyServiceFunction(hSetMale);
DestroyServiceFunction(hSetFemale);
DestroyServiceFunction(hSetUndef);
DestroyServiceFunction(hGenderGetIcon);
-
- if (hIcoLibIconsChanged) {
- Skin_ReleaseIcon("menu_icon");
- Skin_ReleaseIcon("male_icon");
- Skin_ReleaseIcon("female_icon");
- }
-
return 0;
}
extern "C" int __declspec(dllexport) Load(void)
{
-
mir_getLP(&pluginInfo);
- hHookModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, onModulesLoaded);
- hSystemOKToExit = HookEvent(ME_SYSTEM_OKTOEXIT,onSystemOKToExit);
+ HookEvent(ME_SYSTEM_MODULESLOADED, onModulesLoaded);
+ HookEvent(ME_SYSTEM_OKTOEXIT,onSystemOKToExit);
bEnableClistIcon = DBGetContactSettingByte(NULL, MODULENAME, "ClistIcon", 1);
bContactMenuItems = DBGetContactSettingByte(NULL, MODULENAME, "MenuItems", 1);
bDrawNoGenderIcon = DBGetContactSettingByte(NULL, MODULENAME, "NoGenderIcon", 0);
-
hSetMale = CreateServiceFunction("Gender/MenuItemSetMale", onSetMale);
hSetFemale = CreateServiceFunction("Gender/MenuItemSetFemale", onSetFemale);
hSetUndef = CreateServiceFunction("Gender/MenuItemSetUndef", onSetUndef);
- clistIcon = DBGetContactSettingByte(NULL, MODULENAME, "AdvancedIcon", DefaultSlot);
- g_IECClear.cbSize = sizeof(IconExtraColumn);
- g_IECClear.ColumnType = clistIcon;
- g_IECClear.hImage = (HANDLE) -1;
-
hGenderGetIcon = CreateServiceFunction(MS_GENDER_GETICON, GetIcon);
-
return 0;
}
diff --git a/plugins/Gender/src/options.cpp b/plugins/Gender/src/options.cpp
index c6537e4ca2..a7c5c244bd 100644
--- a/plugins/Gender/src/options.cpp
+++ b/plugins/Gender/src/options.cpp
@@ -25,126 +25,56 @@
#include "commonheaders.h"
+int applyExtraImage(HANDLE hContact);
+
extern HINSTANCE g_hInst;
-extern int onExtraImageApplying(WPARAM wParam, LPARAM lParam);
-extern int onExtraImageListRebuild(WPARAM wParam, LPARAM lParam);
extern IconExtraColumn g_IECClear;
extern int clistIcon;
extern HANDLE g_hExtraIcon;
extern byte bContactMenuItems, bEnableClistIcon, bDrawNoGenderIcon;
-const TCHAR *szAdvancedIcons[] = {LPGENT("Email"), LPGENT("Protocol"), LPGENT("SMS"), LPGENT("Advanced 1"), LPGENT("Advanced 2"), LPGENT("Web"), LPGENT("Client"), LPGENT("Advanced 3"), LPGENT("Advanced 4"), LPGENT("Advanced 5")};
-const int cAdvancedIcons = sizeof(szAdvancedIcons) / sizeof(szAdvancedIcons[0]);
INT_PTR CALLBACK DlgProcOptions(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
static int bInitializing = 0;
- switch (msg)
- {
- case WM_INITDIALOG:
- {
- TranslateDialogDefault(hwndDlg);
- bInitializing = 1;
- if (g_hExtraIcon == NULL)
- {
- SendMessage(GetDlgItem(hwndDlg, IDC_ADVICON), CB_ADDSTRING, 0, (LPARAM) TranslateT("Disabled"));
- for (int i = 0; i < cAdvancedIcons; i++)
- {
- SendMessage(GetDlgItem(hwndDlg, IDC_ADVICON), CB_ADDSTRING, 0, (LPARAM) TranslateTS(szAdvancedIcons[i]));
- }
-
- if (bEnableClistIcon)
- SendMessage(GetDlgItem(hwndDlg, IDC_ADVICON), CB_SETCURSEL, clistIcon, 0);
- else
- SendMessage(GetDlgItem(hwndDlg, IDC_ADVICON), CB_SETCURSEL, 0, 0);
- }
- else
- {
- ShowWindow(GetDlgItem(hwndDlg, IDC_USE_L), SW_HIDE);
- ShowWindow(GetDlgItem(hwndDlg, IDC_ADVICON), SW_HIDE);
- ShowWindow(GetDlgItem(hwndDlg, IDC_SLOT_L), SW_HIDE);
- ShowWindow(GetDlgItem(hwndDlg, IDC_NOTE_L), SW_HIDE);
- }
- CheckDlgButton(hwndDlg, IDC_MENUITEMS, DBGetContactSettingByte(NULL, MODULENAME, "MenuItems", 1) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(hwndDlg, IDC_DRAWUNDEFICON, bDrawNoGenderIcon ? BST_CHECKED : BST_UNCHECKED);
-
- bInitializing = 0;
- return TRUE;
- }
-
- case WM_COMMAND:
- {
- switch (LOWORD(wParam)) {
- case IDC_ADVICON:
- {
- if ((HIWORD(wParam) == EN_CHANGE) && (!bInitializing) || (HIWORD(wParam) == CBN_SELENDOK))
- {
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- }
- }
- break;
- case IDC_MENUITEMS:
- case IDC_DRAWUNDEFICON:
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
- }
+ switch (msg) {
+ case WM_INITDIALOG:
+ TranslateDialogDefault(hwndDlg);
+ bInitializing = 1;
+
+ CheckDlgButton(hwndDlg, IDC_MENUITEMS, DBGetContactSettingByte(NULL, MODULENAME, "MenuItems", 1) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(hwndDlg, IDC_DRAWUNDEFICON, bDrawNoGenderIcon ? BST_CHECKED : BST_UNCHECKED);
+
+ bInitializing = 0;
+ return TRUE;
+
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+ case IDC_MENUITEMS:
+ case IDC_DRAWUNDEFICON:
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
}
break;
-
- case WM_NOTIFY:
- {
- if (((LPNMHDR)lParam)->idFrom == 0)
- switch (((LPNMHDR)lParam)->code)
- {
- case PSN_APPLY:
- {
- HANDLE hContact;
+ case WM_NOTIFY:
+ if (((LPNMHDR)lParam)->idFrom == 0)
+ switch (((LPNMHDR)lParam)->code) {
+ case PSN_APPLY:
+ {
bDrawNoGenderIcon = IsDlgButtonChecked(hwndDlg, IDC_DRAWUNDEFICON);
-
- if (g_hExtraIcon == NULL)
- {
- clistIcon = SendMessage(GetDlgItem(hwndDlg, IDC_ADVICON), CB_GETCURSEL, 0, 0);
- DBWriteContactSettingByte(NULL, MODULENAME, "AdvancedIcon", clistIcon);
-
- if (bEnableClistIcon)
- {
- hContact = db_find_first();
- while (hContact)
- {
- CallService(MS_CLIST_EXTRA_SET_ICON, (WPARAM)hContact, (LPARAM)&g_IECClear);
- hContact = db_find_next(hContact);
- }
- }
-
- bEnableClistIcon = (clistIcon != 0);
-
- if (bEnableClistIcon)
- {
- g_IECClear.ColumnType = clistIcon;
- onExtraImageListRebuild(0,0);
- }
- }
- if (g_hExtraIcon != NULL || bEnableClistIcon)
- {
- hContact = db_find_first();
- while (hContact)
- {
- onExtraImageApplying((WPARAM)hContact,0);
- hContact = db_find_next(hContact);
- }
+ HANDLE hContact = db_find_first();
+ while (hContact) {
+ applyExtraImage(hContact);
+ hContact = db_find_next(hContact);
}
-
+
DBWriteContactSettingByte(NULL, MODULENAME, "ClistIcon", bEnableClistIcon);
DBWriteContactSettingByte(NULL, MODULENAME, "NoGenderIcon", bDrawNoGenderIcon);
DBWriteContactSettingByte(NULL, MODULENAME, "MenuItems", IsDlgButtonChecked(hwndDlg, IDC_MENUITEMS));
}
return TRUE;
- }
}
-
- case WM_DESTROY:
- break;
}
return FALSE;
}
diff --git a/plugins/Gender/src/resource.h b/plugins/Gender/src/resource.h
index 8ea2786991..765b554966 100644
--- a/plugins/Gender/src/resource.h
+++ b/plugins/Gender/src/resource.h
@@ -6,12 +6,8 @@
#define IDI_MALE 101
#define IDI_FEMALE 102
#define IDI_UNDEF 103
-#define IDC_ADVICON 1001
#define IDC_MENUITEMS 1002
#define IDC_DRAWUNDEFICON 1003
-#define IDC_USE_L 1004
-#define IDC_SLOT_L 1005
-#define IDC_NOTE_L 1006
// Next default values for new objects
//
diff --git a/plugins/ListeningTo/src/listeningto.cpp b/plugins/ListeningTo/src/listeningto.cpp
index 6f0d89f20e..f1e72e1b29 100644
--- a/plugins/ListeningTo/src/listeningto.cpp
+++ b/plugins/ListeningTo/src/listeningto.cpp
@@ -61,16 +61,14 @@ static HANDLE hTTB = NULL;
static char *metacontacts_proto = NULL;
BOOL loaded = FALSE;
static UINT hTimer = 0;
-static HANDLE hExtraImage = NULL;
static DWORD lastInfoSetTime = 0;
-std::vector<ProtocolInfo> proto_itens;
+std::vector<ProtocolInfo> proto_items;
int ModulesLoaded(WPARAM wParam, LPARAM lParam);
int PreShutdown(WPARAM wParam, LPARAM lParam);
int PreBuildContactMenu(WPARAM wParam,LPARAM lParam);
int TopToolBarLoaded(WPARAM wParam, LPARAM lParam);
-int ClistExtraListRebuild(WPARAM wParam, LPARAM lParam);
int SettingChanged(WPARAM wParam,LPARAM lParam);
INT_PTR MainMenuClicked(WPARAM wParam, LPARAM lParam);
@@ -180,7 +178,7 @@ void UpdateGlobalStatusMenus()
clmi.flags = CMIM_FLAGS
| (enabled ? CMIF_CHECKED : 0)
| (opts.enable_sending ? 0 : CMIF_GRAYED);
- CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) proto_itens[0].hMenu, (LPARAM) &clmi);
+ CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM) proto_items[0].hMenu, (LPARAM) &clmi);
if (hTTB != NULL)
CallService(MS_TTB_SETBUTTONSTATE, (WPARAM) hTTB, (LPARAM) (enabled ? TTBST_PUSHED : TTBST_RELEASED));
@@ -198,11 +196,11 @@ struct compareFunc : std::binary_function<const ProtocolInfo, const ProtocolInfo
void RebuildMenu()
{
- std::sort(proto_itens.begin(), proto_itens.end(), compareFunc());
+ std::sort(proto_items.begin(), proto_items.end(), compareFunc());
- for (unsigned int i = 1; i < proto_itens.size(); i++)
+ for (unsigned int i = 1; i < proto_items.size(); i++)
{
- ProtocolInfo *info = &proto_itens[i];
+ ProtocolInfo *info = &proto_items[i];
if (info->hMenu != NULL)
CallService(MS_CLIST_REMOVEMAINMENUITEM, (WPARAM) info->hMenu, 0);
@@ -233,18 +231,18 @@ void RegisterProtocol(char *proto, TCHAR *account)
!ProtoServiceExists(proto, PS_ICQ_SETCUSTOMSTATUSEX))
return;
- size_t id = proto_itens.size();
- proto_itens.resize(id+1);
+ size_t id = proto_items.size();
+ proto_items.resize(id+1);
- strncpy(proto_itens[id].proto, proto, MAX_REGS(proto_itens[id].proto));
- proto_itens[id].proto[MAX_REGS(proto_itens[id].proto)-1] = 0;
+ strncpy(proto_items[id].proto, proto, MAX_REGS(proto_items[id].proto));
+ proto_items[id].proto[MAX_REGS(proto_items[id].proto)-1] = 0;
- lstrcpyn(proto_itens[id].account, account, MAX_REGS(proto_itens[id].account));
+ lstrcpyn(proto_items[id].account, account, MAX_REGS(proto_items[id].account));
- proto_itens[id].hMenu = NULL;
- proto_itens[id].old_xstatus = 0;
- proto_itens[id].old_xstatus_name[0] = _T('\0');
- proto_itens[id].old_xstatus_message[0] = _T('\0');
+ proto_items[id].hMenu = NULL;
+ proto_items[id].old_xstatus = 0;
+ proto_items[id].old_xstatus_name[0] = _T('\0');
+ proto_items[id].old_xstatus_message[0] = _T('\0');
}
@@ -274,11 +272,11 @@ int AccListChanged(WPARAM wParam, LPARAM lParam)
{
CallService(MS_CLIST_REMOVEMAINMENUITEM, (WPARAM) info->hMenu, 0);
- for(std::vector<ProtocolInfo>::iterator it = proto_itens.begin(); it != proto_itens.end(); ++it)
+ for(std::vector<ProtocolInfo>::iterator it = proto_items.begin(); it != proto_items.end(); ++it)
{
if (&(*it) == info)
{
- proto_itens.erase(it);
+ proto_items.erase(it);
break;
}
}
@@ -315,89 +313,70 @@ int ModulesLoaded(WPARAM wParam, LPARAM lParam)
// Extra icon support
hExtraIcon = ExtraIcon_Register(MODULE_NAME, "Listening to music", "listening_to_icon");
- if (hExtraIcon != NULL)
- {
- HANDLE hContact = db_find_first();
- while (hContact != NULL)
- {
- char *proto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
- if (proto != NULL)
- {
- DBVARIANT dbv = {0};
- if (!DBGetContactSettingTString(hContact, proto, "ListeningTo", &dbv))
- {
- if (dbv.ptszVal != NULL && dbv.ptszVal[0] != 0)
- SetExtraIcon(hContact, TRUE);
-
- DBFreeVariant(&dbv);
- }
+
+ HANDLE hContact = db_find_first();
+ while (hContact != NULL) {
+ char *proto = (char *) CallService(MS_PROTO_GETCONTACTBASEPROTO, (WPARAM) hContact, 0);
+ if (proto != NULL) {
+ DBVARIANT dbv;
+ if (!DBGetContactSettingTString(hContact, proto, "ListeningTo", &dbv)) {
+ if (dbv.ptszVal != NULL && dbv.ptszVal[0] != 0)
+ SetExtraIcon(hContact, TRUE);
+
+ DBFreeVariant(&dbv);
}
-
- hContact = db_find_next(hContact);
}
- }
- else if (hExtraIcon == NULL && ServiceExists(MS_CLIST_EXTRA_ADD_ICON))
- {
- HookEvent(ME_CLIST_EXTRA_LIST_REBUILD, ClistExtraListRebuild);
- }
- {
- CLISTMENUITEM mi = {0};
- mi.cbSize = sizeof(mi);
-
- // Add main menu item
- mi.position = 500080000;
- mi.ptszName = LPGENT("Listening to");
- mi.flags = CMIF_ROOTPOPUP | CMIF_ICONFROMICOLIB | CMIF_TCHAR;
- mi.icolibItem = hIcon1;
- hMainMenuGroup = Menu_AddMainMenuItem(&mi);
-
- mi.hParentMenu = hMainMenuGroup;
- mi.popupPosition = 500080000;
- mi.position = 0;
- mi.pszService = MS_LISTENINGTO_MAINMENU;
- mi.hIcon = NULL;
-
- // Add all protos
- mi.ptszName = LPGENT("Send to all protocols");
- mi.flags = CMIF_CHILDPOPUP | CMIF_TCHAR
- | (ListeningToEnabled(NULL, TRUE) ? CMIF_CHECKED : 0)
- | (opts.enable_sending ? 0 : CMIF_GRAYED);
- proto_itens.resize(1);
- proto_itens[0].hMenu = Menu_AddMainMenuItem(&mi);
- proto_itens[0].proto[0] = 0;
- proto_itens[0].account[0] = 0;
- proto_itens[0].old_xstatus = 0;
- proto_itens[0].old_xstatus_name[0] = _T('\0');
- proto_itens[0].old_xstatus_message[0] = _T('\0');
+ hContact = db_find_next(hContact);
}
- // Add each proto
-
- if (ServiceExists(MS_PROTO_ENUMACCOUNTS))
- {
- PROTOACCOUNT **protos;
- int count;
- ProtoEnumAccounts(&count,&protos);
+ // Add main menu item
+ CLISTMENUITEM mi = { sizeof(mi) };
+ mi.position = 500080000;
+ mi.ptszName = LPGENT("Listening to");
+ mi.flags = CMIF_ROOTPOPUP | CMIF_ICONFROMICOLIB | CMIF_TCHAR;
+ mi.icolibItem = hIcon1;
+ hMainMenuGroup = Menu_AddMainMenuItem(&mi);
+
+ mi.hParentMenu = hMainMenuGroup;
+ mi.popupPosition = 500080000;
+ mi.position = 0;
+ mi.pszService = MS_LISTENINGTO_MAINMENU;
+ mi.hIcon = NULL;
+
+ // Add all protos
+ mi.ptszName = LPGENT("Send to all protocols");
+ mi.flags = CMIF_CHILDPOPUP | CMIF_TCHAR
+ | (ListeningToEnabled(NULL, TRUE) ? CMIF_CHECKED : 0)
+ | (opts.enable_sending ? 0 : CMIF_GRAYED);
+ proto_items.resize(1);
+ proto_items[0].hMenu = Menu_AddMainMenuItem(&mi);
+ proto_items[0].proto[0] = 0;
+ proto_items[0].account[0] = 0;
+ proto_items[0].old_xstatus = 0;
+ proto_items[0].old_xstatus_name[0] = _T('\0');
+ proto_items[0].old_xstatus_message[0] = _T('\0');
- for (int i = 0; i < count; i++)
- {
- if (!protos[i]->bIsEnabled)
- continue;
+ // Add each proto
+ PROTOACCOUNT **protos;
+ int count;
+ ProtoEnumAccounts(&count,&protos);
- RegisterProtocol(protos[i]->szModuleName, protos[i]->tszAccountName);
- }
+ for (int i = 0; i < count; i++) {
+ if (!protos[i]->bIsEnabled)
+ continue;
- HookEvent(ME_PROTO_ACCLISTCHANGED, AccListChanged);
+ RegisterProtocol(protos[i]->szModuleName, protos[i]->tszAccountName);
}
+ HookEvent(ME_PROTO_ACCLISTCHANGED, AccListChanged);
+
RebuildMenu();
HookEvent(ME_TTB_MODULELOADED, TopToolBarLoaded);
// Variables support
- if (ServiceExists(MS_VARS_REGISTERTOKEN))
- {
+ if (ServiceExists(MS_VARS_REGISTERTOKEN)) {
TOKENREGISTER tr = {0};
tr.cbSize = sizeof(TOKENREGISTER);
tr.memType = TR_MEM_MIRANDA;
@@ -535,12 +514,11 @@ INT_PTR MainMenuClicked(WPARAM wParam, LPARAM lParam)
if (!loaded)
return -1;
- int pos = wParam == 0 ? 0 : wParam - 500080000;
-
- if (pos >= proto_itens.size() || pos < 0)
+ unsigned pos = wParam == 0 ? 0 : wParam - 500080000;
+ if (pos >= proto_items.size() || pos < 0)
return 0;
- EnableListeningTo((WPARAM) proto_itens[pos].proto, (LPARAM) !ListeningToEnabled(proto_itens[pos].proto, TRUE));
+ EnableListeningTo((WPARAM) proto_items[pos].proto, (LPARAM) !ListeningToEnabled(proto_items[pos].proto, TRUE));
return 0;
}
@@ -554,9 +532,9 @@ BOOL ListeningToEnabled(char *proto, BOOL ignoreGlobal)
// Check all protocols
BOOL enabled = TRUE;
- for (unsigned int i = 1; i < proto_itens.size(); ++i)
+ for (unsigned int i = 1; i < proto_items.size(); ++i)
{
- if (!ListeningToEnabled(proto_itens[i].proto, TRUE))
+ if (!ListeningToEnabled(proto_items[i].proto, TRUE))
{
enabled = FALSE;
break;
@@ -583,9 +561,9 @@ INT_PTR ListeningToEnabled(WPARAM wParam, LPARAM lParam)
ProtocolInfo *GetProtoInfo(char *proto)
{
- for (unsigned int i = 1; i < proto_itens.size(); i++)
- if (strcmp(proto, proto_itens[i].proto) == 0)
- return &proto_itens[i];
+ for (unsigned int i = 1; i < proto_items.size(); i++)
+ if (strcmp(proto, proto_items[i].proto) == 0)
+ return &proto_items[i];
return NULL;
}
@@ -775,9 +753,9 @@ INT_PTR EnableListeningTo(WPARAM wParam,LPARAM lParam)
if (proto == NULL || proto[0] == 0)
{
// For all protocols
- for (unsigned int i = 1; i < proto_itens.size(); ++i)
+ for (unsigned int i = 1; i < proto_items.size(); ++i)
{
- EnableListeningTo((WPARAM) proto_itens[i].proto, lParam);
+ EnableListeningTo((WPARAM) proto_items[i].proto, lParam);
}
}
else
@@ -882,8 +860,8 @@ INT_PTR GetUnknownText(WPARAM wParam,LPARAM lParam)
void SetListeningInfos(LISTENINGTOINFO *lti)
{
- for (unsigned int i = 1; i < proto_itens.size(); ++i)
- SetListeningInfo(proto_itens[i].proto, lti);
+ for (unsigned int i = 1; i < proto_items.size(); ++i)
+ SetListeningInfo(proto_items[i].proto, lti);
TCHAR *fr = NULL;
char *info = NULL;
@@ -955,9 +933,9 @@ void StartTimer()
if (needPoll)
{
// Now see protocols
- for (unsigned int i = 1; i < proto_itens.size(); ++i)
+ for (unsigned int i = 1; i < proto_items.size(); ++i)
{
- if (ListeningToEnabled(proto_itens[i].proto))
+ if (ListeningToEnabled(proto_items[i].proto))
{
want = TRUE;
break;
@@ -998,40 +976,9 @@ void HasNewListeningInfo()
}
-int ClistExtraListRebuild(WPARAM wParam, LPARAM lParam)
-{
- HICON hIcon = Skin_GetIconByHandle(hIcon1);
-
- hExtraImage = (HANDLE) CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM) hIcon, 0);
-
- Skin_ReleaseIcon(hIcon);
-
- return 0;
-}
-
void SetExtraIcon(HANDLE hContact, BOOL set)
{
- if (hExtraIcon != NULL)
- {
- ExtraIcon_SetIcon(hExtraIcon, hContact, set ? "listening_to_icon" : NULL);
- }
- else if (opts.show_adv_icon && hExtraImage != NULL)
- {
- IconExtraColumn iec;
- iec.cbSize = sizeof(iec);
- iec.hImage = set ? hExtraImage : (HANDLE)-1;
- if (opts.adv_icon_slot < 2)
- {
- iec.ColumnType = opts.adv_icon_slot + EXTRA_ICON_ADV1;
- }
- else
- {
- int first = CallService(MS_CLUI_GETCAPS, 0, CLUIF2_USEREXTRASTART);
- iec.ColumnType = opts.adv_icon_slot - 2 + first;
- }
-
- CallService(MS_CLIST_EXTRA_SET_ICON, (WPARAM)hContact, (LPARAM)&iec);
- }
+ ExtraIcon_SetIcon(hExtraIcon, hContact, set ? "listening_to_icon" : NULL);
}
int SettingChanged(WPARAM wParam,LPARAM lParam)
diff --git a/plugins/ListeningTo/src/options.cpp b/plugins/ListeningTo/src/options.cpp
index f0f739edd2..50687caead 100644
--- a/plugins/ListeningTo/src/options.cpp
+++ b/plugins/ListeningTo/src/options.cpp
@@ -26,7 +26,7 @@ HANDLE hOptHook = NULL;
Options opts;
-extern std::vector<ProtocolInfo> proto_itens;
+extern std::vector<ProtocolInfo> proto_items;
extern HANDLE hExtraIcon;
BOOL ListeningToEnabled(char *proto, BOOL ignoreGlobal = FALSE);
diff --git a/plugins/New_GPG/src/clist.cpp b/plugins/New_GPG/src/clist.cpp
index c64fb17798..4533a464c2 100755
--- a/plugins/New_GPG/src/clist.cpp
+++ b/plugins/New_GPG/src/clist.cpp
@@ -16,26 +16,17 @@
#include "commonheaders.h"
-extern HANDLE g_hCLIcon;
void RefreshContactListIcons(void);
+void setClistIcon(HANDLE);
int onExtraImageListRebuilding(WPARAM, LPARAM)
{
- if(g_hCLIcon && ServiceExists(MS_CLIST_EXTRA_ADD_ICON) )
- RefreshContactListIcons();
+ RefreshContactListIcons();
return 0;
}
-
int onExtraImageApplying(WPARAM wParam, LPARAM)
{
- void setClistIcon(HANDLE);
- if(g_hCLIcon && ServiceExists(MS_CLIST_EXTRA_SET_ICON))
- {
-// IconExtraColumn iec = {0}; //need to init this
- if( g_hCLIcon )
- setClistIcon((HANDLE)wParam);
-// ExtraIcon_SetIcon(g_hCLIcon, (HANDLE)wParam, iec.hImage);
- }
+ setClistIcon((HANDLE)wParam);
return 0;
}
diff --git a/plugins/New_GPG/src/icons.cpp b/plugins/New_GPG/src/icons.cpp
index ec307666d1..90ad051b75 100755
--- a/plugins/New_GPG/src/icons.cpp
+++ b/plugins/New_GPG/src/icons.cpp
@@ -77,22 +77,10 @@ void setClistIcon(HANDLE hContact)
hMC = metaGetContact(hContact);
else if(metaIsProtoMetaContacts(hContact))
hMC = metaGetContact(hContact);
- if(g_hCLIcon && enabled)
- {
- HICON icon = IconLibGetIcon("secured");
- IconExtraColumn iec = {0};
- iec.cbSize = sizeof(iec);
- iec.hImage = (HANDLE)CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM)icon, 0);
- ExtraIcon_SetIcon(g_hCLIcon, hContact, iec.hImage);
- if(hMC)
- ExtraIcon_SetIcon(g_hCLIcon, hMC, iec.hImage);
- }
- else
- {
- ExtraIcon_SetIcon(g_hCLIcon, hContact, (HANDLE)0); // is it right ? hmm.., at least working....
- if(hMC)
- ExtraIcon_SetIcon(g_hCLIcon, hMC, (HANDLE)0);
- }
+ const char *szIconId = (enabled) ? "secured" : NULL;
+ ExtraIcon_SetIcon(g_hCLIcon, hContact, szIconId);
+ if(hMC)
+ ExtraIcon_SetIcon(g_hCLIcon, hMC, szIconId);
}
void setSrmmIcon(HANDLE h)
@@ -130,7 +118,6 @@ void setSrmmIcon(HANDLE h)
void RefreshContactListIcons()
{
- extern HANDLE g_hCLIcon;
CallService(MS_CLUI_LISTBEGINREBUILD,0,0);
HANDLE hContact = db_find_first();
while (hContact)
diff --git a/plugins/New_GPG/src/init.cpp b/plugins/New_GPG/src/init.cpp
index 6d8956b219..8413f9734d 100755
--- a/plugins/New_GPG/src/init.cpp
+++ b/plugins/New_GPG/src/init.cpp
@@ -228,10 +228,7 @@ static int OnModulesLoaded(WPARAM wParam,LPARAM lParam)
HookEvent(ME_MSG_WINDOWEVENT, onWindowEvent);
HookEvent(ME_MSG_ICONPRESSED, onIconPressed);
- if(ServiceExists(MS_EXTRAICON_REGISTER))
- g_hCLIcon = ExtraIcon_Register(szGPGModuleName, Translate("GPG encryption status"), "secured", (MIRANDAHOOK)onExtraImageListRebuilding, (MIRANDAHOOK)onExtraImageApplying);
-
-
+ g_hCLIcon = ExtraIcon_Register(szGPGModuleName, Translate("GPG encryption status"), "secured", (MIRANDAHOOK)onExtraImageListRebuilding, (MIRANDAHOOK)onExtraImageApplying);
PROTOCOLDESCRIPTOR pd = {0};
pd.cbSize=sizeof(PROTOCOLDESCRIPTOR);
diff --git a/plugins/UserInfoEx/src/Flags/svc_flags.cpp b/plugins/UserInfoEx/src/Flags/svc_flags.cpp
index 359d574b30..ed43e04161 100644
--- a/plugins/UserInfoEx/src/Flags/svc_flags.cpp
+++ b/plugins/UserInfoEx/src/Flags/svc_flags.cpp
@@ -43,7 +43,6 @@ FLAGSOPTIONS gFlagsOpts;
/* Misc */
int nCountriesCount;
struct CountryListEntry *countries;
-static HANDLE *phExtraImageList = NULL; //return value(s) from MS_CLIST_EXTRA_ADD_ICON
static HANDLE hExtraIconSvc = INVALID_HANDLE_VALUE;
/* hook */
static HANDLE hRebuildIconsHook = NULL;
@@ -344,7 +343,7 @@ VOID SvcFlagsEnableExtraIcons(BYTE bColumn, BOOLEAN bUpdateDB)
mir_snprintf(szId, SIZEOF(szId), (langid==0xFFFF)?"%s_0x%X":"%s_%i","flags",langid); /* buffer safe */
ico.descIcon = szId;
hExtraIconSvc = (HANDLE)CallService(MS_EXTRAICON_REGISTER, (WPARAM)&ico, 0);
- if(hExtraIconSvc)
+ if (hExtraIconSvc)
HookEvent(ME_DB_CONTACT_SETTINGCHANGED, OnExtraIconSvcChanged);
}
@@ -620,7 +619,6 @@ void SvcFlagsUnloadModule() {
UnhookEvent(hRebuildIconsHook);
UnhookEvent(hApplyIconHook);
UnhookEvent(hIconsChangedHook);
- mir_free(phExtraImageList); /* does NULL check */
//Uninit message winsow
UnhookEvent(hMsgWndEventHook);
for(int i = 0; i < gMsgWndList.getCount(); i++) {
diff --git a/plugins/UserInfoEx/src/Flags/svc_flags.h b/plugins/UserInfoEx/src/Flags/svc_flags.h
index e7f97ab963..a597f67e8a 100644
--- a/plugins/UserInfoEx/src/Flags/svc_flags.h
+++ b/plugins/UserInfoEx/src/Flags/svc_flags.h
@@ -70,11 +70,10 @@ class MsgWndData {
class IconList {
public:
- int m_ID;
- HANDLE m_hIcon; //register
- HANDLE m_hImage; //return value from MS_CLIST_EXTRA_ADD_ICON -INVALID_HANDLE_VALUE; //preset
- BYTE m_TypeFlag;
- StatusIconData m_StatusIconData;
+ int m_ID;
+ HANDLE m_hIcon; //register
+ BYTE m_TypeFlag;
+ StatusIconData m_StatusIconData;
IconList(StatusIconData* sid);
// IconList(HWND hwnd, HANDLE hContact);
diff --git a/plugins/UserInfoEx/src/svc_reminder.cpp b/plugins/UserInfoEx/src/svc_reminder.cpp
index bfde666a9b..ae7de9fb81 100644
--- a/plugins/UserInfoEx/src/svc_reminder.cpp
+++ b/plugins/UserInfoEx/src/svc_reminder.cpp
@@ -148,114 +148,32 @@ BOOLEAN CEvent::operator << (const CEvent& evt)
*
* @return The function returns icolib's icon if found or NULL otherwise.
**/
+
static HICON GetAnnivIcon(const CEvent &evt)
{
HICON hIcon = NULL;
CHAR szIcon[MAXSETTING];
- switch (evt._eType)
- {
- case CEvent::BIRTHDAY:
- {
- if (evt._wDaysLeft > 9)
- {
- hIcon = IcoLib_GetIcon(ICO_RMD_DTBX);
- }
- else
- {
- mir_snprintf(szIcon, SIZEOF(szIcon), MODNAME"_rmd_dtb%u", evt._wDaysLeft);
- hIcon = IcoLib_GetIcon(szIcon);
- }
- }
- break;
-
- case CEvent::ANNIVERSARY:
- {
- if (evt._wDaysLeft > 9)
- {
- hIcon = IcoLib_GetIcon(ICO_RMD_DTAX);
- }
- else
- {
- mir_snprintf(szIcon, SIZEOF(szIcon), MODNAME"_rmd_dta%u", evt._wDaysLeft);
- hIcon = IcoLib_GetIcon(szIcon);
- }
- }
- }
- return hIcon;
-}
-
-/**
- * This function adds the icon for the given anniversary, which is the given number of days
- * in advance to the contact list's imagelist.
- *
- * @param evt - structure specifying the next anniversary
- *
- * @return The function returns the clist's extra icon handle if found and successfully added.
- **/
-static HANDLE AddCListExtraIcon(const CEvent &evt)
-{
- HANDLE hClistIcon;
- HICON hIco = GetAnnivIcon(evt);
- if (hIco)
- {
- hClistIcon = (HANDLE)CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM)hIco, 0);
- if (hClistIcon == (HANDLE)CALLSERVICE_NOTFOUND)
- hClistIcon = INVALID_HANDLE_VALUE;
-
- Skin_ReleaseIcon(hIco);
- }
- else hClistIcon = INVALID_HANDLE_VALUE;
-
- return hClistIcon;
-}
-
-/**
- * This function returns the clist extra icon handle for the given anniversary.
- *
- * @param evt - structure specifying the next anniversary
- *
- * @return The function returns the clist extra icon handle for the given anniversary.
- **/
-static HANDLE GetCListExtraIcon(const CEvent &evt)
-{
- if (gRemindOpts.bCListExtraIcon)
- {
- WORD wIndex = evt._wDaysLeft;
-
- switch (evt._eType)
- {
- case CEvent::BIRTHDAY:
- {
- if (wIndex >= SIZEOF(ghCListBirthdayIcons))
- {
- wIndex = SIZEOF(ghCListBirthdayIcons) - 1;
- }
- // add the icon to clists imagelist if required
- if (ghCListBirthdayIcons[wIndex] == INVALID_HANDLE_VALUE)
- {
- ghCListBirthdayIcons[wIndex] = AddCListExtraIcon(evt);
- }
- }
- return ghCListBirthdayIcons[wIndex];
-
- case CEvent::ANNIVERSARY:
- {
- if (wIndex >= SIZEOF(ghCListAnnivIcons))
- {
- wIndex = SIZEOF(ghCListAnnivIcons) - 1;
- }
- // add the icon to clists imagelist if required
- if (ghCListAnnivIcons[wIndex] == INVALID_HANDLE_VALUE)
- {
- ghCListAnnivIcons[wIndex] = AddCListExtraIcon(evt);
- }
- }
- return ghCListAnnivIcons[wIndex];
+ switch (evt._eType) {
+ case CEvent::BIRTHDAY:
+ if (evt._wDaysLeft > 9)
+ hIcon = IcoLib_GetIcon(ICO_RMD_DTBX);
+ else {
+ mir_snprintf(szIcon, SIZEOF(szIcon), MODNAME"_rmd_dtb%u", evt._wDaysLeft);
+ hIcon = IcoLib_GetIcon(szIcon);
+ }
+ break;
+
+ case CEvent::ANNIVERSARY:
+ if (evt._wDaysLeft > 9)
+ hIcon = IcoLib_GetIcon(ICO_RMD_DTAX);
+ else {
+ mir_snprintf(szIcon, SIZEOF(szIcon), MODNAME"_rmd_dta%u", evt._wDaysLeft);
+ hIcon = IcoLib_GetIcon(szIcon);
}
}
- return INVALID_HANDLE_VALUE;
+ return hIcon;
}
/**
diff --git a/plugins/WhenWasIt/src/commonheaders.h b/plugins/WhenWasIt/src/commonheaders.h
index a231fafba8..e2421e91c8 100644
--- a/plugins/WhenWasIt/src/commonheaders.h
+++ b/plugins/WhenWasIt/src/commonheaders.h
@@ -81,7 +81,6 @@ struct CommonData{
int daysInAdvance;
int popupTimeout;
int popupTimeoutToday;
- int clistIcon;
int bUsePopups;
int bUseClistIcon;
int bUseDialog;
diff --git a/plugins/WhenWasIt/src/dlg_handlers.cpp b/plugins/WhenWasIt/src/dlg_handlers.cpp
index db617c4d4f..2c8114eca5 100644
--- a/plugins/WhenWasIt/src/dlg_handlers.cpp
+++ b/plugins/WhenWasIt/src/dlg_handlers.cpp
@@ -52,30 +52,21 @@ const int cNotifyFor = sizeof(szNotifyFor) / sizeof(szNotifyFor[0]);
#include "commctrl.h"
void CreateToolTip(HWND target, TCHAR* tooltip, LPARAM width)
{
- HWND hwndToolTip;
-
- hwndToolTip = CreateWindow(TOOLTIPS_CLASS, NULL,
- WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP,
- CW_USEDEFAULT, CW_USEDEFAULT,
- CW_USEDEFAULT, CW_USEDEFAULT,
- target,
- NULL,
- NULL,
- NULL);
- if (hwndToolTip)
- {
- TOOLINFO ti = {0};
- ti.cbSize = sizeof(ti);
- ti.uFlags = TTF_TRANSPARENT | TTF_SUBCLASS;
- ti.hwnd = target;
- ti.uId = 0;
- ti.hinst = NULL;
- ti.lpszText = tooltip;
- GetClientRect(target, &ti.rect);
- SendMessage(hwndToolTip, TTM_ADDTOOL, 0, (LPARAM) &ti );
- SendMessage(hwndToolTip, TTM_SETMAXTIPWIDTH, 0, width);
- SendMessage(hwndToolTip, TTM_SETDELAYTIME, TTDT_AUTOPOP, 20000);
- }
+ HWND hwndToolTip = CreateWindow(TOOLTIPS_CLASS, NULL, WS_POPUP | TTS_NOPREFIX | TTS_ALWAYSTIP, CW_USEDEFAULT, CW_USEDEFAULT,
+ CW_USEDEFAULT, CW_USEDEFAULT, target, NULL, NULL, NULL);
+ if (hwndToolTip) {
+ TOOLINFO ti = {0};
+ ti.cbSize = sizeof(ti);
+ ti.uFlags = TTF_TRANSPARENT | TTF_SUBCLASS;
+ ti.hwnd = target;
+ ti.uId = 0;
+ ti.hinst = NULL;
+ ti.lpszText = tooltip;
+ GetClientRect(target, &ti.rect);
+ SendMessage(hwndToolTip, TTM_ADDTOOL, 0, (LPARAM) &ti );
+ SendMessage(hwndToolTip, TTM_SETMAXTIPWIDTH, 0, width);
+ SendMessage(hwndToolTip, TTM_SETDELAYTIME, TTDT_AUTOPOP, 20000);
+ }
}
int EnablePopupsGroup(HWND hWnd, int enable)
@@ -112,33 +103,25 @@ int AddInfoToComboBoxes(HWND hWnd)
{
int i;
TCHAR *buffer;
- for (i = 0; i < cAdvancedIcons; i++)
- {
- buffer = TranslateTS(szAdvancedIcons[i]);
- SendMessage(GetDlgItem(hWnd, IDC_ADVANCED_ICON), CB_ADDSTRING, 0, (LPARAM) buffer);
- }
-
+ for (i = 0; i < cAdvancedIcons; i++) {
+ buffer = TranslateTS(szAdvancedIcons[i]);
+ SendMessage(GetDlgItem(hWnd, IDC_ADVANCED_ICON), CB_ADDSTRING, 0, (LPARAM) buffer);
+ }
+
for (i = 0; i < cShowAgeMode; i++)
- {
- SendMessage(GetDlgItem(hWnd, IDC_AGE_COMBOBOX), CB_ADDSTRING, 0, (LPARAM) TranslateTS(szShowAgeMode[i]));
- }
-
+ SendMessage(GetDlgItem(hWnd, IDC_AGE_COMBOBOX), CB_ADDSTRING, 0, (LPARAM) TranslateTS(szShowAgeMode[i]));
+
for (i = 0; i < cSaveModule; i++)
- {
- SendMessage(GetDlgItem(hWnd, IDC_DEFAULT_MODULE), CB_ADDSTRING, 0, (LPARAM) TranslateTS(szSaveModule[i]));
- }
-
- for (i = 0; i < cPopupClick; i++)
- {
- SendMessage(GetDlgItem(hWnd, IDC_LEFT_CLICK), CB_ADDSTRING, 0, (LPARAM) TranslateTS(szPopupClick[i]));
- SendMessage(GetDlgItem(hWnd, IDC_RIGHT_CLICK), CB_ADDSTRING, 0, (LPARAM) TranslateTS(szPopupClick[i]));
- }
-
+ SendMessage(GetDlgItem(hWnd, IDC_DEFAULT_MODULE), CB_ADDSTRING, 0, (LPARAM) TranslateTS(szSaveModule[i]));
+
+ for (i = 0; i < cPopupClick; i++) {
+ SendMessage(GetDlgItem(hWnd, IDC_LEFT_CLICK), CB_ADDSTRING, 0, (LPARAM) TranslateTS(szPopupClick[i]));
+ SendMessage(GetDlgItem(hWnd, IDC_RIGHT_CLICK), CB_ADDSTRING, 0, (LPARAM) TranslateTS(szPopupClick[i]));
+ }
+
for (i = 0; i < cNotifyFor; i++)
- {
SendMessage(GetDlgItem(hWnd, IDC_NOTIFYFOR), CB_ADDSTRING, 0, (LPARAM) TranslateTS(szNotifyFor[i]));
- }
-
+
return i;
}
@@ -176,13 +159,13 @@ TCHAR *strtrim(TCHAR *str)
size_t i = 0;
size_t len = _tcslen(str);
while ((i < len) && (str[i] == _T(' '))) { i++; }
- if (i)
- {
+ if (i) {
memmove(str, str + i, len - i + 1);
len -= i;
}
- while ((len > 0) && (str[--len] == _T(' '))) { str[len] = 0; }
+ while ((len > 0) && (str[--len] == _T(' ')))
+ str[len] = 0;
return str;
}
@@ -190,271 +173,236 @@ TCHAR *strtrim(TCHAR *str)
INT_PTR CALLBACK DlgProcOptions(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
static int bInitializing = 0;
- switch (msg)
+ switch (msg) {
+ case WM_INITDIALOG:
{
- case WM_INITDIALOG:
- {
- bInitializing = 1;
-
- SIZE oldPopupsSize = GetControlTextSize(GetDlgItem(hWnd, IDC_USE_POPUPS));
- SIZE oldClistIconSize = GetControlTextSize(GetDlgItem(hWnd, IDC_USE_CLISTICON));
- SIZE oldDialogSize = GetControlTextSize(GetDlgItem(hWnd, IDC_USE_DIALOG));
-
- TranslateDialogDefault(hWnd);
-
- EnlargeControl(GetDlgItem(hWnd, IDC_USE_POPUPS), GetDlgItem(hWnd, IDC_POPUPS_STATIC), oldPopupsSize);
- EnlargeControl(GetDlgItem(hWnd, IDC_USE_CLISTICON), GetDlgItem(hWnd, IDC_CLIST_STATIC), oldClistIconSize);
- EnlargeControl(GetDlgItem(hWnd, IDC_USE_DIALOG), GetDlgItem(hWnd, IDC_DIALOG_STATIC), oldDialogSize);
+ bInitializing = 1;
- AddInfoToComboBoxes(hWnd);
-
- SendMessage(GetDlgItem(hWnd, IDC_FOREGROUND), CPM_SETDEFAULTCOLOUR, 0, FOREGROUND_COLOR);
- SendMessage(GetDlgItem(hWnd, IDC_BACKGROUND), CPM_SETDEFAULTCOLOUR, 0, BACKGROUND_COLOR);
-
- SendMessage(GetDlgItem(hWnd, IDC_FOREGROUND), CPM_SETCOLOUR, 0, commonData.foreground);
- SendMessage(GetDlgItem(hWnd, IDC_BACKGROUND), CPM_SETCOLOUR, 0, commonData.background);
-
- SendMessage(GetDlgItem(hWnd, IDC_ADVANCED_ICON), CB_SETCURSEL, commonData.clistIcon, 0);
- SendMessage(GetDlgItem(hWnd, IDC_DEFAULT_MODULE), CB_SETCURSEL, commonData.cDefaultModule, 0);
- SendMessage(GetDlgItem(hWnd, IDC_LEFT_CLICK), CB_SETCURSEL, commonData.lPopupClick, 0);
- SendMessage(GetDlgItem(hWnd, IDC_RIGHT_CLICK), CB_SETCURSEL, commonData.rPopupClick, 0);
- SendMessage(GetDlgItem(hWnd, IDC_NOTIFYFOR), CB_SETCURSEL, commonData.notifyFor, 0);
-
- CreateToolTip(GetDlgItem(hWnd, IDC_POPUP_TIMEOUT), TranslateT("Set popup delay when notifying of upcoming birthdays.\nFormat: default delay [ | delay for birthdays occuring today]"), 400);
-
- TCHAR buffer[1024];
- _itot(commonData.daysInAdvance, buffer, 10);
- SetWindowText(GetDlgItem(hWnd, IDC_DAYS_IN_ADVANCE), buffer);
- _itot(commonData.checkInterval, buffer, 10);
- SetWindowText(GetDlgItem(hWnd, IDC_CHECK_INTERVAL), buffer);
- _sntprintf(buffer, 1024, _T("%d|%d"), commonData.popupTimeout, commonData.popupTimeoutToday);
- SetWindowText(GetDlgItem(hWnd, IDC_POPUP_TIMEOUT), buffer);
- _itot(commonData.cSoundNearDays, buffer, 10);
- SetWindowText(GetDlgItem(hWnd, IDC_SOUND_NEAR_DAYS_EDIT), buffer);
- _itot(commonData.cDlgTimeout, buffer, 10);
- SetWindowText(GetDlgItem(hWnd, IDC_DLG_TIMEOUT), buffer);
- _itot(commonData.daysAfter, buffer, 10);
- SetWindowText(GetDlgItem(hWnd, IDC_DAYS_AFTER), buffer);
-
- CheckDlgButton(hWnd, IDC_OPENINBACKGROUND, (commonData.bOpenInBackground) ? BST_CHECKED : BST_UNCHECKED);
-
- CheckDlgButton(hWnd, IDC_NOBIRTHDAYS_POPUP, (commonData.bNoBirthdaysPopup) ? BST_CHECKED : BST_UNCHECKED);
- //CheckDlgButton(hWnd, IDC_SHOW_CURRENT_AGE, (bShowCurrentAge) ? BST_CHECKED : BST_UNCHECKED);
- SendMessage(GetDlgItem(hWnd, IDC_AGE_COMBOBOX), CB_SETCURSEL, commonData.cShowAgeMode, 0);
-
- CheckDlgButton(hWnd, IDC_IGNORE_SUBCONTACTS, (commonData.bIgnoreSubcontacts) ? BST_CHECKED : BST_UNCHECKED);
-
- CheckDlgButton(hWnd, IDC_ONCE_PER_DAY, (commonData.bOncePerDay) ? BST_CHECKED : BST_UNCHECKED);
- EnableWindow(GetDlgItem(hWnd, IDC_CHECK_INTERVAL), !commonData.bOncePerDay);
-
- CheckDlgButton(hWnd, IDC_USE_DIALOG, (commonData.bUseDialog) ? BST_CHECKED : BST_UNCHECKED);
- EnableDialogGroup(hWnd, commonData.bUseDialog);
-
- if (ServiceExists(MS_POPUP_ADDPOPUPEX))
- {
- CheckDlgButton(hWnd, IDC_USE_POPUPS, commonData.bUsePopups ? BST_CHECKED : BST_UNCHECKED);
- EnablePopupsGroup(hWnd, commonData.bUsePopups);
- }
- else{
- EnableWindow(GetDlgItem(hWnd, IDC_USE_POPUPS), FALSE);
- EnablePopupsGroup(hWnd, FALSE);
- }
-
- if (ServiceExists(MS_CLIST_EXTRA_SET_ICON) && (!ServiceExists(MS_EXTRAICON_REGISTER)))
- {
- CheckDlgButton(hWnd, IDC_USE_CLISTICON, commonData.bUseClistIcon ? BST_CHECKED : BST_UNCHECKED);
- EnableClistGroup(hWnd, commonData.bUseClistIcon);
- }
- else{
- CheckDlgButton(hWnd, IDC_USE_CLISTICON, BST_CHECKED);
- EnableWindow(GetDlgItem(hWnd, IDC_USE_CLISTICON), FALSE);
- EnableClistGroup(hWnd, FALSE);
- }
- bInitializing = 0;
-
- return TRUE;
- }
- case WM_COMMAND:
- {
- switch (LOWORD(wParam))
- {
- case IDC_CHECK_INTERVAL:
- case IDC_POPUP_TIMEOUT:
- case IDC_DAYS_IN_ADVANCE:
- case IDC_DLG_TIMEOUT:
- case IDC_SOUND_NEAR_DAYS_EDIT:
- case IDC_DAYS_AFTER:
- {
- if ((HIWORD(wParam) == EN_CHANGE) && (!bInitializing))// || (HIWORD(wParam) == CBN_SELENDOK))
- {
- SendMessage(GetParent(hWnd), PSM_CHANGED, 0, 0);
- }
-
- break;
- }
-
- case IDC_USE_POPUPS:
- case IDC_USE_CLISTICON:
- case IDC_USE_DIALOG:
- {
- EnablePopupsGroup(hWnd, IsDlgButtonChecked(hWnd, IDC_USE_POPUPS));
- EnableClistGroup(hWnd, IsDlgButtonChecked(hWnd, IDC_USE_CLISTICON));
- EnableDialogGroup(hWnd, IsDlgButtonChecked(hWnd, IDC_USE_DIALOG));
- RedrawWindow(GetDlgItem(hWnd, IDC_USE_POPUPS), NULL, NULL, RDW_ERASE | RDW_INVALIDATE);
- RedrawWindow(GetDlgItem(hWnd, IDC_USE_CLISTICON), NULL, NULL, RDW_ERASE | RDW_INVALIDATE);
- RedrawWindow(GetDlgItem(hWnd, IDC_USE_DIALOG), NULL, NULL, RDW_ERASE | RDW_INVALIDATE);
- }//fallthrough
-
- case IDC_FOREGROUND:
- case IDC_BACKGROUND:
- case IDC_ADVANCED_ICON:
- case IDC_IGNORE_SUBCONTACTS:
- case IDC_AGE_COMBOBOX:
- case IDC_NOBIRTHDAYS_POPUP:
- case IDC_DEFAULT_MODULE:
- case IDC_LEFT_CLICK:
- case IDC_RIGHT_CLICK:
- case IDC_ONCE_PER_DAY:
- case IDC_NOTIFYFOR:
- {
- SendMessage(GetParent(hWnd), PSM_CHANGED, 0, 0);
- EnableWindow(GetDlgItem(hWnd, IDC_CHECK_INTERVAL), !IsDlgButtonChecked(hWnd, IDC_ONCE_PER_DAY));
-
- break;
- }
-
- case IDC_PREVIEW:
- {
- HANDLE hContact = db_find_first();
- int dtb, age;
- dtb = rand() % 11; //0..10
- age = rand() % 50 + 1; //1..50
- PopupNotifyBirthday(hContact, dtb, age);
-
- break;
- }
- }
- break;
- }
- case WM_NOTIFY:
+ SIZE oldPopupsSize = GetControlTextSize(GetDlgItem(hWnd, IDC_USE_POPUPS));
+ SIZE oldClistIconSize = GetControlTextSize(GetDlgItem(hWnd, IDC_USE_CLISTICON));
+ SIZE oldDialogSize = GetControlTextSize(GetDlgItem(hWnd, IDC_USE_DIALOG));
+
+ TranslateDialogDefault(hWnd);
+
+ EnlargeControl(GetDlgItem(hWnd, IDC_USE_POPUPS), GetDlgItem(hWnd, IDC_POPUPS_STATIC), oldPopupsSize);
+ EnlargeControl(GetDlgItem(hWnd, IDC_USE_CLISTICON), GetDlgItem(hWnd, IDC_CLIST_STATIC), oldClistIconSize);
+ EnlargeControl(GetDlgItem(hWnd, IDC_USE_DIALOG), GetDlgItem(hWnd, IDC_DIALOG_STATIC), oldDialogSize);
+
+ AddInfoToComboBoxes(hWnd);
+
+ SendMessage(GetDlgItem(hWnd, IDC_FOREGROUND), CPM_SETDEFAULTCOLOUR, 0, FOREGROUND_COLOR);
+ SendMessage(GetDlgItem(hWnd, IDC_BACKGROUND), CPM_SETDEFAULTCOLOUR, 0, BACKGROUND_COLOR);
+
+ SendMessage(GetDlgItem(hWnd, IDC_FOREGROUND), CPM_SETCOLOUR, 0, commonData.foreground);
+ SendMessage(GetDlgItem(hWnd, IDC_BACKGROUND), CPM_SETCOLOUR, 0, commonData.background);
+
+ SendMessage(GetDlgItem(hWnd, IDC_DEFAULT_MODULE), CB_SETCURSEL, commonData.cDefaultModule, 0);
+ SendMessage(GetDlgItem(hWnd, IDC_LEFT_CLICK), CB_SETCURSEL, commonData.lPopupClick, 0);
+ SendMessage(GetDlgItem(hWnd, IDC_RIGHT_CLICK), CB_SETCURSEL, commonData.rPopupClick, 0);
+ SendMessage(GetDlgItem(hWnd, IDC_NOTIFYFOR), CB_SETCURSEL, commonData.notifyFor, 0);
+
+ CreateToolTip(GetDlgItem(hWnd, IDC_POPUP_TIMEOUT), TranslateT("Set popup delay when notifying of upcoming birthdays.\nFormat: default delay [ | delay for birthdays occuring today]"), 400);
+
+ TCHAR buffer[1024];
+ _itot(commonData.daysInAdvance, buffer, 10);
+ SetWindowText(GetDlgItem(hWnd, IDC_DAYS_IN_ADVANCE), buffer);
+ _itot(commonData.checkInterval, buffer, 10);
+ SetWindowText(GetDlgItem(hWnd, IDC_CHECK_INTERVAL), buffer);
+ _sntprintf(buffer, 1024, _T("%d|%d"), commonData.popupTimeout, commonData.popupTimeoutToday);
+ SetWindowText(GetDlgItem(hWnd, IDC_POPUP_TIMEOUT), buffer);
+ _itot(commonData.cSoundNearDays, buffer, 10);
+ SetWindowText(GetDlgItem(hWnd, IDC_SOUND_NEAR_DAYS_EDIT), buffer);
+ _itot(commonData.cDlgTimeout, buffer, 10);
+ SetWindowText(GetDlgItem(hWnd, IDC_DLG_TIMEOUT), buffer);
+ _itot(commonData.daysAfter, buffer, 10);
+ SetWindowText(GetDlgItem(hWnd, IDC_DAYS_AFTER), buffer);
+
+ CheckDlgButton(hWnd, IDC_OPENINBACKGROUND, (commonData.bOpenInBackground) ? BST_CHECKED : BST_UNCHECKED);
+
+ CheckDlgButton(hWnd, IDC_NOBIRTHDAYS_POPUP, (commonData.bNoBirthdaysPopup) ? BST_CHECKED : BST_UNCHECKED);
+ //CheckDlgButton(hWnd, IDC_SHOW_CURRENT_AGE, (bShowCurrentAge) ? BST_CHECKED : BST_UNCHECKED);
+ SendMessage(GetDlgItem(hWnd, IDC_AGE_COMBOBOX), CB_SETCURSEL, commonData.cShowAgeMode, 0);
+
+ CheckDlgButton(hWnd, IDC_IGNORE_SUBCONTACTS, (commonData.bIgnoreSubcontacts) ? BST_CHECKED : BST_UNCHECKED);
+
+ CheckDlgButton(hWnd, IDC_ONCE_PER_DAY, (commonData.bOncePerDay) ? BST_CHECKED : BST_UNCHECKED);
+ EnableWindow(GetDlgItem(hWnd, IDC_CHECK_INTERVAL), !commonData.bOncePerDay);
+
+ CheckDlgButton(hWnd, IDC_USE_DIALOG, (commonData.bUseDialog) ? BST_CHECKED : BST_UNCHECKED);
+ EnableDialogGroup(hWnd, commonData.bUseDialog);
+
+ if (ServiceExists(MS_POPUP_ADDPOPUPEX))
{
- switch(((LPNMHDR)lParam)->idFrom)
- {
- case 0:
- {
- switch (((LPNMHDR)lParam)->code)
- {
- case PSN_APPLY:
- {
- commonData.foreground = SendMessage(GetDlgItem(hWnd, IDC_FOREGROUND), CPM_GETCOLOUR, 0, 0);
- commonData.background = SendMessage(GetDlgItem(hWnd, IDC_BACKGROUND), CPM_GETCOLOUR, 0, 0);
- commonData.popupTimeout = POPUP_TIMEOUT;
- commonData.popupTimeoutToday = POPUP_TIMEOUT;
- commonData.clistIcon = SendMessage(GetDlgItem(hWnd, IDC_ADVANCED_ICON), CB_GETCURSEL, 0, 0);
- int oldClistIcon = DBGetContactSettingByte(NULL, ModuleName, "AdvancedIcon", -1);
- commonData.bUsePopups = IsDlgButtonChecked(hWnd, IDC_USE_POPUPS);
- commonData.bUseClistIcon = IsDlgButtonChecked(hWnd, IDC_USE_CLISTICON);
- commonData.bUseDialog = IsDlgButtonChecked(hWnd, IDC_USE_DIALOG);
- commonData.bIgnoreSubcontacts = IsDlgButtonChecked(hWnd, IDC_IGNORE_SUBCONTACTS);
- commonData.bNoBirthdaysPopup = IsDlgButtonChecked(hWnd, IDC_NOBIRTHDAYS_POPUP);
- commonData.cShowAgeMode = SendMessage(GetDlgItem(hWnd, IDC_AGE_COMBOBOX), CB_GETCURSEL, 0, 0);
- commonData.cDefaultModule = SendMessage(GetDlgItem(hWnd, IDC_DEFAULT_MODULE), CB_GETCURSEL, 0, 0);
- commonData.lPopupClick = SendMessage(GetDlgItem(hWnd, IDC_LEFT_CLICK), CB_GETCURSEL, 0, 0);
- commonData.rPopupClick = SendMessage(GetDlgItem(hWnd, IDC_RIGHT_CLICK), CB_GETCURSEL, 0, 0);
- commonData.bOncePerDay = IsDlgButtonChecked(hWnd, IDC_ONCE_PER_DAY);
- commonData.notifyFor = SendMessage(GetDlgItem(hWnd, IDC_NOTIFYFOR), CB_GETCURSEL, 0, 0);
- commonData.bOpenInBackground = IsDlgButtonChecked(hWnd, IDC_OPENINBACKGROUND);
-
- const int maxSize = 1024;
- TCHAR buffer[maxSize];
-
- GetWindowText(GetDlgItem(hWnd, IDC_DAYS_IN_ADVANCE), buffer, maxSize);
- TCHAR *stop = NULL;
- commonData.daysInAdvance = _tcstol(buffer, &stop, 10);
-
- if (*stop) { commonData.daysInAdvance = DAYS_TO_NOTIFY; }
-
- GetWindowText(GetDlgItem(hWnd, IDC_DAYS_AFTER), buffer, maxSize);
- commonData.daysAfter = _tcstol(buffer, &stop, 10);
-
- if (*stop) { commonData.daysAfter = DAYS_TO_NOTIFY_AFTER; }
-
- GetWindowText(GetDlgItem(hWnd, IDC_CHECK_INTERVAL), buffer, maxSize);
- commonData.checkInterval = _ttol(buffer);
- if (!commonData.checkInterval) { commonData.checkInterval = CHECK_INTERVAL; }
-
- GetWindowText(GetDlgItem(hWnd, IDC_POPUP_TIMEOUT), buffer, maxSize);
- TCHAR *pos;
- pos = _tcschr(buffer, _T('|'));
- if (pos)
- {
- TCHAR tmp[128];
- *pos = 0;
- _tcscpy(tmp, buffer);
- strtrim(tmp);
- commonData.popupTimeout = _ttol(tmp);
-
- _tcscpy(tmp, pos + 1);
- strtrim(tmp);
- commonData.popupTimeoutToday = _ttol(tmp);
-
- }
- else{
- commonData.popupTimeout = commonData.popupTimeoutToday = _ttol(buffer);
- }
-
- GetWindowText(GetDlgItem(hWnd, IDC_SOUND_NEAR_DAYS_EDIT), buffer, maxSize);
- //cSoundNearDays = _ttol(buffer);
- commonData.cSoundNearDays = _tcstol(buffer, &stop, 10);
- if (*stop) { commonData.cSoundNearDays = BIRTHDAY_NEAR_DEFAULT_DAYS; }
-
- GetWindowText(GetDlgItem(hWnd, IDC_DLG_TIMEOUT), buffer, maxSize);
- commonData.cDlgTimeout = _tcstol(buffer, &stop, 10);
- if (*stop) { commonData.cDlgTimeout = POPUP_TIMEOUT; }
-
- DBWriteContactSettingByte(NULL, ModuleName, "IgnoreSubcontacts", commonData.bIgnoreSubcontacts);
- DBWriteContactSettingByte(NULL, ModuleName, "UsePopups", commonData.bUsePopups);
- DBWriteContactSettingByte(NULL, ModuleName, "UseClistIcon", commonData.bUseClistIcon);
- DBWriteContactSettingByte(NULL, ModuleName, "UseDialog", commonData.bUseDialog);
- DBWriteContactSettingByte(NULL, ModuleName, "AdvancedIcon", commonData.clistIcon);
- DBWriteContactSettingWord(NULL, ModuleName, "CheckInterval", commonData.checkInterval);
- DBWriteContactSettingWord(NULL, ModuleName, "DaysInAdvance", commonData.daysInAdvance);
- DBWriteContactSettingWord(NULL, ModuleName, "DaysAfter", commonData.daysAfter);
- DBWriteContactSettingWord(NULL, ModuleName, "PopupTimeout", commonData.popupTimeout);
- DBWriteContactSettingWord(NULL, ModuleName, "PopupTimeoutToday", commonData.popupTimeoutToday);
-
- DBWriteContactSettingByte(NULL, ModuleName, "ShowCurrentAge", commonData.cShowAgeMode);
- DBWriteContactSettingByte(NULL, ModuleName, "NoBirthdaysPopup", commonData.bNoBirthdaysPopup);
-
- DBWriteContactSettingByte(NULL, ModuleName, "OpenInBackground", commonData.bOpenInBackground);
-
- DBWriteContactSettingByte(NULL, ModuleName, "SoundNearDays", commonData.cSoundNearDays);
-
- DBWriteContactSettingByte(NULL, ModuleName, "DefaultModule", commonData.cDefaultModule);
-
- DBWriteContactSettingByte(NULL, ModuleName, "PopupLeftClick", commonData.lPopupClick);
- DBWriteContactSettingByte(NULL, ModuleName, "PopupRightClick", commonData.rPopupClick);
-
- DBWriteContactSettingDword(NULL, ModuleName, "Foreground", commonData.foreground);
- DBWriteContactSettingDword(NULL, ModuleName, "Background", commonData.background);
-
- DBWriteContactSettingByte(NULL, ModuleName, "OncePerDay", commonData.bOncePerDay);
-
- DBWriteContactSettingWord(NULL, ModuleName, "DlgTimeout", commonData.cDlgTimeout);
-
- DBWriteContactSettingByte(NULL, ModuleName, "NotifyFor", commonData.notifyFor);
-
- RefreshAllContactListIcons(oldClistIcon);
-
- UpdateTimers(); //interval might get changed
- break;
- }
- }
- break;
- }
- }
+ CheckDlgButton(hWnd, IDC_USE_POPUPS, commonData.bUsePopups ? BST_CHECKED : BST_UNCHECKED);
+ EnablePopupsGroup(hWnd, commonData.bUsePopups);
+ }
+ else {
+ EnableWindow(GetDlgItem(hWnd, IDC_USE_POPUPS), FALSE);
+ EnablePopupsGroup(hWnd, FALSE);
+ }
+
+ CheckDlgButton(hWnd, IDC_USE_CLISTICON, BST_CHECKED);
+ EnableWindow(GetDlgItem(hWnd, IDC_USE_CLISTICON), FALSE);
+ EnableClistGroup(hWnd, FALSE);
+ }
+ bInitializing = 0;
+ return TRUE;
+
+ case WM_COMMAND:
+ switch (LOWORD(wParam)) {
+ case IDC_CHECK_INTERVAL:
+ case IDC_POPUP_TIMEOUT:
+ case IDC_DAYS_IN_ADVANCE:
+ case IDC_DLG_TIMEOUT:
+ case IDC_SOUND_NEAR_DAYS_EDIT:
+ case IDC_DAYS_AFTER:
+ if ((HIWORD(wParam) == EN_CHANGE) && (!bInitializing))// || (HIWORD(wParam) == CBN_SELENDOK))
+ SendMessage(GetParent(hWnd), PSM_CHANGED, 0, 0);
+ break;
+
+ case IDC_USE_POPUPS:
+ case IDC_USE_CLISTICON:
+ case IDC_USE_DIALOG:
+ EnablePopupsGroup(hWnd, IsDlgButtonChecked(hWnd, IDC_USE_POPUPS));
+ EnableClistGroup(hWnd, IsDlgButtonChecked(hWnd, IDC_USE_CLISTICON));
+ EnableDialogGroup(hWnd, IsDlgButtonChecked(hWnd, IDC_USE_DIALOG));
+ RedrawWindow(GetDlgItem(hWnd, IDC_USE_POPUPS), NULL, NULL, RDW_ERASE | RDW_INVALIDATE);
+ RedrawWindow(GetDlgItem(hWnd, IDC_USE_CLISTICON), NULL, NULL, RDW_ERASE | RDW_INVALIDATE);
+ RedrawWindow(GetDlgItem(hWnd, IDC_USE_DIALOG), NULL, NULL, RDW_ERASE | RDW_INVALIDATE);
+ //fallthrough
+
+ case IDC_FOREGROUND:
+ case IDC_BACKGROUND:
+ case IDC_ADVANCED_ICON:
+ case IDC_IGNORE_SUBCONTACTS:
+ case IDC_AGE_COMBOBOX:
+ case IDC_NOBIRTHDAYS_POPUP:
+ case IDC_DEFAULT_MODULE:
+ case IDC_LEFT_CLICK:
+ case IDC_RIGHT_CLICK:
+ case IDC_ONCE_PER_DAY:
+ case IDC_NOTIFYFOR:
+ SendMessage(GetParent(hWnd), PSM_CHANGED, 0, 0);
+ EnableWindow(GetDlgItem(hWnd, IDC_CHECK_INTERVAL), !IsDlgButtonChecked(hWnd, IDC_ONCE_PER_DAY));
+ break;
+
+ case IDC_PREVIEW:
+ {
+ HANDLE hContact = db_find_first();
+ int dtb = rand() % 11; //0..10
+ int age = rand() % 50 + 1; //1..50
+ PopupNotifyBirthday(hContact, dtb, age);
break;
}
+ }
+ break;
+
+ case WM_NOTIFY:
+ switch(((LPNMHDR)lParam)->idFrom) {
+ case 0:
+ switch (((LPNMHDR)lParam)->code) {
+ case PSN_APPLY:
+ commonData.foreground = SendMessage(GetDlgItem(hWnd, IDC_FOREGROUND), CPM_GETCOLOUR, 0, 0);
+ commonData.background = SendMessage(GetDlgItem(hWnd, IDC_BACKGROUND), CPM_GETCOLOUR, 0, 0);
+ commonData.popupTimeout = POPUP_TIMEOUT;
+ commonData.popupTimeoutToday = POPUP_TIMEOUT;
+ commonData.bUsePopups = IsDlgButtonChecked(hWnd, IDC_USE_POPUPS);
+ commonData.bUseClistIcon = IsDlgButtonChecked(hWnd, IDC_USE_CLISTICON);
+ commonData.bUseDialog = IsDlgButtonChecked(hWnd, IDC_USE_DIALOG);
+ commonData.bIgnoreSubcontacts = IsDlgButtonChecked(hWnd, IDC_IGNORE_SUBCONTACTS);
+ commonData.bNoBirthdaysPopup = IsDlgButtonChecked(hWnd, IDC_NOBIRTHDAYS_POPUP);
+ commonData.cShowAgeMode = SendMessage(GetDlgItem(hWnd, IDC_AGE_COMBOBOX), CB_GETCURSEL, 0, 0);
+ commonData.cDefaultModule = SendMessage(GetDlgItem(hWnd, IDC_DEFAULT_MODULE), CB_GETCURSEL, 0, 0);
+ commonData.lPopupClick = SendMessage(GetDlgItem(hWnd, IDC_LEFT_CLICK), CB_GETCURSEL, 0, 0);
+ commonData.rPopupClick = SendMessage(GetDlgItem(hWnd, IDC_RIGHT_CLICK), CB_GETCURSEL, 0, 0);
+ commonData.bOncePerDay = IsDlgButtonChecked(hWnd, IDC_ONCE_PER_DAY);
+ commonData.notifyFor = SendMessage(GetDlgItem(hWnd, IDC_NOTIFYFOR), CB_GETCURSEL, 0, 0);
+ commonData.bOpenInBackground = IsDlgButtonChecked(hWnd, IDC_OPENINBACKGROUND);
+ {
+ const int maxSize = 1024;
+ TCHAR buffer[maxSize];
+
+ GetWindowText(GetDlgItem(hWnd, IDC_DAYS_IN_ADVANCE), buffer, maxSize);
+ TCHAR *stop = NULL;
+ commonData.daysInAdvance = _tcstol(buffer, &stop, 10);
+
+ if (*stop) { commonData.daysInAdvance = DAYS_TO_NOTIFY; }
+
+ GetWindowText(GetDlgItem(hWnd, IDC_DAYS_AFTER), buffer, maxSize);
+ commonData.daysAfter = _tcstol(buffer, &stop, 10);
+
+ if (*stop) { commonData.daysAfter = DAYS_TO_NOTIFY_AFTER; }
+
+ GetWindowText(GetDlgItem(hWnd, IDC_CHECK_INTERVAL), buffer, maxSize);
+ commonData.checkInterval = _ttol(buffer);
+ if (!commonData.checkInterval) { commonData.checkInterval = CHECK_INTERVAL; }
+
+ GetWindowText(GetDlgItem(hWnd, IDC_POPUP_TIMEOUT), buffer, maxSize);
+ TCHAR *pos;
+ pos = _tcschr(buffer, _T('|'));
+ if (pos) {
+ TCHAR tmp[128];
+ *pos = 0;
+ _tcscpy(tmp, buffer);
+ strtrim(tmp);
+ commonData.popupTimeout = _ttol(tmp);
+
+ _tcscpy(tmp, pos + 1);
+ strtrim(tmp);
+ commonData.popupTimeoutToday = _ttol(tmp);
+
+ }
+ else commonData.popupTimeout = commonData.popupTimeoutToday = _ttol(buffer);
+
+ GetWindowText(GetDlgItem(hWnd, IDC_SOUND_NEAR_DAYS_EDIT), buffer, maxSize);
+ //cSoundNearDays = _ttol(buffer);
+ commonData.cSoundNearDays = _tcstol(buffer, &stop, 10);
+ if (*stop) { commonData.cSoundNearDays = BIRTHDAY_NEAR_DEFAULT_DAYS; }
+
+ GetWindowText(GetDlgItem(hWnd, IDC_DLG_TIMEOUT), buffer, maxSize);
+ commonData.cDlgTimeout = _tcstol(buffer, &stop, 10);
+ if (*stop) { commonData.cDlgTimeout = POPUP_TIMEOUT; }
+
+ DBWriteContactSettingByte(NULL, ModuleName, "IgnoreSubcontacts", commonData.bIgnoreSubcontacts);
+ DBWriteContactSettingByte(NULL, ModuleName, "UsePopups", commonData.bUsePopups);
+ DBWriteContactSettingByte(NULL, ModuleName, "UseClistIcon", commonData.bUseClistIcon);
+ DBWriteContactSettingByte(NULL, ModuleName, "UseDialog", commonData.bUseDialog);
+ DBWriteContactSettingWord(NULL, ModuleName, "CheckInterval", commonData.checkInterval);
+ DBWriteContactSettingWord(NULL, ModuleName, "DaysInAdvance", commonData.daysInAdvance);
+ DBWriteContactSettingWord(NULL, ModuleName, "DaysAfter", commonData.daysAfter);
+ DBWriteContactSettingWord(NULL, ModuleName, "PopupTimeout", commonData.popupTimeout);
+ DBWriteContactSettingWord(NULL, ModuleName, "PopupTimeoutToday", commonData.popupTimeoutToday);
+
+ DBWriteContactSettingByte(NULL, ModuleName, "ShowCurrentAge", commonData.cShowAgeMode);
+ DBWriteContactSettingByte(NULL, ModuleName, "NoBirthdaysPopup", commonData.bNoBirthdaysPopup);
+
+ DBWriteContactSettingByte(NULL, ModuleName, "OpenInBackground", commonData.bOpenInBackground);
+
+ DBWriteContactSettingByte(NULL, ModuleName, "SoundNearDays", commonData.cSoundNearDays);
+
+ DBWriteContactSettingByte(NULL, ModuleName, "DefaultModule", commonData.cDefaultModule);
+
+ DBWriteContactSettingByte(NULL, ModuleName, "PopupLeftClick", commonData.lPopupClick);
+ DBWriteContactSettingByte(NULL, ModuleName, "PopupRightClick", commonData.rPopupClick);
+
+ DBWriteContactSettingDword(NULL, ModuleName, "Foreground", commonData.foreground);
+ DBWriteContactSettingDword(NULL, ModuleName, "Background", commonData.background);
+
+ DBWriteContactSettingByte(NULL, ModuleName, "OncePerDay", commonData.bOncePerDay);
+
+ DBWriteContactSettingWord(NULL, ModuleName, "DlgTimeout", commonData.cDlgTimeout);
+
+ DBWriteContactSettingByte(NULL, ModuleName, "NotifyFor", commonData.notifyFor);
+
+ RefreshAllContactListIcons();
+
+ UpdateTimers(); //interval might get changed
+ }
+ bInitializing = 0;
+ }
+ break;
+ }
+ break;
}
return 0;
}
diff --git a/plugins/WhenWasIt/src/hooked_events.cpp b/plugins/WhenWasIt/src/hooked_events.cpp
index fda21c0aea..bb2d44dd9b 100644
--- a/plugins/WhenWasIt/src/hooked_events.cpp
+++ b/plugins/WhenWasIt/src/hooked_events.cpp
@@ -93,16 +93,12 @@ int UnhookEvents()
int OnModulesLoaded(WPARAM wParam, LPARAM lParam)
{
hIconsChanged = HookEvent(ME_SKIN2_ICONSCHANGED, OnIconsChanged);
- hExtraIconListRebuild = HookEvent(ME_CLIST_EXTRA_LIST_REBUILD, OnExtraIconListRebuild);
- hExtraImageApply = HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY, OnExtraImageApply);
hContactSettingChanged = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, OnContactSettingChanged);
hTopToolBarModuleLoaded = HookEvent(ME_TTB_MODULELOADED, OnTopToolBarModuleLoaded);
SkinAddNewSoundEx(BIRTHDAY_NEAR_SOUND, LPGEN("WhenWasIt"), LPGEN("Birthday near"));
SkinAddNewSoundEx(BIRTHDAY_TODAY_SOUND, LPGEN("WhenWasIt"), LPGEN("Birthday today"));
- RebuildAdvIconList();
-
UpdateTimers();
CLISTMENUITEM cl = {0};
cl.cbSize = sizeof(CLISTMENUITEM);
@@ -224,20 +220,9 @@ int OnIconsChanged(WPARAM wParam, LPARAM lParam)
int OnContactSettingChanged(WPARAM wParam, LPARAM lParam)
{
DBCONTACTWRITESETTING *dw = (DBCONTACTWRITESETTING *) lParam;
- //static HANDLE oldContact = NULL;
DBVARIANT dv = dw->value;
if ((strcmp(dw->szModule, DUMMY_MODULE) == 0) && (strcmp(dw->szSetting, DUMMY_SETTING) == 0))
- {
- OnExtraImageApply(wParam, 0);
- }
- //oldContact = (HANDLE) wParam;
-
- return 0;
-}
-
-int OnExtraIconListRebuild(WPARAM wParam, LPARAM lParam)
-{
- RebuildAdvIconList();
+ OnExtraImageApply(wParam, 0);
return 0;
}
@@ -245,109 +230,71 @@ int OnExtraIconListRebuild(WPARAM wParam, LPARAM lParam)
int OnExtraImageApply(WPARAM wParam, LPARAM lParam)
{
HANDLE hContact = (HANDLE) wParam;
- if ((hContact))
+ if (hContact == 0)
+ return 0;
+
+ int count = CallService(MS_DB_CONTACT_GETCOUNT, 0, 0);
+ int hidden = DBGetContactSettingByte(hContact, "CList", "Hidden", 0);
+ int ignored = DBGetContactSettingDword(hContact, "Ignore", "Mask1", 0);
+ ignored = ((ignored & 0x3f) != 0) ? 1 : 0;
+ int ok = 1;
+ if (commonData.notifyFor & EXCLUDE_HIDDEN)
+ ok &= (hidden == 0);
+
+ if (commonData.notifyFor & EXCLUDE_IGNORED)
+ ok &= (ignored == 0);
+
+ time_t today = Today();
+
+ int dtb = NotifyContactBirthday(hContact, today, commonData.daysInAdvance);
+ int dab = NotifyMissedContactBirthday(hContact, today, commonData.daysAfter);
+
+ if (ok && (dtb >= 0 || dab > 0)) {
+ int age = GetContactAge(hContact);
+ DBWriteContactSettingByte(hContact, "UserInfo", "Age", age);
+
+ if ((bShouldCheckBirthdays) && (commonData.bUsePopups))
{
- int count = CallService(MS_DB_CONTACT_GETCOUNT, 0, 0);
- //int daysInAdvance = DBGetContactSettingWord(NULL, ModuleName, "DaysInAdvance", DAYS_TO_NOTIFY);
- //int popupTimeout = DBGetContactSettingWord(NULL, ModuleName, "PopupTimeout", POPUP_TIMEOUT);
- //DWORD foreground = DBGetContactSettingDword(NULL, ModuleName, "Foreground", FOREGROUND_COLOR);
- //DWORD background = DBGetContactSettingDword(NULL, ModuleName, "Background", BACKGROUND_COLOR);
- //int bUsePopups = DBGetContactSettingByte(NULL, ModuleName, "UsePopups", TRUE);
- //int bUseClistIcon = DBGetContactSettingByte(NULL, ModuleName, "UseClistIcon", TRUE);
- //int bUseDialog = DBGetContactSettingByte(NULL, ModuleName, "UseDialog", TRUE);
- //int clistIcon = DBGetContactSettingByte(NULL, ModuleName, "AdvancedIcon", CLIST_ICON);
- //int notifyFor = DBGetContactSettingByte(NULL, ModuleName, "NotifyFor", 0);
- int hidden = DBGetContactSettingByte(hContact, "CList", "Hidden", 0);
- int ignored = DBGetContactSettingDword(hContact, "Ignore", "Mask1", 0);
- ignored = ((ignored & 0x3f) != 0) ? 1 : 0;
- int ok = 1;
- if (commonData.notifyFor & EXCLUDE_HIDDEN)
- {
- ok &= (hidden == 0);
- }
- if (commonData.notifyFor & EXCLUDE_IGNORED)
- {
- ok &= (ignored == 0);
- }
-
- int dtb;
- int dab;
- int caps = ServiceExists(MS_CLIST_EXTRA_ADD_ICON); // CallService(MS_CLUI_GETCAPS, 0, 0);
-
- time_t today = Today();
-
- if ((ok) && (((dtb = NotifyContactBirthday(hContact, today, commonData.daysInAdvance)) >= 0) || ((dab = NotifyMissedContactBirthday(hContact, today, commonData.daysAfter)) > 0)))
- {
- int age = GetContactAge(hContact);
- DBWriteContactSettingByte(hContact, "UserInfo", "Age", age);
-
- if ((bShouldCheckBirthdays) && (commonData.bUsePopups))
- {
- if (dtb >= 0)
- {
- bBirthdayFound = 1; //only set it if we're called from our CheckBirthdays service
- PopupNotifyBirthday(hContact, dtb, age);
- }
- else if (dab > 0)
- {
- PopupNotifyMissedBirthday(hContact, dab, age);
- }
- }
-
- if (bShouldCheckBirthdays)
- {
- if (dtb >= 0)
- {
- SoundNotifyBirthday(dtb);
- }
- }
-
- if ((bShouldCheckBirthdays) && (commonData.bUseDialog))
- {
- if (dtb >= 0)
- {
- DialogNotifyBirthday(hContact, dtb, age);
- }
- else if (dab > 0)
- {
- DialogNotifyMissedBirthday(hContact, dab, age);
- }
- }
-
- if ((caps > 0) && (commonData.bUseClistIcon)) //TODO
- {
- if (dtb >= 0)
- {
- ClistIconNotifyBirthday(hContact, dtb, commonData.clistIcon);
- }
- }
- }
- else{
- if (caps > 0) //TODO
- { //clear the icon
- ClearClistIcon(hContact, commonData.clistIcon);
- }
+ if (dtb >= 0) {
+ bBirthdayFound = 1; //only set it if we're called from our CheckBirthdays service
+ PopupNotifyBirthday(hContact, dtb, age);
}
+ else if (dab > 0)
+ PopupNotifyMissedBirthday(hContact, dab, age);
}
-
+
+ if (bShouldCheckBirthdays)
+ if (dtb >= 0)
+ SoundNotifyBirthday(dtb);
+
+ if ((bShouldCheckBirthdays) && (commonData.bUseDialog)) {
+ if (dtb >= 0)
+ DialogNotifyBirthday(hContact, dtb, age);
+ else if (dab > 0)
+ DialogNotifyMissedBirthday(hContact, dab, age);
+ }
+
+ if (commonData.bUseClistIcon) //TODO
+ if (dtb >= 0)
+ ClistIconNotifyBirthday(hContact, dtb);
+ }
+ else ClearClistIcon(hContact);
+
return 0;
}
int UpdateTimers()
{
- if (hCheckTimer)
- {
- KillTimer(NULL, hCheckTimer);
- hCheckTimer = NULL;
- }
- long interval;
- interval = DBGetContactSettingDword(NULL, ModuleName, "Interval", CHECK_INTERVAL);
+ if (hCheckTimer) {
+ KillTimer(NULL, hCheckTimer);
+ hCheckTimer = NULL;
+ }
+
+ long interval = DBGetContactSettingDword(NULL, ModuleName, "Interval", CHECK_INTERVAL);
interval *= 1000 * 60 * 60; //go from miliseconds to hours
hCheckTimer = SetTimer(NULL, 0, interval, (TIMERPROC) OnCheckTimer);
if (!hDateChangeTimer)
- {
- hDateChangeTimer = SetTimer(NULL, 0, 1000 * DATE_CHANGE_CHECK_INTERVAL, (TIMERPROC) OnDateChangeTimer);
- }
+ hDateChangeTimer = SetTimer(NULL, 0, 1000 * DATE_CHANGE_CHECK_INTERVAL, (TIMERPROC) OnDateChangeTimer);
return 0;
}
@@ -355,18 +302,17 @@ int UpdateTimers()
int KillTimers()
{
Log("%s", "Entering function " __FUNCTION__);
- if (hCheckTimer)
- {
- KillTimer(NULL, hCheckTimer);
- hCheckTimer = NULL;
- }
- if (hDateChangeTimer)
- {
- KillTimer(NULL, hDateChangeTimer);
- hDateChangeTimer = NULL;
- }
+ if (hCheckTimer) {
+ KillTimer(NULL, hCheckTimer);
+ hCheckTimer = NULL;
+ }
+
+ if (hDateChangeTimer) {
+ KillTimer(NULL, hDateChangeTimer);
+ hDateChangeTimer = NULL;
+ }
+
Log("%s", "Leaving function " __FUNCTION__);
-
return 0;
}
diff --git a/plugins/WhenWasIt/src/hooked_events.h b/plugins/WhenWasIt/src/hooked_events.h
index 69c75f0531..30e2c2455a 100644
--- a/plugins/WhenWasIt/src/hooked_events.h
+++ b/plugins/WhenWasIt/src/hooked_events.h
@@ -36,7 +36,6 @@ int OnModulesLoaded(WPARAM wParam, LPARAM lParam);
int OnTopToolBarModuleLoaded(WPARAM wParam, LPARAM lParam);
int OnOptionsInitialise(WPARAM wParam, LPARAM lParam);
int OnIconsChanged(WPARAM wParam, LPARAM lParam);
-int OnExtraIconListRebuild(WPARAM wParam, LPARAM lParam);
int OnExtraImageApply(WPARAM wParam, LPARAM lParam);
int OnContactSettingChanged(WPARAM wParam, LPARAM lParam);
diff --git a/plugins/WhenWasIt/src/icons.cpp b/plugins/WhenWasIt/src/icons.cpp
index ffa5e1e9ee..6ac1627e97 100644
--- a/plugins/WhenWasIt/src/icons.cpp
+++ b/plugins/WhenWasIt/src/icons.cpp
@@ -67,9 +67,7 @@ int LoadIcons()
AddIcons();
GetIcons();
- if (ServiceExists(MS_EXTRAICON_REGISTER))
- hWWIExtraIcons = ExtraIcon_Register("WhenWasIt", Translate("WhenWasIt birthday reminder"), "MenuCheck", OnExtraIconListRebuild, OnExtraImageApply);
-
+ hWWIExtraIcons = ExtraIcon_Register("WhenWasIt", Translate("WhenWasIt birthday reminder"), "MenuCheck");
return 0;
}
@@ -123,8 +121,7 @@ void FreeIcon(HICON &icon)
void FreeIcons()
{
static int bFreed = 0;
- if (!bFreed)
- {
+ if (!bFreed) {
FreeIcon(hiCheckMenu);
FreeIcon(hiListMenu);
FreeIcon(hiAddBirthdayContact);
@@ -133,11 +130,9 @@ void FreeIcons()
FreeIcon(hiImportBirthdays);
FreeIcon(hiExportBirthdays);
- int i;
- for (i = 0; i < cDTB; i++)
- {
+ for (int i = 0; i < cDTB; i++)
FreeIcon(hiDTB[i]);
- }
+
FreeIcon(hiDTBMore);
}
bFreed = 1; //only free them once (ours).
@@ -183,21 +178,3 @@ HANDLE GetClistIcon(int dtb)
return hClistImages[dtb];
}
-
-HANDLE RebuildCListIcon(HICON icon)
-{
- INT_PTR tmp = CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM) icon, 0);
- if (tmp != CALLSERVICE_NOTFOUND)
- return (HANDLE) tmp;
-
- return (HANDLE) -1;
-}
-
-int RebuildAdvIconList()
-{
- for (int i = 0; i < cDTB; i++)
- hClistImages[i] = RebuildCListIcon(hiDTB[i]);
-
- hClistImages[cDTB] = RebuildCListIcon(hiDTBMore);
- return 0;
-}
diff --git a/plugins/WhenWasIt/src/icons.h b/plugins/WhenWasIt/src/icons.h
index f9d85ce7a4..d3f312fe46 100644
--- a/plugins/WhenWasIt/src/icons.h
+++ b/plugins/WhenWasIt/src/icons.h
@@ -41,8 +41,6 @@ int LoadIcons();
int AddIcons();
int GetIcons();
-int RebuildAdvIconList();
-
HICON GetDTBIcon(int dtb);
HICON GetDABIcon(int dtb);
HANDLE GetClistIcon(int dtb);
diff --git a/plugins/WhenWasIt/src/notifiers.cpp b/plugins/WhenWasIt/src/notifiers.cpp
index 5b1e569ea2..2cc37e28a8 100644
--- a/plugins/WhenWasIt/src/notifiers.cpp
+++ b/plugins/WhenWasIt/src/notifiers.cpp
@@ -23,8 +23,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
void FillPopupData(POPUPDATAT &pd, int dtb)
{
- //DWORD foreground = DBGetContactSettingDword(NULL, ModuleName, "Foreground", FOREGROUND_COLOR);
- //DWORD background = DBGetContactSettingDword(NULL, ModuleName, "Background", BACKGROUND_COLOR);
int popupTimeout = (dtb == 0) ? commonData.popupTimeoutToday : commonData.popupTimeout;
pd.colorBack = commonData.background;
@@ -40,26 +38,17 @@ int PopupNotifyNoBirthdays()
_tcscpy(pd.lptzContactName, TranslateT("WhenWasIt"));
_tcscpy(pd.lptzText, TranslateT("No upcoming birthdays."));
-
-
return PUAddPopUpT(&pd);
}
TCHAR *BuildDTBText(int dtb, TCHAR *name, TCHAR *text, int size)
{
if (dtb > 1)
- {
mir_sntprintf(text, size, TranslateT("%s has birthday in %d days."), name, dtb);
- }
- else{
- if (dtb == 1)
- {
- mir_sntprintf(text, size, TranslateT("%s has birthday tomorrow."), name);
- }
- else{
- mir_sntprintf(text, size, TranslateT("%s has birthday today."), name);
- }
- }
+ else if (dtb == 1)
+ mir_sntprintf(text, size, TranslateT("%s has birthday tomorrow."), name);
+ else
+ mir_sntprintf(text, size, TranslateT("%s has birthday today."), name);
return text;
}
@@ -67,18 +56,11 @@ TCHAR *BuildDTBText(int dtb, TCHAR *name, TCHAR *text, int size)
TCHAR *BuildDABText(int dab, TCHAR *name, TCHAR *text, int size)
{
if (dab > 1)
- {
mir_sntprintf(text, size, TranslateT("%s had birthday %d days ago."), name, dab);
- }
- else{
- if (dab == 1)
- {
- mir_sntprintf(text, size, TranslateT("%s had birthday yesterday."), name);
- }
- else{
- mir_sntprintf(text, size, TranslateT("%s has birthday today (Should not happen, please report)."), name);
- }
- }
+ else if (dab == 1)
+ mir_sntprintf(text, size, TranslateT("%s had birthday yesterday."), name);
+ else
+ mir_sntprintf(text, size, TranslateT("%s has birthday today (Should not happen, please report)."), name);
return text;
}
@@ -113,32 +95,22 @@ int PopupNotifyBirthday(HANDLE hContact, int dtb, int age)
//strcpy(pd.lpzContactName, text);
_stprintf(pd.lptzContactName, TranslateT("Birthday - %s"), name);
TCHAR *sex;
- switch (toupper(gender))
- {
- case _T('M'):
- {
- sex = TranslateT("He");
- break;
- }
- case _T('F'):
- {
- sex = TranslateT("She");
- break;
- }
- default:
- {
- sex = TranslateT("He/She");
- break;
- }
- }
+ switch (toupper(gender)) {
+ case _T('M'):
+ sex = TranslateT("He");
+ break;
+ case _T('F'):
+ sex = TranslateT("She");
+ break;
+ default:
+ sex = TranslateT("He/She");
+ break;
+ }
if (dtb > 0)
- {
- _stprintf(pd.lptzText, TranslateT("%s\n%s will be %d years old."), text, sex, age);
- }
- else{
- _stprintf(pd.lptzText, TranslateT("%s\n%s just turned %d."), text, sex, age);
- }
-
+ _stprintf(pd.lptzText, TranslateT("%s\n%s will be %d years old."), text, sex, age);
+ else
+ _stprintf(pd.lptzText, TranslateT("%s\n%s just turned %d."), text, sex, age);
+
PUAddPopUpT(&pd);
free(name);
@@ -151,14 +123,11 @@ int PopupNotifyMissedBirthday(HANDLE hContact, int dab, int age)
const int MAX_SIZE = 1024;
TCHAR text[MAX_SIZE];
//int bIgnoreSubcontacts = DBGetContactSettingByte(NULL, ModuleName, "IgnoreSubcontacts", FALSE);
- if (commonData.bIgnoreSubcontacts)
- {
- HANDLE hMetacontact = (HANDLE) CallService(MS_MC_GETMETACONTACT, (WPARAM) hContact, 0);
- if ((hMetacontact) && (hMetacontact != hContact)) //not main metacontact
- {
- return 0;
- }
- }
+ if (commonData.bIgnoreSubcontacts) {
+ HANDLE hMetacontact = (HANDLE) CallService(MS_MC_GETMETACONTACT, (WPARAM) hContact, 0);
+ if (hMetacontact && hMetacontact != hContact) //not main metacontact
+ return 0;
+ }
BuildDABText(dab, name, text, MAX_SIZE);
int gender = GetContactGender(hContact);
@@ -166,40 +135,25 @@ int PopupNotifyMissedBirthday(HANDLE hContact, int dab, int age)
FillPopupData(pd, dab);
pd.lchContact = hContact;
pd.PluginWindowProc = (WNDPROC) DlgProcPopup;
- //pd.PluginData = (void *) hContact;
- //pd.colorBack = background;
- //pd.colorText = foreground;
- //pd.iSeconds = popupTimeout;
pd.lchIcon = GetDABIcon(dab);
- //strcpy(pd.lpzContactName, text);
_stprintf(pd.lptzContactName, TranslateT("Birthday - %s"), name);
TCHAR *sex;
- switch (toupper(gender))
- {
- case _T('M'):
- {
- sex = TranslateT("He");
- break;
- }
- case _T('F'):
- {
- sex = TranslateT("She");
- break;
- }
- default:
- {
- sex = TranslateT("He/She");
- break;
- }
- }
+ switch (toupper(gender)) {
+ case _T('M'):
+ sex = TranslateT("He");
+ break;
+ case _T('F'):
+ sex = TranslateT("She");
+ break;
+ default:
+ sex = TranslateT("He/She");
+ break;
+ }
if (dab > 0)
- {
- _stprintf(pd.lptzText, TranslateT("%s\n%s just turned %d."), text, sex, age);
- }
- else{
- _stprintf(pd.lptzText, TranslateT("%s\n%s just turned %d."), text, sex, age);
- }
+ _stprintf(pd.lptzText, TranslateT("%s\n%s just turned %d."), text, sex, age);
+ else
+ _stprintf(pd.lptzText, TranslateT("%s\n%s just turned %d."), text, sex, age);
PUAddPopUpT(&pd);
free(name);
@@ -207,20 +161,9 @@ int PopupNotifyMissedBirthday(HANDLE hContact, int dab, int age)
return 0;
}
-int ClistIconNotifyBirthday(HANDLE hContact, int dtb, int advancedIcon)
+int ClistIconNotifyBirthday(HANDLE hContact, int dtb)
{
- if (ServiceExists(MS_EXTRAICON_SET_ICON))
- {
- ExtraIcon_SetIcon(hWWIExtraIcons, hContact, GetClistIcon(dtb));
- }
- else {
- IconExtraColumn iec = {0};
- iec.cbSize = sizeof(IconExtraColumn);
- iec.ColumnType = advancedIcon;
- iec.hImage = GetClistIcon(dtb);
- CallService(MS_CLIST_EXTRA_SET_ICON, (WPARAM) hContact, (LPARAM) &iec);
- }
-
+ ExtraIcon_SetIcon(hWWIExtraIcons, hContact, GetClistIcon(dtb));
return 0;
}
@@ -231,8 +174,7 @@ int DialogNotifyBirthday(HANDLE hContact, int dtb, int age)
TCHAR text[MAX_SIZE];
BuildDTBText(dtb, name, text, MAX_SIZE);
- if (!hUpcomingDlg)
- {
+ if (!hUpcomingDlg) {
hUpcomingDlg = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_UPCOMING), NULL, DlgProcUpcoming);
ShowWindow(hUpcomingDlg, commonData.bOpenInBackground ? SW_SHOWNOACTIVATE : SW_SHOW);
}
@@ -258,8 +200,7 @@ int DialogNotifyMissedBirthday(HANDLE hContact, int dab, int age)
TCHAR text[MAX_SIZE];
BuildDABText(dab, name, text, MAX_SIZE);
- if (!hUpcomingDlg)
- {
+ if (!hUpcomingDlg) {
hUpcomingDlg = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_UPCOMING), NULL, DlgProcUpcoming);
ShowWindow(hUpcomingDlg, commonData.bOpenInBackground ? SW_SHOWNOACTIVATE : SW_SHOW);
}
@@ -280,48 +221,22 @@ int DialogNotifyMissedBirthday(HANDLE hContact, int dab, int age)
int SoundNotifyBirthday(int dtb)
{
- //int daysToPlay = DBGetContactSettingByte(NULL, ModuleName, "SoundNearDays", BIRTHDAY_NEAR_DEFAULT_DAYS);
if (dtb == 0)
- {
- SkinPlaySound(BIRTHDAY_TODAY_SOUND);
- }
- else{
- if (dtb <= commonData.cSoundNearDays)
- {
- SkinPlaySound(BIRTHDAY_NEAR_SOUND);
- }
- }
-
+ SkinPlaySound(BIRTHDAY_TODAY_SOUND);
+ else if (dtb <= commonData.cSoundNearDays)
+ SkinPlaySound(BIRTHDAY_NEAR_SOUND);
+
return 0;
}
-int ClearClistIcon(HANDLE hContact, int advancedIcon)
+int ClearClistIcon(HANDLE hContact)
{
- if (ServiceExists(MS_EXTRAICON_SET_ICON))
- {
- return ExtraIcon_SetIcon(hWWIExtraIcons, hContact, (HANDLE) -1);
- }
- else {
- IconExtraColumn iec = {0};
- iec.cbSize = sizeof(IconExtraColumn);
- iec.ColumnType = advancedIcon;
- iec.hImage = (HANDLE) -1;
-
- return CallService(MS_CLIST_EXTRA_SET_ICON, (WPARAM) hContact, (LPARAM) &iec);
- }
+ return ExtraIcon_SetIcon(hWWIExtraIcons, hContact, INVALID_HANDLE_VALUE);
}
int RefreshContactListIcons(HANDLE hContact)
{
- //if (DBGetContactSettingWord(hContact, DUMMY_MODULE, DUMMY_SETTING, 0) != 0)
- // {
- // DBDeleteContactSetting(hContact, DUMMY_MODULE, DUMMY_SETTING);
- // }
- // else{
- // DBWriteContactSettingWord(hContact, DUMMY_MODULE, DUMMY_SETTING, 101);
- // }
OnExtraImageApply((WPARAM) hContact, 0);
-
return 0;
}
@@ -330,14 +245,12 @@ int RefreshContactListIcons(HANDLE hContact)
int RefreshAllContactListIcons(int oldClistIcon)
{
HANDLE hContact = db_find_first();
- while (hContact != NULL)
- {
- if (oldClistIcon != -1)
- {
- ClearClistIcon(hContact, oldClistIcon);
- }
- RefreshContactListIcons(hContact); //will change bBirthdayFound if needed
- hContact = db_find_next(hContact);
- }
+ while (hContact != NULL) {
+ if (oldClistIcon != -1)
+ ClearClistIcon(hContact);
+
+ RefreshContactListIcons(hContact); //will change bBirthdayFound if needed
+ hContact = db_find_next(hContact);
+ }
return 0;
-} \ No newline at end of file
+}
diff --git a/plugins/WhenWasIt/src/notifiers.h b/plugins/WhenWasIt/src/notifiers.h
index db43ca55e1..149cd6a3bb 100644
--- a/plugins/WhenWasIt/src/notifiers.h
+++ b/plugins/WhenWasIt/src/notifiers.h
@@ -47,12 +47,12 @@ typedef TUpcomingBirthday *PUpcomingBirthday;
int PopupNotifyNoBirthdays();
int PopupNotifyBirthday(HANDLE hContact, int dtb, int age);
int PopupNotifyMissedBirthday(HANDLE hContact, int dab, int age);
-int ClistIconNotifyBirthday(HANDLE hContact, int dtb, int advancedIcon);
int DialogNotifyBirthday(HANDLE hContact, int dtb, int age);
int DialogNotifyMissedBirthday(HANDLE hContact, int dab, int age);
int SoundNotifyBirthday(int dtb);
-int ClearClistIcon(HANDLE hContact, int advancedIcon);
+int ClistIconNotifyBirthday(HANDLE hContact, int dtb);
+int ClearClistIcon(HANDLE hContact);
int RefreshContactListIcons(HANDLE hContact);
int RefreshAllContactListIcons(int oldClistIcon = -1);
diff --git a/plugins/WhenWasIt/src/services.cpp b/plugins/WhenWasIt/src/services.cpp
index 7fc5d22d52..6da69a5a23 100644
--- a/plugins/WhenWasIt/src/services.cpp
+++ b/plugins/WhenWasIt/src/services.cpp
@@ -47,7 +47,6 @@ int InitServices()
commonData.bUsePopups = DBGetContactSettingByte(NULL, ModuleName, "UsePopups", TRUE);
commonData.bUseClistIcon = DBGetContactSettingByte(NULL, ModuleName, "UseClistIcon", TRUE);
commonData.bUseDialog = DBGetContactSettingByte(NULL, ModuleName, "UseDialog", TRUE);
- commonData.clistIcon= DBGetContactSettingByte(NULL, ModuleName, "AdvancedIcon", CLIST_ICON);
commonData.bIgnoreSubcontacts = DBGetContactSettingByte(NULL, ModuleName, "IgnoreSubcontacts", FALSE);
commonData.cShowAgeMode = DBGetContactSettingByte(NULL, ModuleName, "ShowCurrentAge", FALSE);
commonData.bNoBirthdaysPopup = DBGetContactSettingByte(NULL, ModuleName, "NoBirthdaysPopup", FALSE);
diff --git a/plugins/Zlib/zlib_10.vcxproj b/plugins/Zlib/zlib_10.vcxproj
index 5828e300b4..5305e8dc24 100644
--- a/plugins/Zlib/zlib_10.vcxproj
+++ b/plugins/Zlib/zlib_10.vcxproj
@@ -204,9 +204,6 @@
<ClInclude Include="src\zutil.h" />
</ItemGroup>
<ItemGroup>
- <None Include="src\zlib.def" />
- </ItemGroup>
- <ItemGroup>
<ResourceCompile Include="res\zlib.rc" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
diff --git a/plugins/Zlib/zlib_10.vcxproj.filters b/plugins/Zlib/zlib_10.vcxproj.filters
index 5d70c590f6..a039fe224c 100644
--- a/plugins/Zlib/zlib_10.vcxproj.filters
+++ b/plugins/Zlib/zlib_10.vcxproj.filters
@@ -86,11 +86,6 @@
</ClInclude>
</ItemGroup>
<ItemGroup>
- <None Include="src\zlib.def">
- <Filter>Source Files</Filter>
- </None>
- </ItemGroup>
- <ItemGroup>
<ResourceCompile Include="res\zlib.rc">
<Filter>Resource Files</Filter>
</ResourceCompile>
diff --git a/protocols/AimOscar/src/aim.cpp b/protocols/AimOscar/src/aim.cpp
index 1cc9482e14..32ce3f8c58 100644
--- a/protocols/AimOscar/src/aim.cpp
+++ b/protocols/AimOscar/src/aim.cpp
@@ -21,13 +21,10 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
char AIM_CAP_MIRANDA[16] = "MirandaA";
-
int hLangpack;
HINSTANCE hInstance;
-static HANDLE hMooduleLoaded;
-
/////////////////////////////////////////////////////////////////////////////
// Protocol instances
static int sttCompareProtocols(const CAimProto *p1, const CAimProto *p2)
@@ -108,7 +105,7 @@ extern "C" int __declspec(dllexport) Load(void)
mir_getLP(&pluginInfo);
- hMooduleLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
+ HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
PROTOCOLDESCRIPTOR pd = {0};
pd.cbSize = sizeof(pd);
@@ -130,8 +127,5 @@ extern "C" int __declspec(dllexport) Load(void)
extern "C" int __declspec(dllexport) Unload(void)
{
aim_links_destroy();
- UnhookEvent(hMooduleLoaded);
-
- DestroyExtraIcons();
return 0;
}
diff --git a/protocols/AimOscar/src/theme.cpp b/protocols/AimOscar/src/theme.cpp
index cec3df5708..9ba7307d0d 100644
--- a/protocols/AimOscar/src/theme.cpp
+++ b/protocols/AimOscar/src/theme.cpp
@@ -139,7 +139,6 @@ extern OBJLIST<CAimProto> g_Instances;
static HANDLE bot_icon, icq_icon, aol_icon, hiptop_icon;
static HANDLE admin_icon, confirmed_icon, unconfirmed_icon;
-static HANDLE hListRebuld, hIconApply;
static HANDLE hExtraAT, hExtraES;
static const char* extra_AT_icon_name[5] =
@@ -160,48 +159,14 @@ static const char* extra_ES_icon_name[2] =
static HANDLE extra_AT_icon_handle[5];
static HANDLE extra_ES_icon_handle[2];
-static void load_extra_icons(void)
-{
- if (!ServiceExists(MS_CLIST_EXTRA_ADD_ICON)) return;
-
- unsigned i;
-
- for (i = 0; i < SIZEOF(extra_AT_icon_handle); ++i)
- {
- extra_AT_icon_handle[i] = (HANDLE)CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM)LoadIconEx(extra_AT_icon_name[i]), 0);
- ReleaseIconEx(extra_AT_icon_name[i]);
- }
-
- for (i = 0; i < SIZEOF(extra_ES_icon_handle); ++i)
- {
- extra_ES_icon_handle[i] = (HANDLE)CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM)LoadIconEx(extra_ES_icon_name[i]), 0);
- ReleaseIconEx(extra_ES_icon_name[i]);
- }
-}
-
-static void set_extra_icon(HANDLE hContact, HANDLE hImage, int column_type)
-{
- IconExtraColumn iec;
- iec.cbSize = sizeof(iec);
- iec.hImage = hImage;
- iec.ColumnType = column_type;
- CallService(MS_CLIST_EXTRA_SET_ICON, (WPARAM)hContact, (LPARAM)&iec);
-}
-
static void clear_AT_icon(HANDLE hContact)
{
- if (hExtraAT)
- ExtraIcon_SetIcon(hExtraAT, hContact, (char*)NULL);
- else
- set_extra_icon(hContact, (HANDLE)-1, EXTRA_ICON_ADV2);
+ ExtraIcon_SetIcon(hExtraAT, hContact, (char*)NULL);
}
static void clear_ES_icon(HANDLE hContact)
{
- if (hExtraES)
- ExtraIcon_SetIcon(hExtraES, hContact, (char*)NULL);
- else
- set_extra_icon(hContact, (HANDLE)-1, EXTRA_ICON_ADV3);
+ ExtraIcon_SetIcon(hExtraES, hContact, (char*)NULL);
}
static void set_AT_icon(CAimProto* ppro, HANDLE hContact)
@@ -210,19 +175,12 @@ static void set_AT_icon(CAimProto* ppro, HANDLE hContact)
unsigned i = ppro->getByte(hContact, AIM_KEY_AC, 0) - 1;
- if (hExtraAT)
- {
- if (i < 5)
- {
- char name[64];
- mir_snprintf(name, sizeof(name), "AIM_%s", extra_AT_icon_name[i]);
- ExtraIcon_SetIcon(hExtraAT, hContact, name);
- }
- else
- ExtraIcon_SetIcon(hExtraAT, hContact, (char*)NULL);
+ if (i < 5) {
+ char name[64];
+ mir_snprintf(name, sizeof(name), "AIM_%s", extra_AT_icon_name[i]);
+ ExtraIcon_SetIcon(hExtraAT, hContact, name);
}
- else
- set_extra_icon(hContact, i < 5 ? extra_AT_icon_handle[i] : (HANDLE)-1, EXTRA_ICON_ADV2);
+ else ExtraIcon_SetIcon(hExtraAT, hContact, (char*)NULL);
}
static void set_ES_icon(CAimProto* ppro, HANDLE hContact)
@@ -231,19 +189,12 @@ static void set_ES_icon(CAimProto* ppro, HANDLE hContact)
unsigned i = ppro->getByte(hContact, AIM_KEY_ET, 0) - 1;
- if (hExtraES)
- {
- if (i < 2)
- {
- char name[64];
- mir_snprintf(name, sizeof(name), "AIM_%s", extra_ES_icon_name[i]);
- ExtraIcon_SetIcon(hExtraES, hContact, name);
- }
- else
- ExtraIcon_SetIcon(hExtraES, hContact, (char*)NULL);
+ if (i < 2) {
+ char name[64];
+ mir_snprintf(name, sizeof(name), "AIM_%s", extra_ES_icon_name[i]);
+ ExtraIcon_SetIcon(hExtraES, hContact, name);
}
- else
- set_extra_icon(hContact, i < 2 ? extra_ES_icon_handle[i] : (HANDLE)-1, EXTRA_ICON_ADV3);
+ else ExtraIcon_SetIcon(hExtraES, hContact, (char*)NULL);
}
void set_contact_icon(CAimProto* ppro, HANDLE hContact)
@@ -252,37 +203,8 @@ void set_contact_icon(CAimProto* ppro, HANDLE hContact)
if (!ppro->getByte(AIM_KEY_ES, 0)) set_ES_icon(ppro, hContact);
}
-static int OnExtraIconsRebuild(WPARAM /*wParam*/, LPARAM /*lParam*/)
-{
- load_extra_icons();
- return 0;
-}
-
-static int OnExtraIconsApply(WPARAM wParam, LPARAM /*lParam*/)
-{
- if (!ServiceExists(MS_CLIST_EXTRA_SET_ICON)) return 0;
-
- HANDLE hContact = (HANDLE)wParam;
-
- CAimProto *ppro = NULL;
- for (int i = 0; i < g_Instances.getCount(); ++i)
- {
- if (g_Instances[i].is_my_contact(hContact))
- {
- ppro = &g_Instances[i];
- break;
- }
- }
-
- if (ppro) set_contact_icon(ppro, hContact);
-
- return 0;
-}
-
void remove_AT_icons(CAimProto* ppro)
{
- if (!ServiceExists(MS_CLIST_EXTRA_ADD_ICON)) return;
-
HANDLE hContact = db_find_first();
while (hContact)
{
@@ -295,8 +217,6 @@ void remove_AT_icons(CAimProto* ppro)
void remove_ES_icons(CAimProto* ppro)
{
- if (!ServiceExists(MS_CLIST_EXTRA_ADD_ICON)) return;
-
HANDLE hContact = db_find_first();
while (hContact)
{
@@ -334,18 +254,6 @@ void InitExtraIcons(void)
{
hExtraAT = ExtraIcon_Register("aimaccounttype", LPGEN("AIM Account Type"), "AIM_aol");
hExtraES = ExtraIcon_Register("aimextstatus", LPGEN("AIM Extended Status"), "AIM_hiptop");
-
- if (hExtraAT == NULL)
- {
- hListRebuld = HookEvent(ME_CLIST_EXTRA_LIST_REBUILD, OnExtraIconsRebuild);
- hIconApply = HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY, OnExtraIconsApply);
- }
-}
-
-void DestroyExtraIcons(void)
-{
- UnhookEvent(hIconApply);
- UnhookEvent(hListRebuld);
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -371,11 +279,6 @@ void InitThemeSupport(void)
}
}
-void DestroyThemeSupport(void)
-{
- DestroyExtraIcons();
-}
-
/////////////////////////////////////////////////////////////////////////////////////////
// OnPreBuildContactMenu
diff --git a/protocols/AimOscar/src/theme.h b/protocols/AimOscar/src/theme.h
index 41b098aff6..09566479ad 100644
--- a/protocols/AimOscar/src/theme.h
+++ b/protocols/AimOscar/src/theme.h
@@ -28,8 +28,6 @@ void InitThemeSupport(void);
void InitIcons(void);
void InitExtraIcons(void);
-void DestroyExtraIcons(void);
-
HICON LoadIconEx(const char* name, bool big = false);
HANDLE GetIconHandle(const char* name);
void ReleaseIconEx(const char* name, bool big = false);
diff --git a/protocols/AimOscar/src/utility.h b/protocols/AimOscar/src/utility.h
index a6608d38f3..447d78538e 100644
--- a/protocols/AimOscar/src/utility.h
+++ b/protocols/AimOscar/src/utility.h
@@ -22,7 +22,6 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
char *normalize_name(const char *s);
char* trim_str(char* s);
void create_group(const char *group);
-void set_extra_icon(HANDLE hContact, HANDLE hImage, int column_type);
unsigned int aim_oft_checksum_file(TCHAR *filename, unsigned __int64 size = -1);
char* long_ip_to_char_ip(unsigned long host, char* ip);
unsigned long char_ip_to_long_ip(char* ip);
diff --git a/protocols/JabberG/src/jabber.cpp b/protocols/JabberG/src/jabber.cpp
index a3dd31a3fa..b492ffcddb 100644
--- a/protocols/JabberG/src/jabber.cpp
+++ b/protocols/JabberG/src/jabber.cpp
@@ -195,7 +195,6 @@ static int OnModulesLoaded( WPARAM, LPARAM )
// Init extra icons
hExtraActivity = ExtraIcon_Register("activity", "Jabber Activity" /* No icons registered, "working" */);
hExtraMood = ExtraIcon_Register("mood", "Jabber Mood" /* No icons registered, "amazed" */);
-
return 0;
}
diff --git a/protocols/JabberG/src/jabber.h b/protocols/JabberG/src/jabber.h
index 09751bb5b0..cfb87c90ab 100644
--- a/protocols/JabberG/src/jabber.h
+++ b/protocols/JabberG/src/jabber.h
@@ -637,7 +637,7 @@ HXML JabberFormGetData( HWND hwndStatic, HXML xNode );
void g_IconsInit();
HANDLE g_GetIconHandle( int iconId );
HICON g_LoadIconEx( const char* name, bool big = false );
-void g_ReleaseIcon( HICON hIcon );
+void g_ReleaseIcon( HICON hIcon );
void ImageList_AddIcon_Icolib( HIMAGELIST hIml, HICON hIcon );
void WindowSetIcon(HWND hWnd, CJabberProto *proto, const char* name);
diff --git a/protocols/JabberG/src/jabber_icolib.cpp b/protocols/JabberG/src/jabber_icolib.cpp
index 689ace5b09..828951e4ea 100644
--- a/protocols/JabberG/src/jabber_icolib.cpp
+++ b/protocols/JabberG/src/jabber_icolib.cpp
@@ -84,20 +84,20 @@ static int skinStatusToJabberStatus[] = {0,1,2,3,4,4,6,7,2,2};
///////////////////////////////////////////////////////////////////////////////
// CIconPool class
+
int CIconPool::CPoolItem::cmp(const CPoolItem *p1, const CPoolItem *p2)
{
return lstrcmpA(p1->m_name, p2->m_name);
}
CIconPool::CPoolItem::CPoolItem():
- m_name(NULL), m_szIcolibName(NULL), m_hIcolibItem(NULL), m_hClistItem(NULL)
+ m_name(NULL), m_szIcolibName(NULL), m_hIcolibItem(NULL)
{
}
CIconPool::CPoolItem::~CPoolItem()
{
- if (m_hIcolibItem && m_szIcolibName)
- {
+ if (m_hIcolibItem && m_szIcolibName) {
CallService(MS_SKIN2_REMOVEICON, 0, (LPARAM)m_szIcolibName);
mir_free(m_szIcolibName);
}
@@ -114,8 +114,7 @@ CIconPool::CIconPool(CJabberProto *proto):
CIconPool::~CIconPool()
{
- if (m_hOnExtraIconsRebuild)
- {
+ if (m_hOnExtraIconsRebuild) {
UnhookEvent(m_hOnExtraIconsRebuild);
m_hOnExtraIconsRebuild = NULL;
}
@@ -129,7 +128,6 @@ void CIconPool::RegisterIcon(const char *name, const char *filename, int iconid,
CPoolItem *item = new CPoolItem;
item->m_name = mir_strdup(name);
item->m_szIcolibName = mir_strdup(szSettingName);
- item->m_hClistItem = NULL;
SKINICONDESC sid = {0};
sid.cbSize = sizeof(SKINICONDESC);
@@ -168,35 +166,6 @@ HICON CIconPool::GetIcon(const char *name, bool big)
return NULL;
}
-HANDLE CIconPool::GetClistHandle(const char *name)
-{
- if (!name)
- return (HANDLE)-1;
-
- if (!ExtraIconsSupported())
- return (HANDLE)-1;
-
- if (!m_hOnExtraIconsRebuild)
- {
- int (__cdecl CIconPool::*hookProc)(WPARAM, LPARAM);
- hookProc = &CIconPool::OnExtraIconsRebuild;
- m_hOnExtraIconsRebuild = HookEventObj(ME_CLIST_EXTRA_LIST_REBUILD, (MIRANDAHOOKOBJ)*(void **)&hookProc, this);
- }
-
- if (CPoolItem *item = FindItemByName(name))
- {
- if (item->m_hClistItem)
- return item->m_hClistItem;
-
- HICON hIcon = Skin_GetIconByHandle(item->m_hIcolibItem);
- item->m_hClistItem = (HANDLE)CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM)hIcon, 0);
- g_ReleaseIcon(hIcon);
- return item->m_hClistItem;
- }
-
- return (HANDLE)-1;
-}
-
CIconPool::CPoolItem *CIconPool::FindItemByName(const char *name)
{
CPoolItem item;
@@ -204,21 +173,6 @@ CIconPool::CPoolItem *CIconPool::FindItemByName(const char *name)
return m_items.find(&item);
}
-int CIconPool::OnExtraIconsRebuild(WPARAM, LPARAM)
-{
- for (int i = 0; i < m_items.getCount(); ++i)
- m_items[i].m_hClistItem = NULL;
-
- return 0;
-}
-
-bool CIconPool::ExtraIconsSupported()
-{
- static int res = -1;
- if (res < 0) res = ServiceExists(MS_CLIST_EXTRA_ADD_ICON) ? 1 : 0;
- return res ? true : false;
-}
-
/////////////////////////////////////////////////////////////////////////////////////////
// Icons init
diff --git a/protocols/JabberG/src/jabber_icolib.h b/protocols/JabberG/src/jabber_icolib.h
index 4b5f7d8e12..62924e5bae 100644
--- a/protocols/JabberG/src/jabber_icolib.h
+++ b/protocols/JabberG/src/jabber_icolib.h
@@ -38,7 +38,6 @@ public:
HANDLE GetIcolibHandle(const char *name);
char *GetIcolibName(const char *name);
HICON GetIcon(const char *name, bool big = false);
- HANDLE GetClistHandle(const char *name);
private:
struct CPoolItem
@@ -46,7 +45,6 @@ private:
char *m_name;
char *m_szIcolibName;
HANDLE m_hIcolibItem;
- HANDLE m_hClistItem;
static int cmp(const CPoolItem *p1, const CPoolItem *p2);
@@ -59,9 +57,6 @@ private:
HANDLE m_hOnExtraIconsRebuild;
CPoolItem *FindItemByName(const char *name);
-
- int __cdecl OnExtraIconsRebuild(WPARAM, LPARAM);
- static bool ExtraIconsSupported();
};
#endif // _JABBER_ICOLIB_H_
diff --git a/protocols/JabberG/src/jabber_proto.h b/protocols/JabberG/src/jabber_proto.h
index eff59bb002..002408dcae 100644
--- a/protocols/JabberG/src/jabber_proto.h
+++ b/protocols/JabberG/src/jabber_proto.h
@@ -228,8 +228,6 @@ struct CJabberProto : public PROTO_INTERFACE, public MZeroedObject
int __cdecl JabberGcMenuHook( WPARAM, LPARAM );
int __cdecl JabberGcInit( WPARAM, LPARAM );
- int __cdecl CListMW_ExtraIconsApply( WPARAM, LPARAM );
-
// Google Shared Status
BOOL m_bGoogleSharedStatus;
BOOL m_bGoogleSharedStatusLock;
diff --git a/protocols/JabberG/src/jabber_xstatus.cpp b/protocols/JabberG/src/jabber_xstatus.cpp
index 5078d7c5c0..c0e278de66 100644
--- a/protocols/JabberG/src/jabber_xstatus.cpp
+++ b/protocols/JabberG/src/jabber_xstatus.cpp
@@ -713,18 +713,7 @@ void CPepMood::ResetExtraIcon(HANDLE hContact)
void CPepMood::SetExtraIcon(HANDLE hContact, char *szMood)
{
- if (hExtraMood != NULL)
- {
- ExtraIcon_SetIcon(hExtraMood, hContact, szMood == NULL ? NULL : m_icons.GetIcolibName(szMood));
- }
- else
- {
- IconExtraColumn iec;
- iec.cbSize = sizeof(iec);
- iec.hImage = m_icons.GetClistHandle(szMood);
- iec.ColumnType = EXTRA_ICON_ADV1;
- CallService(MS_CLIST_EXTRA_SET_ICON, (WPARAM)hContact, (LPARAM)&iec);
- }
+ ExtraIcon_SetIcon(hExtraMood, hContact, szMood == NULL ? NULL : m_icons.GetIcolibName(szMood));
}
void CPepMood::SetMood(HANDLE hContact, const TCHAR *szMood, const TCHAR *szText)
@@ -1145,19 +1134,7 @@ void CPepActivity::ResetExtraIcon(HANDLE hContact)
void CPepActivity::SetExtraIcon(HANDLE hContact, char *szActivity)
{
- if (hExtraActivity != NULL)
- {
- ExtraIcon_SetIcon(hExtraActivity, hContact,
- szActivity == NULL ? NULL : m_icons.GetIcolibName(szActivity));
- }
- else
- {
- IconExtraColumn iec;
- iec.cbSize = sizeof(iec);
- iec.hImage = m_icons.GetClistHandle(szActivity);
- iec.ColumnType = EXTRA_ICON_ADV2;
- CallService(MS_CLIST_EXTRA_SET_ICON, (WPARAM)hContact, (LPARAM)&iec);
- }
+ ExtraIcon_SetIcon(hExtraActivity, hContact, szActivity == NULL ? NULL : m_icons.GetIcolibName(szActivity));
}
void CPepActivity::SetActivity(HANDLE hContact, LPCTSTR szFirst, LPCTSTR szSecond, LPCTSTR szText)
@@ -1245,19 +1222,6 @@ HICON CJabberProto::GetXStatusIcon(int bStatus, UINT flags)
return ( flags & LR_SHARED ) ? icon : CopyIcon( icon );
}
-int CJabberProto::CListMW_ExtraIconsApply( WPARAM wParam, LPARAM )
-{
- if (m_bJabberOnline && m_bPepSupported && ServiceExists(MS_CLIST_EXTRA_SET_ICON))
- {
- char* szProto = ( char* )CallService( MS_PROTO_GETCONTACTBASEPROTO, wParam, 0 );
- if ( szProto==NULL || strcmp( szProto, m_szModuleName ))
- return 0; // only apply icons to our contacts, do not mess others
-
- m_pepServices.ResetExtraIcon((HANDLE)wParam);
- }
- return 0;
-}
-
/////////////////////////////////////////////////////////////////////////////////////////
// JabberGetXStatus - gets the extended status info (mood)
@@ -1465,12 +1429,9 @@ void CJabberProto::InfoFrame_OnUserActivity(CJabberInfoFrame_Event*)
void CJabberProto::XStatusInit()
{
- if (hExtraMood == NULL)
- JHookEvent( ME_CLIST_EXTRA_IMAGE_APPLY, &CJabberProto::CListMW_ExtraIconsApply );
-
- RegisterAdvStatusSlot( ADVSTATUS_MOOD );
- RegisterAdvStatusSlot( ADVSTATUS_TUNE );
- RegisterAdvStatusSlot( ADVSTATUS_ACTIVITY );
+ RegisterAdvStatusSlot(ADVSTATUS_MOOD);
+ RegisterAdvStatusSlot(ADVSTATUS_TUNE);
+ RegisterAdvStatusSlot(ADVSTATUS_ACTIVITY);
}
void CJabberProto::XStatusUninit()
diff --git a/protocols/MRA/src/Mra.h b/protocols/MRA/src/Mra.h
index 67a5aadcec..a4773a74e0 100644
--- a/protocols/MRA/src/Mra.h
+++ b/protocols/MRA/src/Mra.h
@@ -242,7 +242,7 @@ BOOL IsEMailMR (LPSTR lpszEMail, size_t dwEMailSize);
BOOL GetEMailFromString (LPSTR lpszBuff, size_t dwBuffSize, LPSTR *plpszEMail, size_t *pdwEMailSize);
DWORD CreateBlobFromContact (HANDLE hContact, LPWSTR lpwszRequestReason, size_t dwRequestReasonSize, LPBYTE lpbBuff, size_t dwBuffSize, size_t *pdwBuffSizeRet);
-int ExtraSetIcon (HANDLE hExtraIcon, HANDLE hContact, HANDLE hImage, int iColumnType);
+int ExtraSetIcon (HANDLE hExtraIcon, HANDLE hContact, HANDLE hImage);
size_t CopyNumber (LPCVOID lpcOutBuff, LPCVOID lpcBuff, size_t dwLen);
BOOL IsPhone (LPSTR lpszString, size_t dwStringSize);
BOOL IsContactPhone (HANDLE hContact, LPSTR lpszPhone, size_t dwPhoneSize);
diff --git a/protocols/MRA/src/MraProto.cpp b/protocols/MRA/src/MraProto.cpp
index f1b826767c..5eb10e6832 100644
--- a/protocols/MRA/src/MraProto.cpp
+++ b/protocols/MRA/src/MraProto.cpp
@@ -7,13 +7,6 @@ static int MraExtraIconsApplyAll(WPARAM, LPARAM)
return 0;
}
-static int MraExtraIconsRebuildAll(WPARAM, LPARAM)
-{
- for (int i=0; i < g_Instances.getCount(); i++)
- g_Instances[i]->MraExtraIconsRebuild(0, 0);
- return 0;
-}
-
CMraProto::CMraProto(const char* _module, const TCHAR* _displayName) :
m_bLoggedIn(false)
{
@@ -58,7 +51,6 @@ CMraProto::CMraProto(const char* _module, const TCHAR* _displayName) :
hNetlibUser = (HANDLE)CallService(MS_NETLIB_REGISTERUSER, 0, (LPARAM)&nlu);
HookEvent(ME_SYSTEM_PRESHUTDOWN, &CMraProto::OnPreShutdown);
- HookEvent(ME_CLIST_EXTRA_LIST_REBUILD, &CMraProto::MraExtraIconsRebuild);
InitContactMenu();
@@ -75,10 +67,9 @@ CMraProto::CMraProto(const char* _module, const TCHAR* _displayName) :
HookEvent(ME_CLIST_PREBUILDSTATUSMENU, &CMraProto::MraRebuildStatusMenu);
MraRebuildStatusMenu(0, 0);
- MraExtraIconsRebuild(0, 0);
- hExtraXstatusIcon = ExtraIcon_Register("MRAXstatus", "Mail.ru Xstatus", "MRA_xstatus25", MraExtraIconsRebuildAll, MraExtraIconsApplyAll, NULL, NULL);
- hExtraInfo = ExtraIcon_Register("MRAStatus", "Mail.ru extra info", "MRA_xstatus49", MraExtraIconsRebuildAll, MraExtraIconsApplyAll, NULL, NULL);
+ hExtraXstatusIcon = ExtraIcon_Register("MRAXstatus", "Mail.ru Xstatus", "MRA_xstatus25");
+ hExtraInfo = ExtraIcon_Register("MRAStatus", "Mail.ru extra info", "MRA_xstatus49");
bHideXStatusUI = FALSE;
m_iXStatus = mraGetByte(NULL, DBSETTING_XSTATUSID, MRA_MIR_XSTATUS_NONE);
diff --git a/protocols/MRA/src/MraProto.h b/protocols/MRA/src/MraProto.h
index 7c3302119c..ea2c8da7ff 100644
--- a/protocols/MRA/src/MraProto.h
+++ b/protocols/MRA/src/MraProto.h
@@ -193,7 +193,6 @@ struct CMraProto : public PROTO_INTERFACE, public MZeroedObject
int __cdecl MraChatGcEventHook(WPARAM, LPARAM);
int __cdecl MraExtraIconsApply(WPARAM, LPARAM);
- int __cdecl MraExtraIconsRebuild(WPARAM, LPARAM);
int __cdecl MraContactDeleted(WPARAM, LPARAM);
int __cdecl MraDbSettingChanged(WPARAM, LPARAM);
diff --git a/protocols/MRA/src/Mra_functions.cpp b/protocols/MRA/src/Mra_functions.cpp
index 7083da1b8d..7ea81b6369 100644
--- a/protocols/MRA/src/Mra_functions.cpp
+++ b/protocols/MRA/src/Mra_functions.cpp
@@ -1153,19 +1153,11 @@ void CMraProto::CListShowMenuItem(HANDLE hMenuItem, BOOL bShow)
CallService(MS_CLIST_MODIFYMENUITEM, (WPARAM)hMenuItem, (LPARAM)&mi);
}
-int ExtraSetIcon(HANDLE hExtraIcon, HANDLE hContact, HANDLE hImage, int iColumnType)
+int ExtraSetIcon(HANDLE hExtraIcon, HANDLE hContact, HANDLE hImage)
{
if (hImage == NULL)
hImage = INVALID_HANDLE_VALUE;
-
- if (hExtraIcon)
- return ExtraIcon_SetIcon(hExtraIcon, hContact, hImage);
-
- IconExtraColumn iec;
- iec.cbSize = sizeof(iec);
- iec.ColumnType = iColumnType;
- iec.hImage = hImage;
- return CallService(MS_CLIST_EXTRA_SET_ICON, (WPARAM)hContact, (LPARAM)&iec);
+ return ExtraIcon_SetIcon(hExtraIcon, hContact, hImage);
}
size_t CopyNumber(LPCVOID lpcOutBuff, LPCVOID lpcBuff, size_t dwLen)
diff --git a/protocols/MRA/src/Mra_svcs.cpp b/protocols/MRA/src/Mra_svcs.cpp
index 897f76f1a9..78dc74c032 100644
--- a/protocols/MRA/src/Mra_svcs.cpp
+++ b/protocols/MRA/src/Mra_svcs.cpp
@@ -157,8 +157,8 @@ void CMraProto::SetExtraIcons(HANDLE hContact)
if (dwBlogStatusMsgSize) dwIconID = ADV_ICON_BLOGSTATUS;
}
- ExtraSetIcon(hExtraXstatusIcon, hContact, (( IsXStatusValid(dwXStatus) || dwXStatus == MRA_MIR_XSTATUS_UNKNOWN)? hXStatusAdvancedStatusItems[dwXStatus]:NULL), EXTRA_ICON_ADV1);
- ExtraSetIcon(hExtraInfo, hContact, ((dwIconID != -1) ? hAdvancedStatusItems[dwIconID]:NULL), EXTRA_ICON_ADV2);
+ ExtraSetIcon(hExtraXstatusIcon, hContact, (( IsXStatusValid(dwXStatus) || dwXStatus == MRA_MIR_XSTATUS_UNKNOWN)? hXStatusAdvancedStatusItems[dwXStatus]:NULL));
+ ExtraSetIcon(hExtraInfo, hContact, ((dwIconID != -1) ? hAdvancedStatusItems[dwIconID]:NULL));
}
INT_PTR CMraProto::MraXStatusMenu(WPARAM wParam, LPARAM lParam, LPARAM param)
@@ -649,17 +649,6 @@ int CMraProto::MraExtraIconsApply(WPARAM wParam, LPARAM lParam)
return 0;
}
-int CMraProto::MraExtraIconsRebuild(WPARAM wParam, LPARAM lParam)
-{
- for (size_t i = 0; i < ADV_ICON_MAX; i++)
- hAdvancedStatusItems[i] = (HANDLE)CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM)IconLibGetIcon(gdiExtraStatusIconsItems[i].hIconHandle), 0);
-
- for (size_t i = 0; i < MRA_XSTATUS_COUNT+1; i++)
- hXStatusAdvancedStatusItems[i] = (HANDLE)CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM)IconLibGetIcon(hXStatusAdvancedStatusIcons[i]), 0);
-
- return 0;
-}
-
/////////////////////////////////////////////////////////////////////////////////////////
int CMraProto::MraRebuildStatusMenu(WPARAM wParam, LPARAM lParam)
diff --git a/protocols/Quotes/src/ExtraImages.cpp b/protocols/Quotes/src/ExtraImages.cpp
index 35a59a8c1d..5b7a16991c 100644
--- a/protocols/Quotes/src/ExtraImages.cpp
+++ b/protocols/Quotes/src/ExtraImages.cpp
@@ -8,25 +8,14 @@
#include "Log.h"
#include "DBUtils.h"
-namespace
+CExtraImages::CExtraImages() :
+ m_hExtraIcons(ExtraIcon_Register(ICON_STR_QUOTE,QUOTES_PROTOCOL_NAME,Quotes_MakeIconName(ICON_STR_MAIN).c_str())),
+ m_bExtraImagesInit(false),
+ m_nSlot(DBGetContactSettingWord(NULL,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_EXTRA_IMAGE_SLOT,EXTRA_ICON_ADV1))
{
- inline HANDLE extra_add_icon(const char* psz)
- {
- return reinterpret_cast<HANDLE>(
- CallService(MS_CLIST_EXTRA_ADD_ICON,reinterpret_cast<WPARAM>(Quotes_LoadIconEx(psz)),0));
- }
-
- const HANDLE INVALID_IMAGE_HANDLE = reinterpret_cast<HANDLE>(-1);
-}
-
-CExtraImages::CExtraImages()
- : m_hExtraIcons(ExtraIcon_Register(ICON_STR_QUOTE,QUOTES_PROTOCOL_NAME,Quotes_MakeIconName(ICON_STR_MAIN).c_str())),
- m_bExtraImagesInit(false),
- m_nSlot(DBGetContactSettingWord(NULL,QUOTES_PROTOCOL_NAME,DB_STR_QUOTE_EXTRA_IMAGE_SLOT,EXTRA_ICON_ADV1))
-{
- m_ahExtraImages[eiUp] = INVALID_IMAGE_HANDLE;
- m_ahExtraImages[eiDown] = INVALID_IMAGE_HANDLE;
- m_ahExtraImages[eiNotChanged] = INVALID_IMAGE_HANDLE;
+ m_ahExtraImages[eiUp] = INVALID_HANDLE_VALUE;
+ m_ahExtraImages[eiDown] = INVALID_HANDLE_VALUE;
+ m_ahExtraImages[eiNotChanged] = INVALID_HANDLE_VALUE;
}
CExtraImages::~CExtraImages()
@@ -41,89 +30,26 @@ CExtraImages& CExtraImages::GetInstance()
void CExtraImages::RebuildExtraImages()
{
- if(NULL == m_hExtraIcons)
- {
- m_bExtraImagesInit = false;
- CGuard<CLightMutex> cs(m_lmExtraImages);
- m_ahExtraImages[eiUp] = extra_add_icon(ICON_STR_QUOTE_UP);
- m_ahExtraImages[eiDown] = extra_add_icon(ICON_STR_QUOTE_DOWN);
- m_ahExtraImages[eiNotChanged] = extra_add_icon(ICON_STR_QUOTE_NOT_CHANGED);
- m_bExtraImagesInit = true;
- }
}
-
bool CExtraImages::SetContactExtraImage(HANDLE hContact,EImageIndex nIndex)const
{
-// tstring s = Quotes_DBGetStringT(hContact,LIST_MODULE_NAME,CONTACT_LIST_NAME);
-// tostringstream o;
-// o << _T("SetContactExtraImage for ") << s << _T("\nExtra image list init: ") << m_bExtraImagesInit << _T("\n");
-
- bool bResult = false;
- if(m_hExtraIcons)
- {
-// o << "Using extra icon interface\n";
- std::string sIconName;
- switch(nIndex)
- {
- case eiUp:
- sIconName = Quotes_MakeIconName(ICON_STR_QUOTE_UP);
- break;
- case eiDown:
- sIconName = Quotes_MakeIconName(ICON_STR_QUOTE_DOWN);
- break;
- case eiNotChanged:
- sIconName = Quotes_MakeIconName(ICON_STR_QUOTE_NOT_CHANGED);
- break;
- }
- bResult = (0 == ExtraIcon_SetIcon(m_hExtraIcons,hContact,sIconName.c_str()));
- }
- else if(m_bExtraImagesInit && ServiceExists(MS_CLIST_EXTRA_ADD_ICON))
- {
-// o << "Using contact list interface index is ";
- IconExtraColumn iec = {0};
- iec.cbSize = sizeof(iec);
- iec.ColumnType = m_nSlot;
-
- {
- CGuard<CLightMutex> cs(m_lmExtraImages);
- switch(nIndex)
- {
- case eiUp:
-// o << "up\n";
- iec.hImage = m_ahExtraImages[eiUp];
- break;
- case eiDown:
-// o << "down\n";
- iec.hImage = m_ahExtraImages[eiDown];
- break;
- case eiNotChanged:
-// o << "not changed\n";
- iec.hImage = m_ahExtraImages[eiNotChanged];
- break;
- default:
-// o << "invalid\n";
- iec.hImage = INVALID_IMAGE_HANDLE;
- break;
- }
- }
-
- bResult = (0 == CallService(MS_CLIST_EXTRA_SET_ICON,reinterpret_cast<WPARAM>(hContact),reinterpret_cast<LPARAM>(&iec)));
- }
-
-// o << "Result is " << bResult;
-// LogIt(Info,o.str());
- return bResult;
-}
-
-int QuotesEventFunc_onExtraImageListRebuild(WPARAM /*wp*/,LPARAM /*lp*/)
-{
- if (ServiceExists(MS_CLIST_EXTRA_ADD_ICON))
- {
- CExtraImages::GetInstance().RebuildExtraImages();
+ if (!m_hExtraIcons)
+ return false;
+
+ std::string sIconName;
+ switch(nIndex) {
+ case eiUp:
+ sIconName = Quotes_MakeIconName(ICON_STR_QUOTE_UP);
+ break;
+ case eiDown:
+ sIconName = Quotes_MakeIconName(ICON_STR_QUOTE_DOWN);
+ break;
+ case eiNotChanged:
+ sIconName = Quotes_MakeIconName(ICON_STR_QUOTE_NOT_CHANGED);
+ break;
}
-
- return 0;
+ return (0 == ExtraIcon_SetIcon(m_hExtraIcons,hContact,sIconName.c_str()));
}
int QuotesEventFunc_onExtraImageApply(WPARAM wp,LPARAM lp)
@@ -133,11 +59,7 @@ int QuotesEventFunc_onExtraImageApply(WPARAM wp,LPARAM lp)
const CModuleInfo::TQuotesProvidersPtr& pProviders = CModuleInfo::GetQuoteProvidersPtr();
CQuotesProviders::TQuotesProviderPtr pProvider = pProviders->GetContactProviderPtr(hContact);
if(pProvider)
- {
pProvider->SetContactExtraIcon(hContact);
- }
return 0;
}
-
-
diff --git a/protocols/Quotes/src/ExtraImages.h b/protocols/Quotes/src/ExtraImages.h
index ec8ae01e39..e6988cca06 100644
--- a/protocols/Quotes/src/ExtraImages.h
+++ b/protocols/Quotes/src/ExtraImages.h
@@ -33,7 +33,6 @@ private:
int m_nSlot;
};
-int QuotesEventFunc_onExtraImageListRebuild(WPARAM wp,LPARAM lp);
int QuotesEventFunc_onExtraImageApply(WPARAM wp,LPARAM lp);
#endif //__9d0dac0c_12e4_46ce_809a_db6dc7d6f269_ExtraImages_h__
diff --git a/protocols/Quotes/src/Forex.cpp b/protocols/Quotes/src/Forex.cpp
index ab27ba41c3..063e812b04 100644
--- a/protocols/Quotes/src/Forex.cpp
+++ b/protocols/Quotes/src/Forex.cpp
@@ -206,17 +206,12 @@ namespace
{
CHTTPSession::Init();
- HANDLE h = HookEvent(ME_CLIST_EXTRA_LIST_REBUILD,QuotesEventFunc_onExtraImageListRebuild);
- g_ahEvents.push_back(h);
-// QuotesEventFunc_onExtraImageListRebuild(0,0);
-
- h = HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY,QuotesEventFunc_onExtraImageApply);
+ HANDLE h = HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY,QuotesEventFunc_onExtraImageApply);
g_ahEvents.push_back(h);
g_hEventWorkThreadStop = ::CreateEvent(NULL,TRUE,FALSE,NULL);
h = (ME_USERINFO_INITIALISE,QuotesEventFunc_OnUserInfoInit);
g_ahEvents.push_back(h);
-
h = HookEvent(ME_CLIST_DOUBLECLICKED,Quotes_OnContactDoubleClick);
g_ahEvents.push_back(h);