summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-07-22 17:53:20 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-07-22 17:53:20 +0000
commit59b6fb0fe20c274743fbd1b9742be94b1e5134a4 (patch)
tree1fe68cf72ab221fbca0f24b36b35f5c1087a9450
parent36818c9c84cce676b9ec6533807b7a33e03902a0 (diff)
- extra icons services converted into functions;
- more Kill* functions exported; git-svn-id: http://svn.miranda-ng.org/main/trunk@14635 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--bin10/lib/mir_app.libbin64906 -> 67546 bytes
-rw-r--r--bin10/lib/mir_app64.libbin62952 -> 65360 bytes
-rw-r--r--bin12/lib/mir_app.libbin64906 -> 67546 bytes
-rw-r--r--bin12/lib/mir_app64.libbin62952 -> 65360 bytes
-rw-r--r--include/delphi/m_extraicons.inc34
-rw-r--r--include/m_extraicons.h123
-rw-r--r--include/m_fontservice.h7
-rw-r--r--include/m_hotkeys.h4
-rw-r--r--plugins/AuthState/src/main.cpp4
-rw-r--r--plugins/BuddyExpectator/src/BuddyExpectator.cpp6
-rw-r--r--plugins/CountryFlags/src/extraimg.cpp4
-rw-r--r--plugins/FingerprintNG/src/fingerprint.cpp2
-rw-r--r--plugins/IgnoreState/src/main.cpp8
-rw-r--r--plugins/ListeningTo/src/listeningto.cpp5
-rw-r--r--plugins/MobileState/src/main.cpp5
-rw-r--r--plugins/New_GPG/src/icons.cpp4
-rw-r--r--plugins/New_GPG/src/init.cpp3
-rw-r--r--plugins/Quotes/src/ExtraImages.cpp2
-rw-r--r--plugins/Rate/src/main.cpp5
-rw-r--r--plugins/SecureIM/src/main.cpp2
-rw-r--r--plugins/TabSRMM/src/msgdialog.cpp2
-rw-r--r--plugins/UserInfoEx/src/Flags/svc_flags.cpp2
-rw-r--r--plugins/UserInfoEx/src/svc_email.cpp4
-rw-r--r--plugins/UserInfoEx/src/svc_gender.cpp4
-rw-r--r--plugins/UserInfoEx/src/svc_homepage.cpp4
-rw-r--r--plugins/UserInfoEx/src/svc_phone.cpp4
-rw-r--r--plugins/UserInfoEx/src/svc_reminder.cpp4
-rw-r--r--plugins/WhenWasIt/src/icons.cpp2
-rw-r--r--protocols/AimOscar/src/theme.cpp4
-rw-r--r--protocols/IcqOscarJ/src/init.cpp2
-rw-r--r--protocols/JabberG/src/jabber.cpp4
-rw-r--r--protocols/MRA/src/MraProto.cpp4
-rw-r--r--protocols/Steam/src/main.cpp7
-rw-r--r--protocols/Xfire/src/main.cpp4
-rw-r--r--src/mir_app/src/DefaultExtraIcons.cpp12
-rw-r--r--src/mir_app/src/extraicons.cpp174
-rw-r--r--src/mir_app/src/hotkeys.cpp2
-rw-r--r--src/mir_app/src/mir_app.def13
-rw-r--r--src/mir_app/src/mir_app64.def13
-rw-r--r--src/mir_app/src/miranda.h12
-rw-r--r--src/mir_app/src/services.cpp6
-rw-r--r--src/mir_app/src/sounds.cpp2
-rw-r--r--src/mir_app/src/stdafx.h2
43 files changed, 199 insertions, 306 deletions
diff --git a/bin10/lib/mir_app.lib b/bin10/lib/mir_app.lib
index bdfbcab805..5fab912922 100644
--- a/bin10/lib/mir_app.lib
+++ b/bin10/lib/mir_app.lib
Binary files differ
diff --git a/bin10/lib/mir_app64.lib b/bin10/lib/mir_app64.lib
index e4918a7969..fca962e750 100644
--- a/bin10/lib/mir_app64.lib
+++ b/bin10/lib/mir_app64.lib
Binary files differ
diff --git a/bin12/lib/mir_app.lib b/bin12/lib/mir_app.lib
index bdfbcab805..5fab912922 100644
--- a/bin12/lib/mir_app.lib
+++ b/bin12/lib/mir_app.lib
Binary files differ
diff --git a/bin12/lib/mir_app64.lib b/bin12/lib/mir_app64.lib
index e4918a7969..fca962e750 100644
--- a/bin12/lib/mir_app64.lib
+++ b/bin12/lib/mir_app64.lib
Binary files differ
diff --git a/include/delphi/m_extraicons.inc b/include/delphi/m_extraicons.inc
index 577585f953..e247599761 100644
--- a/include/delphi/m_extraicons.inc
+++ b/include/delphi/m_extraicons.inc
@@ -81,38 +81,4 @@ type
onClickParam:LPARAM;
end;
-const
-// Register an extra icon
-// wParam = (EXTRAICON_INFO *) Extra icon info
-// lParam = 0
-// Return: (HANDLE) id of extra icon on success, 0 on error
- MS_EXTRAICON_REGISTER:PAnsiChar = 'ExtraIcon/Register';
-
-type
- TEXTRAICON = record
- cbSize :int;
- hExtraIcon:THANDLE; // Value returned by MS_EXTRAICON_REGISTER
- hContact :TMCONTACT; // Contact to set the extra icon
- // The icon to be set. This depends on the type of the extra icon:
- case boolean of
- false:(hImage :THANDLE); // Value returned by MS_CLIST_EXTRA_ADD_ICON (if EXTRAICON_TYPE_CALLBACK)
- // or the icolib icon handle (if EXTRAICON_TYPE_ICOLIB)
- true :(icoName:PAnsiChar); // Name of the icon registered with icolib (if EXTRAICON_TYPE_ICOLIB)
- end;
-
-const
-{
- Set an extra icon icon
- wParam = (EXTRAICON *) Extra icon
- Return: 0 on success
-}
- MS_EXTRAICON_SET_ICON:PAnsiChar = 'ExtraIcon/SetIcon';
-
-{
- Set an extra icon by icolib icon's name
- wParam = (EXTRAICON *) Extra icon
- Return: 0 on success
-}
- MS_EXTRAICON_SET_ICON_BY_NAME:PAnsiChar = 'ExtraIcon/SetIconByName';
-
{$ENDIF}
diff --git a/include/m_extraicons.h b/include/m_extraicons.h
index 309c88edd8..3a4184a685 100644
--- a/include/m_extraicons.h
+++ b/include/m_extraicons.h
@@ -24,6 +24,8 @@ Boston, MA 02111-1307, USA.
#ifndef __M_EXTRAICONS_H__
#define __M_EXTRAICONS_H__
+#include <m_core.h>
+
#ifndef EXTRA_ICON_COUNT
#define EXTRA_ICON_COUNT 10
#endif
@@ -71,15 +73,12 @@ To register a new extra icon, you have to call MS_EXTRAICON_REGISTER passing the
*/
-#define MIID_EXTRAICONSSERVICE { 0x62d80749, 0xf169, 0x4592, { 0xb4, 0x4d, 0x3d, 0xd6, 0xde, 0x9d, 0x50, 0xc5 } }
-
-
#define EXTRAICON_TYPE_CALLBACK 0 // Similar to old clist callbacks, it fires 2 notifications
#define EXTRAICON_TYPE_ICOLIB 1 // This extra icon will use only icons registered with icolib. No callbacks
// needed. Just call MS_EXTRAICON_SET_ICON passing the name of the extraicon to set one.
-
-typedef struct {
+struct EXTRAICON_INFO
+{
int cbSize;
int type; // One of EXTRAICON_TYPE_*
const char *name; // Internal name. More than one plugin can register extra icons with the same name
@@ -108,117 +107,21 @@ typedef struct {
MIRANDAHOOKPARAM OnClick;
LPARAM onClickParam;
+};
-} EXTRAICON_INFO;
-
-
-// Register an extra icon
-// wParam = (EXTRAICON_INFO *) Extra icon info
-// lParam = 0
-// Return: (HANDLE) id of extra icon on success, 0 on error
-#define MS_EXTRAICON_REGISTER "ExtraIcon/Register"
-
-
-typedef struct {
- int cbSize;
- HANDLE hExtraIcon; // Value returned by MS_EXTRAICON_REGISTER
- MCONTACT hContact; // Contact to set the extra icon
- union { // The icon to be set. This depends on the type of the extra icon:
- HANDLE hImage; // Value returned by MS_CLIST_EXTRA_ADD_ICON (if EXTRAICON_TYPE_CALLBACK)
- // or the icolib icon handle (if EXTRAICON_TYPE_ICOLIB)
- const char *icoName; // Name of the icon registered with icolib (if EXTRAICON_TYPE_ICOLIB)
- };
-} EXTRAICON;
-
-// Set an extra icon icon
-// wParam = (EXTRAICON *) Extra icon
-// Return: 0 on success
-#define MS_EXTRAICON_SET_ICON "ExtraIcon/SetIcon"
-
-// Set an extra icon by icolib icon's name
-// wParam = (EXTRAICON *) Extra icon
-// Return: 0 on success
-#define MS_EXTRAICON_SET_ICON_BY_NAME "ExtraIcon/SetIconByName"
-
-#ifndef _NO_WRAPPERS
-#ifdef __cplusplus
-
-extern int hLangpack;
+EXTERN_C MIR_APP_DLL(void) KillModuleExtraIcons(int hLangpack);
#pragma warning(disable:4505)
-static HANDLE ExtraIcon_Register(
- const char *name, const char *description, const char *descIcon,
- MIRANDAHOOK RebuildIcons,
- MIRANDAHOOK ApplyIcon,
- MIRANDAHOOKPARAM OnClick = NULL, LPARAM onClickParam = 0)
-{
- if (!ServiceExists(MS_EXTRAICON_REGISTER))
- return NULL;
-
- EXTRAICON_INFO ei = { sizeof(ei) };
- ei.type = EXTRAICON_TYPE_CALLBACK;
- ei.name = name;
- ei.description = description;
- ei.descIcon = descIcon;
- ei.RebuildIcons = RebuildIcons;
- ei.ApplyIcon = ApplyIcon;
- ei.OnClick = OnClick;
- ei.onClickParam = onClickParam;
-
- return (HANDLE) CallService(MS_EXTRAICON_REGISTER, (WPARAM) &ei, hLangpack);
-}
-
-static HANDLE ExtraIcon_Register(
- const char *name, const char *description, const char *descIcon = NULL,
- MIRANDAHOOKPARAM OnClick = NULL, LPARAM onClickParam = 0)
-{
- if (!ServiceExists(MS_EXTRAICON_REGISTER))
- return NULL;
-
- EXTRAICON_INFO ei = { sizeof(ei) };
- ei.type = EXTRAICON_TYPE_ICOLIB;
- ei.name = name;
- ei.description = description;
- ei.descIcon = descIcon;
- ei.OnClick = OnClick;
- ei.onClickParam = onClickParam;
-
- return (HANDLE) CallService(MS_EXTRAICON_REGISTER, (WPARAM) &ei, hLangpack);
-}
-
-static int ExtraIcon_SetIcon(HANDLE hExtraIcon, MCONTACT hContact, HANDLE hImage)
-{
- EXTRAICON ei = { sizeof(ei) };
- ei.hExtraIcon = hExtraIcon;
- ei.hContact = hContact;
- ei.hImage = hImage;
-
- return CallService(MS_EXTRAICON_SET_ICON, (WPARAM) &ei, 0);
-}
-
-static int ExtraIcon_SetIcon(HANDLE hExtraIcon, MCONTACT hContact, const char *icoName)
-{
- EXTRAICON ei = { sizeof(ei) };
- ei.hExtraIcon = hExtraIcon;
- ei.hContact = hContact;
- ei.icoName = icoName;
-
- return CallService(MS_EXTRAICON_SET_ICON_BY_NAME, (WPARAM) &ei, 0);
-}
-
-static int ExtraIcon_Clear(HANDLE hExtraIcon, MCONTACT hContact)
-{
- EXTRAICON ei = { sizeof(ei) };
- ei.hExtraIcon = hExtraIcon;
- ei.hContact = hContact;
- ei.icoName = NULL;
+EXTERN_C MIR_APP_DLL(HANDLE) ExtraIcon_RegisterCallack(const char *name, const char *description, const char *descIcon,
+ MIRANDAHOOK RebuildIcons, MIRANDAHOOK ApplyIcon, MIRANDAHOOKPARAM OnClick = NULL, LPARAM onClickParam = 0, int = hLangpack);
- return CallService(MS_EXTRAICON_SET_ICON, (WPARAM) &ei, 0);
-}
+EXTERN_C MIR_APP_DLL(HANDLE) ExtraIcon_RegisterIcolib(const char *name, const char *description, const char *descIcon = NULL,
+ MIRANDAHOOKPARAM OnClick = NULL, LPARAM onClickParam = 0, int = hLangpack);
-#endif
-#endif
+EXTERN_C MIR_APP_DLL(int) ExtraIcon_SetIcon(HANDLE hExtraIcon, MCONTACT hContact, HANDLE hImage);
+EXTERN_C MIR_APP_DLL(int) ExtraIcon_SetIconByName(HANDLE hExtraIcon, MCONTACT hContact, const char *icoName);
+EXTERN_C MIR_APP_DLL(int) ExtraIcon_Clear(HANDLE hExtraIcon, MCONTACT hContact);
#endif // __M_EXTRAICONS_H__
diff --git a/include/m_fontservice.h b/include/m_fontservice.h
index 1d826437ef..d5f060a4fb 100644
--- a/include/m_fontservice.h
+++ b/include/m_fontservice.h
@@ -312,4 +312,11 @@ __forceinline void EffectRegisterW(EffectIDW* pEffectID)
// wparam = lparam = 0
#define ME_EFFECT_RELOAD "Effect/Reload"
+EXTERN_C MIR_APP_DLL(void) KillModuleFonts(int hLangpack);
+EXTERN_C MIR_APP_DLL(void) KillModuleColours(int hLangpack);
+EXTERN_C MIR_APP_DLL(void) KillModuleEffects(int hLangpack);
+
+EXTERN_C MIR_APP_DLL(void) KillModuleHotkeys(int hLangpack);
+EXTERN_C MIR_APP_DLL(void) KillModuleSounds(int hLangpack);
+
#endif // _FONT_SERVICE_API_INC
diff --git a/include/m_hotkeys.h b/include/m_hotkeys.h
index c85dad95a8..689c949dba 100644
--- a/include/m_hotkeys.h
+++ b/include/m_hotkeys.h
@@ -25,6 +25,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#ifndef M_HOTKEYS_H__
#define M_HOTKEYS_H__ 1
+#include <m_core.h>
+
#define HKD_UNICODE 0x0001
#if defined(_UNICODE)
@@ -111,4 +113,6 @@ use it for own purposes.
#define ME_HOTKEYS_CHANGED "CoreHotkeys/Changed"
+EXTERN_C MIR_APP_DLL(void) KillModuleHotkeys(int hLangpack);
+
#endif // M_HOTKEYS_H__
diff --git a/plugins/AuthState/src/main.cpp b/plugins/AuthState/src/main.cpp
index ec7224b259..bf234db17e 100644
--- a/plugins/AuthState/src/main.cpp
+++ b/plugins/AuthState/src/main.cpp
@@ -103,7 +103,7 @@ int onExtraImageApplying(WPARAM hContact, LPARAM lParam)
case icon_auth: icon = "auth_icon"; break;
default: icon = NULL; break;
}
- ExtraIcon_SetIcon(hExtraIcon, (MCONTACT)hContact, icon);
+ ExtraIcon_SetIconByName(hExtraIcon, (MCONTACT)hContact, icon);
return 0;
}
@@ -209,7 +209,7 @@ extern "C" int __declspec(dllexport) Load(void)
Icon_Register(g_hInst, "Auth State", iconList, _countof(iconList));
// extra icons
- hExtraIcon = ExtraIcon_Register("authstate", LPGEN("Auth State"), "authgrant_icon");
+ hExtraIcon = ExtraIcon_RegisterIcolib("authstate", LPGEN("Auth State"), "authgrant_icon");
return 0;
}
diff --git a/plugins/BuddyExpectator/src/BuddyExpectator.cpp b/plugins/BuddyExpectator/src/BuddyExpectator.cpp
index 3c444dcf0a..ff4a7676a5 100644
--- a/plugins/BuddyExpectator/src/BuddyExpectator.cpp
+++ b/plugins/BuddyExpectator/src/BuddyExpectator.cpp
@@ -424,7 +424,7 @@ INT_PTR MenuMissYouClick(WPARAM hContact, LPARAM)
}
else {
db_set_b(hContact, MODULE_NAME, "MissYou", 1);
- ExtraIcon_SetIcon(hExtraIcon, hContact, "enabled_icon");
+ ExtraIcon_SetIconByName(hExtraIcon, hContact, "enabled_icon");
}
return 0;
@@ -451,7 +451,7 @@ int onPrebuildContactMenu(WPARAM hContact, LPARAM)
int onExtraImageApplying(WPARAM hContact, LPARAM)
{
if (db_get_b(hContact, MODULE_NAME, "MissYou", 0))
- ExtraIcon_SetIcon(hExtraIcon, hContact, "enabled_icon");
+ ExtraIcon_SetIconByName(hExtraIcon, hContact, "enabled_icon");
return 0;
}
@@ -696,7 +696,7 @@ extern "C" int __declspec(dllexport) Load(void)
onIconsChanged(0, 0);
- hExtraIcon = ExtraIcon_Register("buddy_exp", LPGEN("Buddy Expectator"), "enabled_icon");
+ hExtraIcon = ExtraIcon_RegisterIcolib("buddy_exp", LPGEN("Buddy Expectator"), "enabled_icon");
return 0;
}
diff --git a/plugins/CountryFlags/src/extraimg.cpp b/plugins/CountryFlags/src/extraimg.cpp
index 5f887b2745..491d413742 100644
--- a/plugins/CountryFlags/src/extraimg.cpp
+++ b/plugins/CountryFlags/src/extraimg.cpp
@@ -56,7 +56,7 @@ static void CALLBACK SetExtraImage(MCONTACT hContact)
else {
char szId[20];
mir_snprintf(szId, _countof(szId), (countryNumber == 0xFFFF) ? "%s0x%X" : "%s%i", "flags_", countryNumber);
- ExtraIcon_SetIcon(hExtraIcon, hContact, szId);
+ ExtraIcon_SetIconByName(hExtraIcon, hContact, szId);
}
}
@@ -200,7 +200,7 @@ void InitExtraImg(void)
HookEvent(ME_DB_CONTACT_SETTINGCHANGED, ExtraImgSettingChanged);
/* Extra Image */
- hExtraIcon = ExtraIcon_Register("flags_extra", LPGEN("Country flag"), "flags_0");
+ hExtraIcon = ExtraIcon_RegisterIcolib("flags_extra", LPGEN("Country flag"), "flags_0");
if (bShowExtraIcon)
EnsureExtraImages();
}
diff --git a/plugins/FingerprintNG/src/fingerprint.cpp b/plugins/FingerprintNG/src/fingerprint.cpp
index 096c9ff9ba..7b59cc0749 100644
--- a/plugins/FingerprintNG/src/fingerprint.cpp
+++ b/plugins/FingerprintNG/src/fingerprint.cpp
@@ -971,6 +971,6 @@ void InitFingerModule()
CreateServiceFunction(MS_FP_GETCLIENTDESCRW, ServiceGetClientDescrW);
CreateServiceFunction(MS_FP_GETCLIENTICONW, ServiceGetClientIconW);
- hExtraIcon = ExtraIcon_Register("Client", LPGEN("Fingerprint"), "client_Miranda_unknown",
+ hExtraIcon = ExtraIcon_RegisterCallack("Client", LPGEN("Fingerprint"), "client_Miranda_unknown",
OnExtraIconListRebuild, OnExtraImageApply, OnExtraIconClick);
}
diff --git a/plugins/IgnoreState/src/main.cpp b/plugins/IgnoreState/src/main.cpp
index ad8083d2d4..353efadb94 100644
--- a/plugins/IgnoreState/src/main.cpp
+++ b/plugins/IgnoreState/src/main.cpp
@@ -97,13 +97,13 @@ void applyExtraImage(MCONTACT hContact)
{
int ignore = isIgnored(hContact, IGNOREEVENT_ALL);
if (ignore == 1)
- ExtraIcon_SetIcon(hExtraIcon, hContact, "ignore_full");
+ ExtraIcon_SetIconByName(hExtraIcon, hContact, "ignore_full");
else if (ignore == 0)
ExtraIcon_Clear(hExtraIcon, hContact);
else if (isIgnored(hContact, IGNOREEVENT_MESSAGE))
- ExtraIcon_SetIcon(hExtraIcon, hContact, "ignore_mess");
+ ExtraIcon_SetIconByName(hExtraIcon, hContact, "ignore_mess");
else
- ExtraIcon_SetIcon(hExtraIcon, hContact, "ignore_part");
+ ExtraIcon_SetIconByName(hExtraIcon, hContact, "ignore_part");
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -169,7 +169,7 @@ extern "C" int __declspec(dllexport) Load(void)
//IcoLib support
Icon_Register(g_hInst, LPGEN("Ignore State"), iconList, _countof(iconList));
- hExtraIcon = ExtraIcon_Register("ignore", LPGEN("Ignore State"), "ignore_full");
+ hExtraIcon = ExtraIcon_RegisterIcolib("ignore", LPGEN("Ignore State"), "ignore_full");
return 0;
}
diff --git a/plugins/ListeningTo/src/listeningto.cpp b/plugins/ListeningTo/src/listeningto.cpp
index 22a5663a82..c1472b79cb 100644
--- a/plugins/ListeningTo/src/listeningto.cpp
+++ b/plugins/ListeningTo/src/listeningto.cpp
@@ -145,8 +145,7 @@ extern "C" int __declspec(dllexport) Load(void)
Icon_Register(hInst, LPGEN("ListeningTo"), iconList, _countof(iconList));
// Extra icon support
- hExtraIcon = ExtraIcon_Register(MODULE_NAME "_icon", LPGEN("Listening to music"), "listening_to_icon");
-
+ hExtraIcon = ExtraIcon_RegisterIcolib(MODULE_NAME "_icon", LPGEN("Listening to music"), "listening_to_icon");
return 0;
}
@@ -911,7 +910,7 @@ void HasNewListeningInfo()
void SetExtraIcon(MCONTACT hContact, BOOL set)
{
- ExtraIcon_SetIcon(hExtraIcon, hContact, set ? "listening_to_icon" : NULL);
+ ExtraIcon_SetIconByName(hExtraIcon, hContact, set ? "listening_to_icon" : NULL);
}
int SettingChanged(WPARAM hContact,LPARAM lParam)
diff --git a/plugins/MobileState/src/main.cpp b/plugins/MobileState/src/main.cpp
index 256e727e6b..e39187cad1 100644
--- a/plugins/MobileState/src/main.cpp
+++ b/plugins/MobileState/src/main.cpp
@@ -74,7 +74,7 @@ int ExtraIconsApply(WPARAM wParam, LPARAM lParam)
return 0;
if (hasMobileClient(wParam, lParam))
- ExtraIcon_SetIcon(hExtraIcon, wParam, "mobile_icon");
+ ExtraIcon_SetIconByName(hExtraIcon, wParam, "mobile_icon");
else
ExtraIcon_Clear(hExtraIcon, wParam);
@@ -115,8 +115,7 @@ extern "C" int __declspec(dllexport) Load(void)
Icon_Register(g_hInst, "Mobile State", &icon, 1);
// Extra icons
- hExtraIcon = ExtraIcon_Register("mobilestate", LPGEN("Mobile State"), "mobile_icon");
-
+ hExtraIcon = ExtraIcon_RegisterIcolib("mobilestate", LPGEN("Mobile State"), "mobile_icon");
return 0;
}
diff --git a/plugins/New_GPG/src/icons.cpp b/plugins/New_GPG/src/icons.cpp
index d5206f3858..6d89633710 100644
--- a/plugins/New_GPG/src/icons.cpp
+++ b/plugins/New_GPG/src/icons.cpp
@@ -40,9 +40,9 @@ void setClistIcon(MCONTACT hContact)
extern HANDLE g_hCLIcon;
MCONTACT hMC = db_mc_tryMeta(hContact);
const char *szIconId = (enabled) ? "secured" : NULL;
- ExtraIcon_SetIcon(g_hCLIcon, hContact, szIconId);
+ ExtraIcon_SetIconByName(g_hCLIcon, hContact, szIconId);
if(hMC != hContact)
- ExtraIcon_SetIcon(g_hCLIcon, hMC, szIconId);
+ ExtraIcon_SetIconByName(g_hCLIcon, hMC, szIconId);
}
void setSrmmIcon(MCONTACT h)
diff --git a/plugins/New_GPG/src/init.cpp b/plugins/New_GPG/src/init.cpp
index 47f7733ec3..56b307e177 100644
--- a/plugins/New_GPG/src/init.cpp
+++ b/plugins/New_GPG/src/init.cpp
@@ -214,8 +214,7 @@ extern "C" int __declspec(dllexport) Load()
InitIconLib();
- g_hCLIcon = ExtraIcon_Register(szGPGModuleName, Translate("GPG encryption status"), "secured", onExtraImageListRebuilding, onExtraImageApplying);
-
+ g_hCLIcon = ExtraIcon_RegisterCallack(szGPGModuleName, Translate("GPG encryption status"), "secured", onExtraImageListRebuilding, onExtraImageApplying);
return 0;
}
diff --git a/plugins/Quotes/src/ExtraImages.cpp b/plugins/Quotes/src/ExtraImages.cpp
index 1f346f81f6..dd823bfcc2 100644
--- a/plugins/Quotes/src/ExtraImages.cpp
+++ b/plugins/Quotes/src/ExtraImages.cpp
@@ -4,7 +4,7 @@ static HANDLE hExtraIcon;
void Quotes_InitExtraIcons()
{
- hExtraIcon = ExtraIcon_Register(ICON_STR_QUOTE, QUOTES_PROTOCOL_NAME, Quotes_MakeIconName(ICON_STR_MAIN).c_str());
+ hExtraIcon = ExtraIcon_RegisterIcolib(ICON_STR_QUOTE, QUOTES_PROTOCOL_NAME, Quotes_MakeIconName(ICON_STR_MAIN).c_str());
}
bool SetContactExtraImage(MCONTACT hContact, EImageIndex nIndex)
diff --git a/plugins/Rate/src/main.cpp b/plugins/Rate/src/main.cpp
index b7f234572b..7677f10aa5 100644
--- a/plugins/Rate/src/main.cpp
+++ b/plugins/Rate/src/main.cpp
@@ -85,7 +85,7 @@ static void setExtraIcon(MCONTACT hContact, int bRate = -1, BOOL clear = TRUE)
}
if (icon != NULL || clear)
- ExtraIcon_SetIcon(hExtraIcon, hContact, icon);
+ ExtraIcon_SetIconByName(hExtraIcon, hContact, icon);
}
///////////////////////////////////////////////////////////////////////////////
@@ -127,8 +127,7 @@ extern "C" int __declspec(dllexport) Load(void)
Icon_Register(g_hInst, LPGEN("Contact rate"), iconList, _countof(iconList));
// Extra icon support
- hExtraIcon = ExtraIcon_Register("contact_rate", LPGEN("Contact rate"), "rate_high");
-
+ hExtraIcon = ExtraIcon_RegisterIcolib("contact_rate", LPGEN("Contact rate"), "rate_high");
return 0;
}
diff --git a/plugins/SecureIM/src/main.cpp b/plugins/SecureIM/src/main.cpp
index e5fcdd8439..bfbfa8f566 100644
--- a/plugins/SecureIM/src/main.cpp
+++ b/plugins/SecureIM/src/main.cpp
@@ -357,7 +357,7 @@ extern "C" __declspec(dllexport) int __cdecl Load(void)
CreateServiceFunction(MODULENAME"/MODE_GPG", Service_ModeGPG);
CreateServiceFunction(MODULENAME"/MODE_RSA", Service_ModeRSAAES);
- g_hCLIcon = ExtraIcon_Register(MODULENAME, LPGEN("SecureIM status"), "sim_cm_est", onExtraImageListRebuilding, onExtraImageApplying);
+ g_hCLIcon = ExtraIcon_RegisterCallack(MODULENAME, LPGEN("SecureIM status"), "sim_cm_est", onExtraImageListRebuilding, onExtraImageApplying);
return 0;
}
diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp
index 452252e78d..57fa1319d6 100644
--- a/plugins/TabSRMM/src/msgdialog.cpp
+++ b/plugins/TabSRMM/src/msgdialog.cpp
@@ -2037,7 +2037,7 @@ INT_PTR CALLBACK DlgProcMessage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lP
break;
case IDM_OPENEXISTING:
- Utils_OpenUrlT(tszUrl,false);
+ Utils_OpenUrlT(tszUrl, false);
break;
case IDM_COPYLINK:
diff --git a/plugins/UserInfoEx/src/Flags/svc_flags.cpp b/plugins/UserInfoEx/src/Flags/svc_flags.cpp
index e8cd5ab68b..33d0ccf619 100644
--- a/plugins/UserInfoEx/src/Flags/svc_flags.cpp
+++ b/plugins/UserInfoEx/src/Flags/svc_flags.cpp
@@ -221,7 +221,7 @@ void SvcFlagsLoadModule()
char szId[20];
mir_snprintf(szId, _countof(szId), (langid == 0xFFFF) ? "%s_0x%X" : "%s_%i", "flags", langid); /* buffer safe */
- hExtraIconSvc = ExtraIcon_Register("Flags", LPGEN("Flags (uinfoex)"), szId);
+ hExtraIconSvc = ExtraIcon_RegisterIcolib("Flags", LPGEN("Flags (uinfoex)"), szId);
}
/**
diff --git a/plugins/UserInfoEx/src/svc_email.cpp b/plugins/UserInfoEx/src/svc_email.cpp
index 3a8128cc62..825416ad0e 100644
--- a/plugins/UserInfoEx/src/svc_email.cpp
+++ b/plugins/UserInfoEx/src/svc_email.cpp
@@ -127,7 +127,7 @@ static INT_PTR MenuCommand(WPARAM wParam,LPARAM lParam)
static int OnCListApplyIcons(WPARAM wParam, LPARAM lParam)
{
LPSTR val = Get(wParam);
- ExtraIcon_SetIcon(ghExtraIconSvc, wParam, (val) ? ICO_BTN_EMAIL : 0);
+ ExtraIcon_SetIconByName(ghExtraIconSvc, wParam, (val) ? ICO_BTN_EMAIL : 0);
mir_free(val);
return 0;
}
@@ -228,7 +228,7 @@ bool SvcEMailEnableExtraIcons(bool bEnable, bool bUpdateDB)
hApplyIconHook = HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY, OnCListApplyIcons);
if (ghExtraIconSvc == INVALID_HANDLE_VALUE)
- ghExtraIconSvc = ExtraIcon_Register("email", LPGEN("E-mail (uinfoex)"), ICO_BTN_EMAIL);
+ ghExtraIconSvc = ExtraIcon_RegisterIcolib("email", LPGEN("E-mail (uinfoex)"), ICO_BTN_EMAIL);
}
else { // E-mail uncheckt
if (hChangedHook) {
diff --git a/plugins/UserInfoEx/src/svc_gender.cpp b/plugins/UserInfoEx/src/svc_gender.cpp
index 71f0f5eee5..409dca888c 100644
--- a/plugins/UserInfoEx/src/svc_gender.cpp
+++ b/plugins/UserInfoEx/src/svc_gender.cpp
@@ -78,7 +78,7 @@ static int OnCListApplyIcons(MCONTACT hContact, LPARAM)
case 'F': icoName = ICO_COMMON_FEMALE; break;
default: icoName = NULL;
}
- ExtraIcon_SetIcon(ghExtraIconSvc, hContact, icoName);
+ ExtraIcon_SetIconByName(ghExtraIconSvc, hContact, icoName);
}
return 0;
}
@@ -117,7 +117,7 @@ bool SvcGenderEnableExtraIcons(bool bEnable, bool bUpdateDB)
if (g_eiGender) { // Gender checked or dropdown select
if (ghExtraIconSvc == INVALID_HANDLE_VALUE)
- ghExtraIconSvc = ExtraIcon_Register("gender", LPGEN("Gender (uinfoex)"), ICO_COMMON_MALE);
+ ghExtraIconSvc = ExtraIcon_RegisterIcolib("gender", LPGEN("Gender (uinfoex)"), ICO_COMMON_MALE);
// hook events
if (hChangedHook == NULL)
diff --git a/plugins/UserInfoEx/src/svc_homepage.cpp b/plugins/UserInfoEx/src/svc_homepage.cpp
index 609eff8649..773846657e 100644
--- a/plugins/UserInfoEx/src/svc_homepage.cpp
+++ b/plugins/UserInfoEx/src/svc_homepage.cpp
@@ -93,7 +93,7 @@ static int OnCListApplyIcons(MCONTACT hContact, LPARAM)
{
LPSTR val = Get(hContact);
if (ghExtraIconSvc != INVALID_HANDLE_VALUE)
- ExtraIcon_SetIcon(ghExtraIconSvc, hContact, (val) ? ICO_BTN_GOTO : NULL);
+ ExtraIcon_SetIconByName(ghExtraIconSvc, hContact, (val) ? ICO_BTN_GOTO : NULL);
MIR_FREE(val);
return 0;
}
@@ -188,7 +188,7 @@ bool SvcHomepageEnableExtraIcons(bool bEnable, bool bUpdateDB)
hApplyIconHook = HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY, (MIRANDAHOOK)OnCListApplyIcons);
if (ghExtraIconSvc == INVALID_HANDLE_VALUE)
- ghExtraIconSvc = ExtraIcon_Register("homepage", LPGEN("Homepage (uinfoex)"), ICO_BTN_GOTO);
+ ghExtraIconSvc = ExtraIcon_RegisterIcolib("homepage", LPGEN("Homepage (uinfoex)"), ICO_BTN_GOTO);
}
else {
if (hChangedHook) {
diff --git a/plugins/UserInfoEx/src/svc_phone.cpp b/plugins/UserInfoEx/src/svc_phone.cpp
index d236757f2c..9246ff87a0 100644
--- a/plugins/UserInfoEx/src/svc_phone.cpp
+++ b/plugins/UserInfoEx/src/svc_phone.cpp
@@ -94,7 +94,7 @@ static int OnCListApplyIcons(MCONTACT hContact, LPARAM)
case PHONE_SMS: icoName = ICO_BTN_CELLULAR; break;
default: icoName = NULL;
}
- ExtraIcon_SetIcon(ghExtraIconSvc, hContact, icoName);
+ ExtraIcon_SetIconByName(ghExtraIconSvc, hContact, icoName);
return 0;
}
@@ -146,7 +146,7 @@ bool SvcPhoneEnableExtraIcons(bool bEnable, bool bUpdateDB)
hApplyIconHook = HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY, (MIRANDAHOOK)OnCListApplyIcons);
if (ghExtraIconSvc == INVALID_HANDLE_VALUE)
- ghExtraIconSvc = ExtraIcon_Register("sms", LPGEN("Phone (uinfoex)"), ICO_BTN_CELLULAR);
+ ghExtraIconSvc = ExtraIcon_RegisterIcolib("sms", LPGEN("Phone (uinfoex)"), ICO_BTN_CELLULAR);
}
else {
if (hChangedHook) {
diff --git a/plugins/UserInfoEx/src/svc_reminder.cpp b/plugins/UserInfoEx/src/svc_reminder.cpp
index 6d84a26dad..aacdf1e6c1 100644
--- a/plugins/UserInfoEx/src/svc_reminder.cpp
+++ b/plugins/UserInfoEx/src/svc_reminder.cpp
@@ -200,7 +200,7 @@ static void NotifyWithExtraIcon(MCONTACT hContact, const CEvent &evt)
default:
return;
}
- ExtraIcon_SetIcon(ExtraIcon, hContact, icoName);
+ ExtraIcon_SetIconByName(ExtraIcon, hContact, icoName);
}
}
@@ -928,7 +928,7 @@ void SvcReminderLoadModule(void)
Hotkey_Register(&hk);
if (db_get_b(NULL, MODNAME, SET_REMIND_ENABLED, DEFVAL_REMIND_ENABLED) != REMIND_OFF && ExtraIcon == INVALID_HANDLE_VALUE)
- ExtraIcon = ExtraIcon_Register("Reminder", LPGEN("Reminder (uinfoex)"), ICO_COMMON_ANNIVERSARY);
+ ExtraIcon = ExtraIcon_RegisterIcolib("Reminder", LPGEN("Reminder (uinfoex)"), ICO_COMMON_ANNIVERSARY);
}
diff --git a/plugins/WhenWasIt/src/icons.cpp b/plugins/WhenWasIt/src/icons.cpp
index 624992a49f..98760e03c6 100644
--- a/plugins/WhenWasIt/src/icons.cpp
+++ b/plugins/WhenWasIt/src/icons.cpp
@@ -66,7 +66,7 @@ int AddIcons()
mir_snprintf(description, _countof(description), Translate("More than %d days to birthday"), cDTB - 1);
hDTBMore = AddIcon("DTBMore", description, tszPath, IDI_DTBMORE);
- hWWIExtraIcons = ExtraIcon_Register("WhenWasIt", LPGEN("WhenWasIt birthday reminder"), "MenuCheck");
+ hWWIExtraIcons = ExtraIcon_RegisterIcolib("WhenWasIt", LPGEN("WhenWasIt birthday reminder"), "MenuCheck");
return 0;
}
diff --git a/protocols/AimOscar/src/theme.cpp b/protocols/AimOscar/src/theme.cpp
index 5564d4f421..cbcd33e7e4 100644
--- a/protocols/AimOscar/src/theme.cpp
+++ b/protocols/AimOscar/src/theme.cpp
@@ -164,8 +164,8 @@ void add_ES_icons(CAimProto* ppro)
void InitExtraIcons(void)
{
- hExtraAT = ExtraIcon_Register("aimaccounttype", LPGEN("AIM Account Type"), "AIM_aol");
- hExtraES = ExtraIcon_Register("aimextstatus", LPGEN("AIM Extended Status"), "AIM_hiptop");
+ hExtraAT = ExtraIcon_RegisterIcolib("aimaccounttype", LPGEN("AIM Account Type"), "AIM_aol");
+ hExtraES = ExtraIcon_RegisterIcolib("aimextstatus", LPGEN("AIM Extended Status"), "AIM_hiptop");
}
/////////////////////////////////////////////////////////////////////////////////////////
diff --git a/protocols/IcqOscarJ/src/init.cpp b/protocols/IcqOscarJ/src/init.cpp
index e922d09cfa..59794f946a 100644
--- a/protocols/IcqOscarJ/src/init.cpp
+++ b/protocols/IcqOscarJ/src/init.cpp
@@ -123,7 +123,7 @@ extern "C" int __declspec(dllexport) Load(void)
HookEvent(ME_SYSTEM_PRESHUTDOWN, OnPreShutdown);
- hExtraXStatus = ExtraIcon_Register("xstatus", LPGEN("ICQ xStatus"), "icq_xstatus13");
+ hExtraXStatus = ExtraIcon_RegisterIcolib("xstatus", LPGEN("ICQ xStatus"), "icq_xstatus13");
g_MenuInit();
return 0;
diff --git a/protocols/JabberG/src/jabber.cpp b/protocols/JabberG/src/jabber.cpp
index 10e21ebd18..8065b8a0c4 100644
--- a/protocols/JabberG/src/jabber.cpp
+++ b/protocols/JabberG/src/jabber.cpp
@@ -212,8 +212,8 @@ extern "C" int __declspec(dllexport) Load()
g_IconsInit();
g_XstatusIconsInit();
// Init extra icons
- hExtraActivity = ExtraIcon_Register("activity", LPGEN("Jabber Activity"), "jabber_dancing");
- hExtraMood = ExtraIcon_Register("mood", LPGEN("Jabber Mood"), "jabber_contemplative");
+ hExtraActivity = ExtraIcon_RegisterIcolib("activity", LPGEN("Jabber Activity"), "jabber_dancing");
+ hExtraMood = ExtraIcon_RegisterIcolib("mood", LPGEN("Jabber Mood"), "jabber_contemplative");
g_MenuInit();
HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded);
JabberUserInfoInit();
diff --git a/protocols/MRA/src/MraProto.cpp b/protocols/MRA/src/MraProto.cpp
index ffc0918b64..020ebc5c8a 100644
--- a/protocols/MRA/src/MraProto.cpp
+++ b/protocols/MRA/src/MraProto.cpp
@@ -51,8 +51,8 @@ CMraProto::CMraProto(const char* _module, const TCHAR* _displayName) :
HookProtoEvent(ME_CLIST_PREBUILDSTATUSMENU, &CMraProto::MraRebuildStatusMenu);
- hExtraXstatusIcon = ExtraIcon_Register("MRAXstatus", LPGEN("Mail.ru xStatus"), "mra_xstatus25");
- hExtraInfo = ExtraIcon_Register("MRAStatus", LPGEN("Mail.ru extra info"), MRA_XSTATUS_UNKNOWN_STR);
+ hExtraXstatusIcon = ExtraIcon_RegisterIcolib("MRAXstatus", LPGEN("Mail.ru xStatus"), "mra_xstatus25");
+ hExtraInfo = ExtraIcon_RegisterIcolib("MRAStatus", LPGEN("Mail.ru extra info"), MRA_XSTATUS_UNKNOWN_STR);
m_bHideXStatusUI = false;
m_iXStatus = getByte(DBSETTING_XSTATUSID, MRA_MIR_XSTATUS_NONE);
diff --git a/protocols/Steam/src/main.cpp b/protocols/Steam/src/main.cpp
index 15436fbe90..204bdd56db 100644
--- a/protocols/Steam/src/main.cpp
+++ b/protocols/Steam/src/main.cpp
@@ -51,18 +51,15 @@ extern "C" int __declspec(dllexport) Load(void)
// extra statuses
HookEvent(ME_SKIN2_ICONSCHANGED, OnReloadIcons);
- hExtraXStatus = ExtraIcon_Register("steam_game", LPGEN("Steam game"), iconName);
+ hExtraXStatus = ExtraIcon_RegisterIcolib("steam_game", LPGEN("Steam game"), iconName);
CSteamProto::InitMenus();
-
return 0;
}
extern "C" int __declspec(dllexport) Unload(void)
{
CSteamProto::UninitProtoInstances();
-
CSteamProto::UninitMenus();
-
return 0;
-} \ No newline at end of file
+}
diff --git a/protocols/Xfire/src/main.cpp b/protocols/Xfire/src/main.cpp
index 0f237313ce..e77a57a8dd 100644
--- a/protocols/Xfire/src/main.cpp
+++ b/protocols/Xfire/src/main.cpp
@@ -1223,8 +1223,8 @@ extern "C" __declspec(dllexport) int Load(void)
Icon_Register(hinstance, LPGEN("Protocols") "/" LPGEN("XFire"), &icon, 1);
- hExtraIcon1 = ExtraIcon_Register("xfire_game", LPGEN("XFire game icon"), "", NULL, ExtraImageApply1);
- hExtraIcon2 = ExtraIcon_Register("xfire_voice", LPGEN("XFire voice icon"), "", NULL, ExtraImageApply2);
+ hExtraIcon1 = ExtraIcon_RegisterCallack("xfire_game", LPGEN("XFire game icon"), "", NULL, ExtraImageApply1);
+ hExtraIcon2 = ExtraIcon_RegisterCallack("xfire_voice", LPGEN("XFire voice icon"), "", NULL, ExtraImageApply2);
return 0;
}
diff --git a/src/mir_app/src/DefaultExtraIcons.cpp b/src/mir_app/src/DefaultExtraIcons.cpp
index e5fa87d324..163ad21bc4 100644
--- a/src/mir_app/src/DefaultExtraIcons.cpp
+++ b/src/mir_app/src/DefaultExtraIcons.cpp
@@ -301,19 +301,19 @@ static int ProtocolOnClick(WPARAM wParam, LPARAM, LPARAM)
void DefaultExtraIcons_Load()
{
- hExtraChat = ExtraIcon_Register("chat_activity", LPGEN("Chat activity"), "ChatActivity");
- hExtraVisibility = ExtraIcon_Register("visibility", "Visibility", Skin_GetIconName(SKINICON_OTHER_VISIBLE_ALL));
- hExtraGender = ExtraIcon_Register("gender", "Gender", "gender_male");
- hExtraProto = ExtraIcon_Register("protocol", "Account", Skin_GetIconName(SKINICON_OTHER_ACCMGR),
+ hExtraChat = ExtraIcon_RegisterIcolib("chat_activity", LPGEN("Chat activity"), "ChatActivity");
+ hExtraVisibility = ExtraIcon_RegisterIcolib("visibility", "Visibility", Skin_GetIconName(SKINICON_OTHER_VISIBLE_ALL));
+ hExtraGender = ExtraIcon_RegisterIcolib("gender", "Gender", "gender_male");
+ hExtraProto = ExtraIcon_RegisterCallack("protocol", "Account", Skin_GetIconName(SKINICON_OTHER_ACCMGR),
&ProtocolRebuildIcons, &ProtocolApplyIcon, &ProtocolOnClick);
for (int i = 0; i < _countof(infos); i++) {
Info &p = infos[i];
p.hIcolib = Skin_GetIconHandle(p.iSkinIcon);
if (p.OnClick)
- p.hExtraIcon = ExtraIcon_Register(p.name, p.desc, Skin_GetIconName(p.iSkinIcon), DefaultOnClick, (LPARAM)&p);
+ p.hExtraIcon = ExtraIcon_RegisterIcolib(p.name, p.desc, Skin_GetIconName(p.iSkinIcon), DefaultOnClick, (LPARAM)&p);
else
- p.hExtraIcon = ExtraIcon_Register(p.name, p.desc, Skin_GetIconName(p.iSkinIcon));
+ p.hExtraIcon = ExtraIcon_RegisterIcolib(p.name, p.desc, Skin_GetIconName(p.iSkinIcon));
}
for (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
diff --git a/src/mir_app/src/extraicons.cpp b/src/mir_app/src/extraicons.cpp
index ff11fbfed4..77392cf048 100644
--- a/src/mir_app/src/extraicons.cpp
+++ b/src/mir_app/src/extraicons.cpp
@@ -209,7 +209,7 @@ void RebuildListsBasedOnGroups(LIST<ExtraIconGroup> &groups)
///////////////////////////////////////////////////////////////////////////////
-void KillModuleExtraIcons(int hLangpack)
+MIR_APP_DLL(void) KillModuleExtraIcons(int hLangpack)
{
LIST<ExtraIcon> arDeleted(1);
@@ -345,79 +345,19 @@ void fnSetAllExtraIcons(MCONTACT hContact)
///////////////////////////////////////////////////////////////////////////////
// Services
-INT_PTR ExtraIcon_Register(WPARAM wParam, LPARAM lParam)
+static void EI_PostCreate(BaseExtraIcon *extra, const char *name, int hLangpack)
{
- if (wParam == 0)
- return 0;
-
- EXTRAICON_INFO *ei = (EXTRAICON_INFO *)wParam;
- if (ei->cbSize < 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))
- return 0;
- if (ei->type == EXTRAICON_TYPE_CALLBACK && (ei->ApplyIcon == NULL || ei->RebuildIcons == NULL))
- return 0;
-
- ptrT tszDesc(mir_a2t(ei->description));
- TCHAR *desc = TranslateTH(lParam, tszDesc);
-
- BaseExtraIcon *extra = GetExtraIconByName(ei->name);
- if (extra != NULL) {
- if (ei->type != extra->getType() || ei->type != EXTRAICON_TYPE_ICOLIB)
- return 0;
-
- // Found one, now merge it
- if (mir_tstrcmpi(extra->getDescription(), desc)) {
- CMString newDesc = extra->getDescription();
- newDesc += _T(" / ");
- newDesc += desc;
- extra->setDescription(newDesc.c_str());
- }
-
- if (!IsEmpty(ei->descIcon))
- extra->setDescIcon(ei->descIcon);
-
- if (ei->OnClick != NULL)
- extra->setOnClick(ei->OnClick, ei->onClickParam);
-
- if (extra->getSlot() > 0) {
- if (clistRebuildAlreadyCalled)
- extra->rebuildIcons();
- if (clistApplyAlreadyCalled)
- extraIconsByHandle[extra->getID() - 1]->applyIcons();
- }
-
- return extra->getID();
- }
-
- int id = registeredExtraIcons.getCount() + 1;
-
- switch (ei->type) {
- case EXTRAICON_TYPE_CALLBACK:
- extra = new CallbackExtraIcon(id, ei->name, desc, ei->descIcon == NULL ? "" : ei->descIcon,
- ei->RebuildIcons, ei->ApplyIcon, ei->OnClick, ei->onClickParam);
- break;
- case EXTRAICON_TYPE_ICOLIB:
- extra = new IcolibExtraIcon(id, ei->name, desc, ei->descIcon == NULL ? "" : ei->descIcon, ei->OnClick,
- ei->onClickParam);
- break;
- default:
- return 0;
- }
-
char setting[512];
- mir_snprintf(setting, "Position_%s", ei->name);
+ mir_snprintf(setting, "Position_%s", name);
extra->setPosition(db_get_w(NULL, MODULE_NAME, setting, 1000));
- mir_snprintf(setting, "Slot_%s", ei->name);
+ mir_snprintf(setting, "Slot_%s", name);
int slot = db_get_w(NULL, MODULE_NAME, setting, 1);
if (slot == (WORD)-1)
slot = -1;
extra->setSlot(slot);
- extra->hLangpack = (int)lParam;
+ extra->hLangpack = hLangpack;
registeredExtraIcons.insert(extra);
extraIconsByHandle.insert(extra);
@@ -452,40 +392,112 @@ INT_PTR ExtraIcon_Register(WPARAM wParam, LPARAM lParam)
extra->applyIcons();
}
}
+}
+
+EXTERN_C MIR_APP_DLL(HANDLE) ExtraIcon_RegisterCallack(const char *name, const char *description, const char *descIcon,
+ MIRANDAHOOK RebuildIcons, MIRANDAHOOK ApplyIcon,
+ MIRANDAHOOKPARAM OnClick, LPARAM onClickParam, int hLangpack)
+{
+ // EXTRAICON_TYPE_CALLBACK
+ if (IsEmpty(name) || IsEmpty(description))
+ return 0;
- return id;
+ if (ApplyIcon == NULL || RebuildIcons == NULL)
+ return 0;
+
+ // no way to merge
+ if (GetExtraIconByName(name) != NULL)
+ return 0;
+
+ ptrT tszDesc(mir_a2t(description));
+ TCHAR *desc = TranslateTH(hLangpack, tszDesc);
+
+ int id = registeredExtraIcons.getCount() + 1;
+ BaseExtraIcon *extra = new CallbackExtraIcon(id, name, desc, descIcon == NULL ? "" : descIcon, RebuildIcons, ApplyIcon, OnClick, onClickParam);
+ EI_PostCreate(extra, name, hLangpack);
+ return (HANDLE)id;
}
-INT_PTR ExtraIcon_SetIcon(WPARAM wParam, LPARAM)
+EXTERN_C MIR_APP_DLL(HANDLE) ExtraIcon_RegisterIcolib(const char *name, const char *description, const char *descIcon,
+ MIRANDAHOOKPARAM OnClick, LPARAM onClickParam, int hLangpack)
{
- if (wParam == 0)
- return -1;
+ if (IsEmpty(name) || IsEmpty(description))
+ return 0;
+
+ ptrT tszDesc(mir_a2t(description));
+ TCHAR *desc = TranslateTH(hLangpack, tszDesc);
- EXTRAICON *ei = (EXTRAICON*)wParam;
- if (ei->cbSize < sizeof(EXTRAICON) || ei->hExtraIcon == NULL || ei->hContact == NULL)
+ BaseExtraIcon *extra = GetExtraIconByName(name);
+ if (extra != NULL) {
+ if (extra->getType() != EXTRAICON_TYPE_ICOLIB)
+ return 0;
+
+ // Found one, now merge it
+ if (mir_tstrcmpi(extra->getDescription(), desc)) {
+ CMString newDesc = extra->getDescription();
+ newDesc += _T(" / ");
+ newDesc += desc;
+ extra->setDescription(newDesc.c_str());
+ }
+
+ if (!IsEmpty(descIcon))
+ extra->setDescIcon(descIcon);
+
+ if (OnClick != NULL)
+ extra->setOnClick(OnClick, onClickParam);
+
+ if (extra->getSlot() > 0) {
+ if (clistRebuildAlreadyCalled)
+ extra->rebuildIcons();
+ if (clistApplyAlreadyCalled)
+ extraIconsByHandle[extra->getID() - 1]->applyIcons();
+ }
+
+ return (HANDLE)extra->getID();
+ }
+
+ int id = registeredExtraIcons.getCount() + 1;
+ extra = new IcolibExtraIcon(id, name, desc, descIcon == NULL ? "" : descIcon, OnClick, onClickParam);
+ EI_PostCreate(extra, name, hLangpack);
+ return (HANDLE)id;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+
+MIR_APP_DLL(int) ExtraIcon_SetIcon(HANDLE hExtraIcon, MCONTACT hContact, HANDLE hImage)
+{
+ if (hExtraIcon == NULL || hContact == NULL)
return -1;
- ExtraIcon *extra = GetExtraIcon(ei->hExtraIcon);
+ ExtraIcon *extra = GetExtraIcon(hExtraIcon);
if (extra == NULL)
return -1;
- return extra->setIcon((int)ei->hExtraIcon, ei->hContact, ei->hImage);
+ return extra->setIcon((int)hExtraIcon, hContact, hImage);
}
-INT_PTR ExtraIcon_SetIconByName(WPARAM wParam, LPARAM)
+MIR_APP_DLL(int) ExtraIcon_SetIconByName(HANDLE hExtraIcon, MCONTACT hContact, const char *icoName)
{
- if (wParam == 0)
+ if (hExtraIcon == NULL || hContact == NULL)
+ return -1;
+
+ ExtraIcon *extra = GetExtraIcon(hExtraIcon);
+ if (extra == NULL)
return -1;
- EXTRAICON *ei = (EXTRAICON*)wParam;
- if (ei->cbSize < sizeof(EXTRAICON) || ei->hExtraIcon == NULL || ei->hContact == NULL)
+ return extra->setIconByName((int)hExtraIcon, hContact, icoName);
+}
+
+MIR_APP_DLL(int) ExtraIcon_Clear(HANDLE hExtraIcon, MCONTACT hContact)
+{
+ if (hExtraIcon == NULL || hContact == NULL)
return -1;
- ExtraIcon *extra = GetExtraIcon(ei->hExtraIcon);
+ ExtraIcon *extra = GetExtraIcon(hExtraIcon);
if (extra == NULL)
return -1;
- return extra->setIconByName((int)ei->hExtraIcon, ei->hContact, ei->icoName);
+ return extra->setIcon((int)hExtraIcon, hContact, NULL);
}
static INT_PTR svcExtraIcon_Add(WPARAM wParam, LPARAM)
@@ -509,10 +521,6 @@ void LoadExtraIconsModule()
clistSlotCount = LOWORD(ret);
// 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);
hEventExtraClick = CreateHookableEvent(ME_CLIST_EXTRA_CLICK);
diff --git a/src/mir_app/src/hotkeys.cpp b/src/mir_app/src/hotkeys.cpp
index 0e91b12775..dfcbd9455d 100644
--- a/src/mir_app/src/hotkeys.cpp
+++ b/src/mir_app/src/hotkeys.cpp
@@ -308,7 +308,7 @@ void RegisterHotkeys()
}
}
-void KillModuleHotkeys(int hLangpack)
+MIR_APP_DLL(void) KillModuleHotkeys(int hLangpack)
{
for (int i = hotkeys.getCount() - 1; i >= 0; i--) {
THotkeyItem *item = hotkeys[i];
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def
index 5ae5f527e7..5d20787f03 100644
--- a/src/mir_app/src/mir_app.def
+++ b/src/mir_app/src/mir_app.def
@@ -235,4 +235,15 @@ Menu_BuildGroupMenu @233
Menu_AddTrayMenuItem @234
Menu_BuildTrayMenu @235
Menu_DestroyNestedMenu @236
-KillModuleIcons @237
+ExtraIcon_SetIcon @237
+ExtraIcon_SetIconByName @238
+ExtraIcon_Clear @239
+ExtraIcon_RegisterCallack @240
+ExtraIcon_RegisterIcolib @241
+KillModuleIcons @242
+KillModuleColours @243
+KillModuleEffects @244
+KillModuleExtraIcons @245
+KillModuleFonts @246
+KillModuleHotkeys @247
+KillModuleSounds @248
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def
index 2a74b497cf..1cc06d89b0 100644
--- a/src/mir_app/src/mir_app64.def
+++ b/src/mir_app/src/mir_app64.def
@@ -235,4 +235,15 @@ Menu_BuildGroupMenu @233
Menu_AddTrayMenuItem @234
Menu_BuildTrayMenu @235
Menu_DestroyNestedMenu @236
-KillModuleIcons @237
+ExtraIcon_SetIcon @237
+ExtraIcon_SetIconByName @238
+ExtraIcon_Clear @239
+ExtraIcon_RegisterCallack @240
+ExtraIcon_RegisterIcolib @241
+KillModuleIcons @242
+KillModuleColours @243
+KillModuleEffects @244
+KillModuleExtraIcons @245
+KillModuleFonts @246
+KillModuleHotkeys @247
+KillModuleSounds @248
diff --git a/src/mir_app/src/miranda.h b/src/mir_app/src/miranda.h
index 52fedfa58e..d74cee61db 100644
--- a/src/mir_app/src/miranda.h
+++ b/src/mir_app/src/miranda.h
@@ -55,18 +55,6 @@ extern LIST<DATABASELINK> arDbPlugins;
int InitIni(void);
void UninitIni(void);
-/**** extraicons.cpp *******************************************************************/
-
-void KillModuleExtraIcons(int hLangpack);
-
-/**** fontService.cpp ******************************************************************/
-
-void KillModuleFonts(int hLangpack);
-void KillModuleColours(int hLangpack);
-void KillModuleEffects(int hLangpack);
-void KillModuleHotkeys(int hLangpack);
-void KillModuleSounds(int hLangpack);
-
/**** miranda.cpp **********************************************************************/
extern HINSTANCE g_hInst;
diff --git a/src/mir_app/src/services.cpp b/src/mir_app/src/services.cpp
index 3d1fdaf5c2..c074526c4a 100644
--- a/src/mir_app/src/services.cpp
+++ b/src/mir_app/src/services.cpp
@@ -325,7 +325,7 @@ INT_PTR GetFont(WPARAM wParam, LPARAM lParam)
/////////////////////////////////////////////////////////////////////////////////////////
-void KillModuleFonts(int hLangpack)
+MIR_APP_DLL(void) KillModuleFonts(int hLangpack)
{
for (int i = font_id_list.getCount() - 1; i >= 0; i--)
if (font_id_list[i].hLangpack == hLangpack)
@@ -400,7 +400,7 @@ INT_PTR GetColour(WPARAM wParam, LPARAM)
/////////////////////////////////////////////////////////////////////////////////////////
-void KillModuleColours(int hLangpack)
+MIR_APP_DLL(void) KillModuleColours(int hLangpack)
{
for (int i = colour_id_list.getCount() - 1; i >= 0; i--)
if (colour_id_list[i].hLangpack == hLangpack)
@@ -493,7 +493,7 @@ INT_PTR GetEffect(WPARAM wParam, LPARAM lParam)
/////////////////////////////////////////////////////////////////////////////////////////
-void KillModuleEffects(int hLangpack)
+MIR_APP_DLL(void) KillModuleEffects(int hLangpack)
{
for (int i = effect_id_list.getCount() - 1; i >= 0; i--)
if (effect_id_list[i].hLangpack == hLangpack)
diff --git a/src/mir_app/src/sounds.cpp b/src/mir_app/src/sounds.cpp
index 6722e17c83..a8d230ce5c 100644
--- a/src/mir_app/src/sounds.cpp
+++ b/src/mir_app/src/sounds.cpp
@@ -55,7 +55,7 @@ static OBJLIST<SoundItem> arSounds(10, CompareSounds);
///////////////////////////////////////////////////////////////////////////////
-void KillModuleSounds(int hLangpack)
+MIR_APP_DLL(void) KillModuleSounds(int hLangpack)
{
for (int i = arSounds.getCount()-1; i >= 0; i--) {
SoundItem& p = arSounds[i];
diff --git a/src/mir_app/src/stdafx.h b/src/mir_app/src/stdafx.h
index 935e2dd4c1..b5577ece4d 100644
--- a/src/mir_app/src/stdafx.h
+++ b/src/mir_app/src/stdafx.h
@@ -73,6 +73,8 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include <m_protosvc.h>
#include <m_protocols.h>
#include <m_protoint.h>
+#include <m_hotkeys.h>
+#include <m_fontservice.h>
#include <m_options.h>
#include <m_skin.h>
#include <m_contacts.h>