summaryrefslogtreecommitdiff
path: root/plugins/UserInfoEx/src/svc_phone.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-11-03 17:32:37 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-11-03 17:32:37 +0000
commit31b191bc8ddb639e488ab8306f71ac1dbabf16f0 (patch)
treeaa661023372aa18381e46c7f6fcecf67856ac8ae /plugins/UserInfoEx/src/svc_phone.cpp
parent6ba829af4e0c008865675b67b868f33d8e7641df (diff)
removing built-in Clist Modern extra icons part I
git-svn-id: http://svn.miranda-ng.org/main/trunk@2167 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/UserInfoEx/src/svc_phone.cpp')
-rw-r--r--plugins/UserInfoEx/src/svc_phone.cpp112
1 files changed, 23 insertions, 89 deletions
diff --git a/plugins/UserInfoEx/src/svc_phone.cpp b/plugins/UserInfoEx/src/svc_phone.cpp
index 05d1e8f821..7ccdc576b4 100644
--- a/plugins/UserInfoEx/src/svc_phone.cpp
+++ b/plugins/UserInfoEx/src/svc_phone.cpp
@@ -93,80 +93,29 @@ static INT_PTR Get(HANDLE hContact)
* Event Handler functions
***********************************************************************************************************/
-static INT OnCListRebuildIcons(WPARAM wParam, LPARAM lParam)
-{
- HICON hIcon = IcoLib_GetIcon(ICO_BTN_PHONE);
- ghExtraIconDef[0] = (HANDLE)CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM)hIcon, 0);
- Skin_ReleaseIcon(hIcon);
- hIcon = IcoLib_GetIcon(ICO_BTN_CELLULAR);
- ghExtraIconDef[1] = (HANDLE)CallService(MS_CLIST_EXTRA_ADD_ICON, (WPARAM)hIcon, 0);
- Skin_ReleaseIcon(hIcon);
- return 0;
-}
-
/**
* Notification handler for clist extra icons to be applied for a contact.
*
* @param wParam - handle to the contact whose extra icon is to apply
* @param lParam - not used
**/
+
static INT OnCListApplyIcons(HANDLE hContact, LPARAM)
{
- if (!myGlobals.ExtraIconsServiceExist)
- {
- IconExtraColumn iec;
- iec.cbSize = sizeof(IconExtraColumn);
- iec.ColumnType = EXTRA_ICON_SMS;
- switch (Get(hContact))
- {
- case PHONE_NORMAL:
- {
- iec.hImage = ghExtraIconDef[0];
- }
- break;
-
- case PHONE_SMS:
- {
- iec.hImage = ghExtraIconDef[1];
- }
- break;
-
- default:
- {
- iec.hImage = INVALID_HANDLE_VALUE;
- }
- }
- CallService(MS_CLIST_EXTRA_SET_ICON, (WPARAM)hContact, (LPARAM)&iec);
- }
- else
- {
- EXTRAICON ico;
-
- ZeroMemory(&ico, sizeof(ico));
- ico.cbSize = sizeof(ico);
- ico.hContact = hContact;
- ico.hExtraIcon = ghExtraIconSvc;
- switch (Get(hContact))
- {
- case PHONE_NORMAL:
- {
- ico.icoName = ICO_BTN_PHONE;
- }
- break;
-
- case PHONE_SMS:
- {
- ico.icoName = ICO_BTN_CELLULAR;
- }
- break;
-
- default:
- {
- ico.icoName = (char *)0;
- }
- }
- CallService(MS_EXTRAICON_SET_ICON, (WPARAM)&ico, 0);
+ EXTRAICON ico = { sizeof(ico) };
+ ico.hContact = hContact;
+ ico.hExtraIcon = ghExtraIconSvc;
+ 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;
}
+ CallService(MS_EXTRAICON_SET_ICON, (WPARAM)&ico, 0);
return 0;
}
@@ -232,32 +181,18 @@ VOID SvcPhoneEnableExtraIcons(BOOLEAN bEnable, BOOLEAN bUpdateDB)
{
// hook events
if (hChangedHook == NULL)
- {
hChangedHook = HookEvent(ME_DB_CONTACT_SETTINGCHANGED, (MIRANDAHOOK)OnContactSettingChanged);
- }
+
if (hApplyIconHook == NULL)
- {
hApplyIconHook = HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY, (MIRANDAHOOK)OnCListApplyIcons);
- }
- if (myGlobals.ExtraIconsServiceExist)
- {
- if (ghExtraIconSvc == INVALID_HANDLE_VALUE)
- {
- EXTRAICON_INFO ico;
-
- ZeroMemory(&ico, sizeof(ico));
- ico.cbSize = sizeof(ico);
- ico.type = EXTRAICON_TYPE_ICOLIB;
- ico.name = "sms"; //must be the same as the group name in extraicon
- ico.description = "(uinfoex)";
- ico.descIcon = ICO_BTN_CELLULAR;
- ghExtraIconSvc = (HANDLE)CallService(MS_EXTRAICON_REGISTER, (WPARAM)&ico, 0);
- }
- }
- else if (hRebuildIconsHook == NULL)
- {
- hRebuildIconsHook = HookEvent(ME_CLIST_EXTRA_LIST_REBUILD, (MIRANDAHOOK)OnCListRebuildIcons);
- OnCListRebuildIcons(0, 0);
+
+ if (ghExtraIconSvc == INVALID_HANDLE_VALUE) {
+ EXTRAICON_INFO ico = { sizeof(ico) };
+ ico.type = EXTRAICON_TYPE_ICOLIB;
+ ico.name = "sms"; //must be the same as the group name in extraicon
+ ico.description = "(uinfoex)";
+ ico.descIcon = ICO_BTN_CELLULAR;
+ ghExtraIconSvc = (HANDLE)CallService(MS_EXTRAICON_REGISTER, (WPARAM)&ico, 0);
}
}
else
@@ -288,7 +223,6 @@ VOID SvcPhoneEnableExtraIcons(BOOLEAN bEnable, BOOLEAN bUpdateDB)
VOID SvcPhoneLoadModule()
{
SvcPhoneEnableExtraIcons(
- myGlobals.ExtraIconsServiceExist ||
DB::Setting::GetByte(SET_CLIST_EXTRAICON_PHONE, DEFVAL_CLIST_EXTRAICON_PHONE), FALSE);
}