diff options
author | George Hazan <george.hazan@gmail.com> | 2016-09-15 09:49:29 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2016-09-15 09:49:29 +0000 |
commit | 78c57745d5c7497dbc9cc9e573df1f1d318f37ef (patch) | |
tree | fdd80cc2fbf17b10d0a81895ac0bc2ec8d3dc2e9 | |
parent | c36bbbff769462948278fddcaa4713a1ab21361d (diff) |
crash fix in Skype custom icon handler
git-svn-id: http://svn.miranda-ng.org/main/trunk@17299 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r-- | protocols/SkypeWeb/src/skype_events.cpp | 51 | ||||
-rw-r--r-- | src/mir_app/src/db_events.cpp | 13 |
2 files changed, 27 insertions, 37 deletions
diff --git a/protocols/SkypeWeb/src/skype_events.cpp b/protocols/SkypeWeb/src/skype_events.cpp index 51c0d40137..ccee39c294 100644 --- a/protocols/SkypeWeb/src/skype_events.cpp +++ b/protocols/SkypeWeb/src/skype_events.cpp @@ -170,46 +170,37 @@ INT_PTR CSkypeProto::GetEventText(WPARAM pEvent, LPARAM datatype) return (datatype == DBVT_WCHAR) ? (INT_PTR)mir_a2u(szText) : (INT_PTR)szText.Detach();
}
-INT_PTR CSkypeProto::EventGetIcon(WPARAM wParam, LPARAM lParam)
+INT_PTR CSkypeProto::EventGetIcon(WPARAM flags, LPARAM pEvent)
{
- DBEVENTINFO* dbei = (DBEVENTINFO*)lParam;
+ DBEVENTINFO *dbei = (DBEVENTINFO*)pEvent;
HICON icon = NULL;
- switch (dbei->eventType)
- {
+ switch (dbei->eventType) {
case SKYPE_DB_EVENT_TYPE_CALL_INFO:
case SKYPE_DB_EVENT_TYPE_INCOMING_CALL:
- {
- icon = GetIcon(IDI_CALL);
- break;
- }
+ icon = GetIcon(IDI_CALL);
+ break;
+
case SKYPE_DB_EVENT_TYPE_ACTION:
- {
- icon = GetIcon(IDI_ACTION_ME);
- break;
- }
+ icon = GetIcon(IDI_ACTION_ME);
+ break;
+
case SKYPE_DB_EVENT_TYPE_FILETRANSFER_INFO:
- {
- icon = Skin_LoadIcon(SKINICON_EVENT_FILE);
- break;
- }
+ icon = Skin_LoadIcon(SKINICON_EVENT_FILE);
+ break;
+
case SKYPE_DB_EVENT_TYPE_URIOBJ:
- {
- icon = Skin_LoadIcon(SKINICON_EVENT_URL);
- break;
- }
+ icon = Skin_LoadIcon(SKINICON_EVENT_URL);
+ break;
+
case SKYPE_DB_EVENT_TYPE_UNKNOWN:
- {
- icon = Skin_LoadIcon(SKINICON_WARNING);
- break;
- }
+ icon = Skin_LoadIcon(SKINICON_WARNING);
+ break;
+
default:
- {
- icon = Skin_LoadIcon(SKINICON_EVENT_MESSAGE);
- break;
- }
+ icon = Skin_LoadIcon(SKINICON_EVENT_MESSAGE);
+ break;
}
- return (INT_PTR)((wParam & LR_SHARED) ? icon : CopyIcon(icon));
+ return (INT_PTR)((flags & LR_SHARED) ? icon : CopyIcon(icon));
}
-
diff --git a/src/mir_app/src/db_events.cpp b/src/mir_app/src/db_events.cpp index bc3fb4d470..0a2b6a6431 100644 --- a/src/mir_app/src/db_events.cpp +++ b/src/mir_app/src/db_events.cpp @@ -63,23 +63,22 @@ MIR_APP_DLL(int) DbEvent_RegisterType(DBEVENTTYPEDESCR *et) p->module = mir_strdup(et->module);
p->eventType = et->eventType;
p->descr = mir_strdup(et->descr);
- if (et->textService)
- p->textService = mir_strdup(et->textService);
- if (et->iconService)
- p->iconService = mir_strdup(et->iconService);
p->eventIcon = et->eventIcon;
p->flags = et->flags;
+ char szServiceName[100];
if (!p->textService) {
- char szServiceName[100];
mir_snprintf(szServiceName, "%s/GetEventText%d", p->module, p->eventType);
p->textService = mir_strdup(szServiceName);
}
+ else p->textService = mir_strdup(et->textService);
+
if (!p->iconService) {
- char szServiceName[100];
mir_snprintf(szServiceName, "%s/GetEventIcon%d", p->module, p->eventType);
p->iconService = mir_strdup(szServiceName);
}
+ else p->iconService = mir_strdup(et->iconService);
+
eventTypes.insert(p);
return 0;
}
@@ -223,7 +222,7 @@ MIR_APP_DLL(HICON) DbEvent_GetIcon(DBEVENTINFO *dbei, int flags) {
DBEVENTTYPEDESCR *et = DbEvent_GetType(dbei->szModule, dbei->eventType);
if (et && ServiceExists(et->iconService)) {
- HICON icon = (HICON)CallService(et->iconService, (WPARAM)dbei, flags);
+ HICON icon = (HICON)CallService(et->iconService, flags, (LPARAM)dbei);
if (icon)
return icon;
}
|