summaryrefslogtreecommitdiff
path: root/plugins/UserInfoEx
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-11-19 12:51:53 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-11-19 12:51:53 +0000
commit32dedc767dec565c576b78b786e7a95d76ac806e (patch)
tree0f2eb209b3716569a8e3c3ef146a91f402ebbb4d /plugins/UserInfoEx
parentadf7367cfdb57b32aadeb74af45dce9a6a3c02a5 (diff)
- added another helper, ExtraIcon_Clear, to remove an icon from slot;
- added ability to pass IcoLib handles instead of icons' names git-svn-id: http://svn.miranda-ng.org/main/trunk@2371 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/UserInfoEx')
-rw-r--r--plugins/UserInfoEx/src/Flags/svc_flags.cpp22
-rw-r--r--plugins/UserInfoEx/src/svc_email.cpp7
-rw-r--r--plugins/UserInfoEx/src/svc_gender.cpp17
-rw-r--r--plugins/UserInfoEx/src/svc_homepage.cpp9
-rw-r--r--plugins/UserInfoEx/src/svc_phone.cpp17
-rw-r--r--plugins/UserInfoEx/src/svc_reminder.cpp20
6 files changed, 29 insertions, 63 deletions
diff --git a/plugins/UserInfoEx/src/Flags/svc_flags.cpp b/plugins/UserInfoEx/src/Flags/svc_flags.cpp
index c864e0bca8..e3b59f47f8 100644
--- a/plugins/UserInfoEx/src/Flags/svc_flags.cpp
+++ b/plugins/UserInfoEx/src/Flags/svc_flags.cpp
@@ -234,30 +234,20 @@ static INT_PTR ServiceDetectContactOriginCountry(WPARAM wParam,LPARAM lParam)
static void CALLBACK SetExtraImage(LPARAM lParam)
{
/* get contact's country */
- int countryNumber = ServiceDetectContactOriginCountry((WPARAM)lParam,0);;
-
- EXTRAICON ico = { sizeof(ico) };
- ico.hContact = (HANDLE)lParam;
- ico.hExtraIcon = hExtraIconSvc;
- ico.icoName = (char*)0; //preset
+ int countryNumber = ServiceDetectContactOriginCountry((WPARAM)lParam,0);
if (countryNumber != 0xFFFF || gFlagsOpts.bUseUnknownFlag) {
char szId[20];
- mir_snprintf(szId, SIZEOF(szId), (countryNumber==0xFFFF)?"%s_0x%X":"%s_%i","flags",countryNumber); /* buffer safe */
- ico.icoName = szId;
+ mir_snprintf(szId, SIZEOF(szId), (countryNumber == 0xFFFF) ? "%s_0x%X" : "%s_%i","flags", countryNumber); /* buffer safe */
+ ExtraIcon_SetIcon(hExtraIconSvc, (HANDLE)lParam, szId);
}
- CallService(MS_EXTRAICON_SET_ICON, (WPARAM)&ico, 0);
+ else ExtraIcon_Clear(hExtraIconSvc, (HANDLE)lParam);
}
static void CALLBACK RemoveExtraImages(LPARAM lParam)
{
- EXTRAICON ico = { sizeof(ico) };
- ico.hExtraIcon = hExtraIconSvc;
- ico.icoName = 0; /* invalidate icon for contact*/
/* enum all contacts */
- for (HANDLE hContact = DB::Contact::FindFirst(); hContact != NULL; hContact = DB::Contact::FindNext(hContact)) {
- ico.hContact = hContact;
- CallService(MS_EXTRAICON_SET_ICON, (WPARAM)&ico, 0);
- }
+ for (HANDLE hContact = DB::Contact::FindFirst(); hContact != NULL; hContact = DB::Contact::FindNext(hContact))
+ ExtraIcon_Clear(hExtraIconSvc, hContact);
}
// always call in context of main thread
diff --git a/plugins/UserInfoEx/src/svc_email.cpp b/plugins/UserInfoEx/src/svc_email.cpp
index 5b886b72a3..f0915e64fe 100644
--- a/plugins/UserInfoEx/src/svc_email.cpp
+++ b/plugins/UserInfoEx/src/svc_email.cpp
@@ -146,13 +146,8 @@ static INT_PTR MenuCommand(WPARAM wParam,LPARAM lParam)
static INT OnCListApplyIcons(WPARAM wParam, LPARAM lParam)
{
LPSTR val = Get((HANDLE)wParam);
-
- EXTRAICON ico = { sizeof(ico) };
- ico.hContact=(HANDLE)wParam;
- ico.hExtraIcon=ghExtraIconSvc;
- ico.icoName=val?ICO_BTN_EMAIL:(char *)0;
+ ExtraIcon_SetIcon(ghExtraIconSvc, (HANDLE)wParam, (val) ? ICO_BTN_EMAIL: 0);
mir_free(val);
- CallService(MS_EXTRAICON_SET_ICON, (WPARAM)&ico, 0);
return 0;
}
diff --git a/plugins/UserInfoEx/src/svc_gender.cpp b/plugins/UserInfoEx/src/svc_gender.cpp
index 68d6f5b8ec..f849569644 100644
--- a/plugins/UserInfoEx/src/svc_gender.cpp
+++ b/plugins/UserInfoEx/src/svc_gender.cpp
@@ -81,20 +81,13 @@ BYTE GenderOf(HANDLE hContact)
static INT OnCListApplyIcons(HANDLE hContact, LPARAM)
{
if (ghExtraIconSvc != INVALID_HANDLE_VALUE) {
- EXTRAICON ico = { sizeof(ico) };
- ico.hContact = hContact;
- ico.hExtraIcon = ghExtraIconSvc;
+ char *icoName;
switch (GenderOf(hContact)) {
- case 'M':
- ico.icoName = ICO_COMMON_MALE;
- break;
- case 'F':
- ico.icoName = ICO_COMMON_FEMALE;
- break;
- default:
- ico.icoName = NULL;
+ case 'M': icoName = ICO_COMMON_MALE; break;
+ case 'F': icoName = ICO_COMMON_FEMALE; break;
+ default: icoName = NULL;
}
- CallService(MS_EXTRAICON_SET_ICON, (WPARAM)&ico, 0);
+ ExtraIcon_SetIcon(ghExtraIconSvc, hContact, icoName);
}
return 0;
}
diff --git a/plugins/UserInfoEx/src/svc_homepage.cpp b/plugins/UserInfoEx/src/svc_homepage.cpp
index 8c3cf5ff3d..e5d31746f2 100644
--- a/plugins/UserInfoEx/src/svc_homepage.cpp
+++ b/plugins/UserInfoEx/src/svc_homepage.cpp
@@ -109,13 +109,8 @@ static INT_PTR MenuCommand(WPARAM wParam, LPARAM lParam)
static INT OnCListApplyIcons(HANDLE hContact, LPARAM)
{
LPSTR val = Get(hContact);
- if (ghExtraIconSvc != INVALID_HANDLE_VALUE) {
- EXTRAICON ico = { sizeof(ico) };
- ico.hContact = hContact;
- ico.hExtraIcon = ghExtraIconSvc;
- ico.icoName = (val) ? ICO_BTN_GOTO : NULL;
- CallService(MS_EXTRAICON_SET_ICON, (WPARAM)&ico, 0);
- }
+ if (ghExtraIconSvc != INVALID_HANDLE_VALUE)
+ ExtraIcon_SetIcon(ghExtraIconSvc, hContact, (val) ? ICO_BTN_GOTO : NULL);
MIR_FREE(val);
return 0;
}
diff --git a/plugins/UserInfoEx/src/svc_phone.cpp b/plugins/UserInfoEx/src/svc_phone.cpp
index 941003716b..9490a563e9 100644
--- a/plugins/UserInfoEx/src/svc_phone.cpp
+++ b/plugins/UserInfoEx/src/svc_phone.cpp
@@ -102,20 +102,13 @@ static INT_PTR Get(HANDLE hContact)
static INT OnCListApplyIcons(HANDLE hContact, LPARAM)
{
- EXTRAICON ico = { sizeof(ico) };
- ico.hContact = hContact;
- ico.hExtraIcon = ghExtraIconSvc;
+ char *icoName;
switch (Get(hContact)) {
- case PHONE_NORMAL:
- ico.icoName = ICO_BTN_PHONE;
- break;
- case PHONE_SMS:
- ico.icoName = ICO_BTN_CELLULAR;
- break;
- default:
- ico.icoName = NULL;
+ case PHONE_NORMAL: icoName = ICO_BTN_PHONE; break;
+ case PHONE_SMS: icoName = ICO_BTN_CELLULAR; break;
+ default: icoName = NULL;
}
- CallService(MS_EXTRAICON_SET_ICON, (WPARAM)&ico, 0);
+ ExtraIcon_SetIcon(ghExtraIconSvc, hContact, icoName);
return 0;
}
diff --git a/plugins/UserInfoEx/src/svc_reminder.cpp b/plugins/UserInfoEx/src/svc_reminder.cpp
index 91f19eb804..660d2de23e 100644
--- a/plugins/UserInfoEx/src/svc_reminder.cpp
+++ b/plugins/UserInfoEx/src/svc_reminder.cpp
@@ -187,31 +187,31 @@ static HICON GetAnnivIcon(const CEvent &evt)
static VOID NotifyWithExtraIcon(HANDLE hContact, const CEvent &evt)
{
if (gRemindOpts.bCListExtraIcon) {
- CHAR szIcon[MAXSETTING];
-
- EXTRAICON ico = { sizeof(ico) };
- ico.hContact = hContact;
- ico.hExtraIcon = ExtraIcon;
+ char szIcon[MAXSETTING], *icoName;
+
switch (evt._eType) {
case CEvent::BIRTHDAY:
if (evt._wDaysLeft > 9)
- ico.icoName = ICO_RMD_DTAX;
+ icoName = ICO_RMD_DTAX;
else {
mir_snprintf(szIcon, SIZEOF(szIcon), MODNAME"_rmd_dtb%u", evt._wDaysLeft);
- ico.icoName = szIcon;
+ icoName = szIcon;
}
break;
case CEvent::ANNIVERSARY:
if (evt._wDaysLeft > 9)
- ico.icoName = ICO_RMD_DTAX;
+ icoName = ICO_RMD_DTAX;
else {
mir_snprintf(szIcon, SIZEOF(szIcon), MODNAME"_rmd_dta%u", evt._wDaysLeft);
- ico.icoName = szIcon;
+ icoName = szIcon;
}
break;
+
+ default:
+ return;
}
- CallService(MS_EXTRAICON_SET_ICON, (WPARAM)&ico, 0);
+ ExtraIcon_SetIcon(ExtraIcon, hContact, icoName);
}
}