summaryrefslogtreecommitdiff
path: root/src/modules/extraicons/extraicons.cpp
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 /src/modules/extraicons/extraicons.cpp
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 'src/modules/extraicons/extraicons.cpp')
-rw-r--r--src/modules/extraicons/extraicons.cpp33
1 files changed, 24 insertions, 9 deletions
diff --git a/src/modules/extraicons/extraicons.cpp b/src/modules/extraicons/extraicons.cpp
index 45a81235e6..9f119d5706 100644
--- a/src/modules/extraicons/extraicons.cpp
+++ b/src/modules/extraicons/extraicons.cpp
@@ -102,7 +102,7 @@ int Clist_SetExtraIcon(HANDLE hContact, int slot, HANDLE hImage)
ExtraIcon* GetExtraIcon(HANDLE id)
{
- unsigned int i = (int) id;
+ unsigned int i = (int)id;
if (i < 1 || i > extraIconsByHandle.size())
return NULL;
@@ -157,7 +157,7 @@ static void LoadGroups(vector<ExtraIconGroup *> &groups)
group->setSlot(extra->getSlot());
}
}
- DBFreeVariant(&dbv);
+ db_free(&dbv);
}
}
@@ -257,7 +257,7 @@ int ClistExtraClick(WPARAM wParam, LPARAM lParam)
if (hContact == NULL)
return 0;
- int clistSlot = (int) lParam;
+ int clistSlot = (int)lParam;
for (unsigned int i = 0; i < extraIconsBySlot.size(); i++) {
ExtraIcon *extra = extraIconsBySlot[i];
@@ -349,11 +349,11 @@ INT_PTR ExtraIcon_Register(WPARAM wParam, LPARAM lParam)
return 0;
EXTRAICON_INFO *ei = (EXTRAICON_INFO *) wParam;
- if (ei->cbSize < (int) sizeof(EXTRAICON_INFO))
+ if (ei->cbSize < (int)sizeof(EXTRAICON_INFO))
return 0;
if (ei->type != EXTRAICON_TYPE_CALLBACK && ei->type != EXTRAICON_TYPE_ICOLIB)
return 0;
- if (IsEmpty(ei->name) || IsEmpty(ei->description))
+ if ( IsEmpty(ei->name) || IsEmpty(ei->description))
return 0;
if (ei->type == EXTRAICON_TYPE_CALLBACK && (ei->ApplyIcon == NULL || ei->RebuildIcons == NULL))
return 0;
@@ -457,17 +457,31 @@ INT_PTR ExtraIcon_SetIcon(WPARAM wParam, LPARAM lParam)
if (wParam == 0)
return -1;
- EXTRAICON *ei = (EXTRAICON *) wParam;
- if (ei->cbSize < (int) sizeof(EXTRAICON))
+ EXTRAICON *ei = (EXTRAICON*)wParam;
+ if (ei->cbSize < (int)sizeof(EXTRAICON) || ei->hExtraIcon == NULL || ei->hContact == NULL)
return -1;
- if (ei->hExtraIcon == NULL || ei->hContact == NULL)
+
+ ExtraIcon *extra = GetExtraIcon(ei->hExtraIcon);
+ if (extra == NULL)
+ return -1;
+
+ return extra->setIcon((int)ei->hExtraIcon, ei->hContact, ei->hImage);
+}
+
+INT_PTR ExtraIcon_SetIconByName(WPARAM wParam, LPARAM lParam)
+{
+ if (wParam == 0)
+ return -1;
+
+ EXTRAICON *ei = (EXTRAICON*)wParam;
+ if (ei->cbSize < (int)sizeof(EXTRAICON) || ei->hExtraIcon == NULL || ei->hContact == NULL)
return -1;
ExtraIcon *extra = GetExtraIcon(ei->hExtraIcon);
if (extra == NULL)
return -1;
- return extra->setIcon((int) ei->hExtraIcon, ei->hContact, ei->hImage);
+ return extra->setIconByName((int)ei->hExtraIcon, ei->hContact, ei->icoName);
}
static INT_PTR svcExtraIcon_Add(WPARAM wParam, LPARAM lParam)
@@ -486,6 +500,7 @@ void LoadExtraIconsModule()
// Services
CreateServiceFunction(MS_EXTRAICON_REGISTER, &ExtraIcon_Register);
CreateServiceFunction(MS_EXTRAICON_SET_ICON, &ExtraIcon_SetIcon);
+ CreateServiceFunction(MS_EXTRAICON_SET_ICON_BY_NAME, &ExtraIcon_SetIconByName);
CreateServiceFunction(MS_CLIST_EXTRA_ADD_ICON, &svcExtraIcon_Add);