summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2016-09-08 12:08:57 +0000
committerGeorge Hazan <george.hazan@gmail.com>2016-09-08 12:08:57 +0000
commit91a382b14d293137fa3fd90d3f5d315491df9716 (patch)
tree59b474db7c960126a88e30519a931bb0469fda95 /src
parent5fdbe74ef5349341f2f513c92c920a57e9c9648b (diff)
Srmm_* wrappers for services converted into regular functions
git-svn-id: http://svn.miranda-ng.org/main/trunk@17274 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src')
-rw-r--r--src/mir_app/src/mir_app.def4
-rw-r--r--src/mir_app/src/mir_app64.def4
-rw-r--r--src/mir_app/src/srmm_statusicon.cpp85
3 files changed, 48 insertions, 45 deletions
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def
index 00556c908f..0a7e79dcec 100644
--- a/src/mir_app/src/mir_app.def
+++ b/src/mir_app/src/mir_app.def
@@ -275,3 +275,7 @@ Clist_GetImageList @274
Clist_GetInterface @275
Clist_TrayNotifyA @276
Clist_TrayNotifyW @277
+Srmm_AddIcon @278
+Srmm_GetNthIcon @279
+Srmm_ModifyIcon @280
+Srmm_RemoveIcon @281
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def
index 7a39c78b76..76df5da91f 100644
--- a/src/mir_app/src/mir_app64.def
+++ b/src/mir_app/src/mir_app64.def
@@ -275,3 +275,7 @@ Clist_GetImageList @274
Clist_GetInterface @275
Clist_TrayNotifyA @276
Clist_TrayNotifyW @277
+Srmm_AddIcon @278
+Srmm_GetNthIcon @279
+Srmm_ModifyIcon @280
+Srmm_RemoveIcon @281
diff --git a/src/mir_app/src/srmm_statusicon.cpp b/src/mir_app/src/srmm_statusicon.cpp
index dbc6daff65..1ca52bb065 100644
--- a/src/mir_app/src/srmm_statusicon.cpp
+++ b/src/mir_app/src/srmm_statusicon.cpp
@@ -76,9 +76,35 @@ static OBJLIST<StatusIconMain> arIcons(3, CompareIcons);
static HANDLE hHookIconsChanged;
-INT_PTR ModifyStatusIcon(WPARAM hContact, LPARAM lParam)
+/////////////////////////////////////////////////////////////////////////////////////////
+
+MIR_APP_DLL(int) Srmm_AddIcon(StatusIconData *sid, int hLangpack)
+{
+ if (sid == NULL || sid->cbSize != sizeof(StatusIconData))
+ return 1;
+
+ StatusIconMain *p = arIcons.find((StatusIconMain*)sid);
+ if (p != NULL)
+ return Srmm_ModifyIcon(0, sid);
+
+ p = new StatusIconMain;
+ memcpy(&p->sid, sid, sizeof(p->sid));
+ p->hLangpack = hLangpack;
+ p->sid.szModule = mir_strdup(sid->szModule);
+ if (sid->flags & MBF_UNICODE)
+ p->sid.tszTooltip = mir_wstrdup(sid->wszTooltip);
+ else
+ p->sid.tszTooltip = mir_a2u(sid->szTooltip);
+ arIcons.insert(p);
+
+ NotifyEventHooks(hHookIconsChanged, NULL, (LPARAM)p);
+ return 0;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
+MIR_APP_DLL(int) Srmm_ModifyIcon(MCONTACT hContact, StatusIconData *sid)
{
- StatusIconData *sid = (StatusIconData *)lParam;
if (sid == NULL || sid->cbSize != sizeof(StatusIconData))
return 1;
@@ -116,52 +142,26 @@ INT_PTR ModifyStatusIcon(WPARAM hContact, LPARAM lParam)
return 0;
}
-static INT_PTR AddStatusIcon(WPARAM wParam, LPARAM lParam)
-{
- StatusIconData *sid = (StatusIconData *)lParam;
- if (sid == NULL || sid->cbSize != sizeof(StatusIconData))
- return 1;
+/////////////////////////////////////////////////////////////////////////////////////////
- StatusIconMain *p = arIcons.find((StatusIconMain*)sid);
+MIR_APP_DLL(void) Srmm_RemoveIcon(const char *szProto, DWORD iconId)
+{
+ StatusIconData tmp = { sizeof(tmp), (char*)szProto, iconId };
+ StatusIconMain *p = arIcons.find((StatusIconMain*)&tmp);
if (p != NULL)
- return ModifyStatusIcon(0, lParam);
-
- p = new StatusIconMain;
- memcpy(&p->sid, sid, sizeof(p->sid));
- p->hLangpack = (int)wParam;
- p->sid.szModule = mir_strdup(sid->szModule);
- if (sid->flags & MBF_UNICODE)
- p->sid.tszTooltip = mir_wstrdup(sid->wszTooltip);
- else
- p->sid.tszTooltip = mir_a2u(sid->szTooltip);
- arIcons.insert(p);
-
- NotifyEventHooks(hHookIconsChanged, NULL, (LPARAM)p);
- return 0;
+ arIcons.remove(p);
}
-static INT_PTR RemoveStatusIcon(WPARAM, LPARAM lParam)
-{
- StatusIconData *sid = (StatusIconData *)lParam;
- if (sid == NULL || sid->cbSize != sizeof(StatusIconData))
- return 1;
-
- StatusIconMain *p = arIcons.find((StatusIconMain*)sid);
- if (p == NULL)
- return 1;
-
- arIcons.remove(p);
- return 0;
-}
+/////////////////////////////////////////////////////////////////////////////////////////
-static INT_PTR GetNthIcon(WPARAM wParam, LPARAM lParam)
+MIR_APP_DLL(StatusIconData*) Srmm_GetNthIcon(MCONTACT hContact, int index)
{
static StatusIconData res;
for (int i=arIcons.getCount()-1, nVis = 0; i >= 0; i--) {
StatusIconMain &p = arIcons[i];
- StatusIconChild *pc = p.arChildren.find((StatusIconChild*)&wParam);
+ StatusIconChild *pc = p.arChildren.find((StatusIconChild*)&hContact);
if (pc) {
if (pc->flags & MBF_HIDDEN)
continue;
@@ -169,7 +169,7 @@ static INT_PTR GetNthIcon(WPARAM wParam, LPARAM lParam)
else if (p.sid.flags & MBF_HIDDEN)
continue;
- if (nVis == (int)lParam) {
+ if (nVis == index) {
memcpy(&res, &p, sizeof(res));
if (pc) {
if (pc->hIcon) res.hIcon = pc->hIcon;
@@ -181,12 +181,12 @@ static INT_PTR GetNthIcon(WPARAM wParam, LPARAM lParam)
res.flags = pc->flags;
}
res.tszTooltip = TranslateW_LP(res.tszTooltip, p.hLangpack);
- return (INT_PTR)&res;
+ return &res;
}
nVis++;
}
- return 0;
+ return NULL;
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -202,11 +202,6 @@ void KillModuleSrmmIcons(int _hLang)
int LoadSrmmModule()
{
- CreateServiceFunction("MessageAPI/AddIcon", AddStatusIcon);
- CreateServiceFunction(MS_MSG_REMOVEICON, RemoveStatusIcon);
- CreateServiceFunction(MS_MSG_MODIFYICON, ModifyStatusIcon);
- CreateServiceFunction("MessageAPI/GetNthIcon", GetNthIcon);
-
hHookIconsChanged = CreateHookableEvent(ME_MSG_ICONSCHANGED);
return 0;
}