From 7deea6cec5d2173f66d4c2dd75ca0b633b887bc7 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 20 May 2018 00:17:30 +0300 Subject: sounds packed into CMPlugin (reduces usage of hLangpack) --- include/m_core.h | 10 ----- include/m_skin.h | 6 --- include/newpluginapi.h | 11 +++++ libs/win32/mir_app.lib | Bin 161916 -> 162716 bytes libs/win32/mir_core.lib | Bin 322576 -> 321668 bytes libs/win64/mir_app.lib | Bin 156998 -> 157780 bytes libs/win64/mir_core.lib | Bin 323556 -> 322726 bytes plugins/Alarms/src/alarmlist.cpp | 6 +-- plugins/AutoShutdown/src/shutdownsvc.cpp | 2 +- plugins/AvatarHistory/src/AvatarHistory.cpp | 4 +- plugins/BuddyExpectator/src/BuddyExpectator.cpp | 8 ++-- plugins/ChangeKeyboardLayout/src/hook_events.cpp | 4 +- .../ClientChangeNotify/src/ClientChangeNotify.cpp | 2 +- plugins/ConnectionNotify/src/ConnectionNotify.cpp | 5 ++- plugins/ContactsPlus/src/main.cpp | 4 +- plugins/FTPFileYM/src/ftpfile.cpp | 4 +- plugins/GmailNotifier/src/main.cpp | 2 +- plugins/LotusNotify/src/LotusNotify.cpp | 2 +- plugins/MirLua/src/m_sounds.cpp | 7 ++- plugins/NewAwaySysMod/src/AwaySys.cpp | 2 +- plugins/NewXstatusNotify/src/main.cpp | 4 +- plugins/NotesAndReminders/src/main.cpp | 6 +-- plugins/NotifyAnything/src/main.cpp | 2 +- plugins/Nudge/src/main.cpp | 6 +-- plugins/Ping/src/ping.cpp | 4 +- plugins/PluginUpdater/src/PluginUpdater.cpp | 4 +- plugins/SMS/src/SMS_svc.cpp | 4 +- plugins/Scriver/src/msgs.cpp | 12 ++--- plugins/SecureIM/src/main.cpp | 4 +- plugins/SeenPlugin/src/main.cpp | 8 ++-- plugins/TabSRMM/src/globals.cpp | 12 ++--- plugins/TabSRMM/src/typingnotify.cpp | 4 +- plugins/TooltipNotify/src/TooltipNotify.cpp | 8 ++-- plugins/UserInfoEx/src/svc_reminder.cpp | 6 +-- plugins/Weather/src/weather.cpp | 4 +- plugins/WebView/src/main.cpp | 2 +- plugins/WhenWasIt/src/WhenWasIt.cpp | 4 +- plugins/XSoundNotify/src/xsn_main.cpp | 2 +- plugins/YAMN/src/main.cpp | 4 +- protocols/FacebookRM/src/proto.cpp | 12 ++--- protocols/MRA/src/MraProto.cpp | 2 +- protocols/MSN/src/msn_proto.cpp | 4 +- protocols/Omegle/src/proto.cpp | 8 ++-- protocols/SkypeWeb/src/skype_proto.cpp | 4 +- protocols/Twitter/src/theme.cpp | 4 +- protocols/VKontakte/src/vk_proto.cpp | 2 +- src/core/stdfile/src/file.cpp | 8 ++-- src/core/stdmsg/src/msgs.cpp | 14 +++--- src/core/stduseronline/src/useronline.cpp | 3 +- src/mir_app/src/CMPluginBase.cpp | 49 ++++++++++++++++++++- src/mir_app/src/auth.cpp | 4 +- src/mir_app/src/chat_opts.cpp | 22 ++++----- src/mir_app/src/mir_app.def | 5 ++- src/mir_app/src/mir_app64.def | 5 ++- src/mir_app/src/miranda.h | 2 + src/mir_app/src/sounds.cpp | 4 +- src/mir_core/src/mir_core.def | 4 -- src/mir_core/src/mir_core64.def | 4 -- src/mir_core/src/miranda.cpp | 3 ++ src/mir_core/src/modules.cpp | 49 --------------------- 60 files changed, 197 insertions(+), 194 deletions(-) diff --git a/include/m_core.h b/include/m_core.h index 83771c6120..5c6ce4dd5a 100644 --- a/include/m_core.h +++ b/include/m_core.h @@ -301,16 +301,6 @@ MIR_CORE_DLL(wchar_t*) mir_wstrdup(const wchar_t* str); MIR_CORE_DLL(char*) mir_strndup(const char* str, size_t len); MIR_CORE_DLL(wchar_t*) mir_wstrndup(const wchar_t *str, size_t len); -/////////////////////////////////////////////////////////////////////////////// -// modules - -class CMPluginBase; -MIR_CORE_DLL(void) RegisterModule(CMPluginBase*); -MIR_CORE_DLL(void) UnregisterModule(CMPluginBase*); - -MIR_CORE_DLL(HINSTANCE) GetInstByAddress(void* codePtr); -MIR_CORE_DLL(CMPluginBase&) GetPluginByInstance(HINSTANCE hInst); - /////////////////////////////////////////////////////////////////////////////// // print functions diff --git a/include/m_skin.h b/include/m_skin.h index 326abd39d4..956f693fed 100644 --- a/include/m_skin.h +++ b/include/m_skin.h @@ -120,12 +120,6 @@ EXTERN_C MIR_APP_DLL(char*) Skin_GetIconName(int idx); EXTERN_C MIR_APP_DLL(HICON) Skin_LoadProtoIcon(const char *szProto, int status, bool big = false); -///////////////////////////////////////////////////////////////////////////////////////// -// adds a new sound so it has a default and can be changed in the options dialog -// returns 0 on success, nonzero otherwise - -EXTERN_C MIR_APP_DLL(int) Skin_AddSound(const char *name, const wchar_t *section, const wchar_t *description, const wchar_t *defaultFile = nullptr, int = hLangpack); - ///////////////////////////////////////////////////////////////////////////////////////// // plays a registered sound // returns 0 on success, nonzero otherwise diff --git a/include/newpluginapi.h b/include/newpluginapi.h index 859c4e60d0..4aa29322b4 100644 --- a/include/newpluginapi.h +++ b/include/newpluginapi.h @@ -177,6 +177,9 @@ public: __forceinline HINSTANCE getInst() const { return m_hInst; } __forceinline void setInst(HINSTANCE hInst) { m_hInst = hInst; } + //////////////////////////////////////////////////////////////////////////////////////// + // registering module's resources + template __forceinline void registerIcon(const char *szSection, IconItem(&pIcons)[_Size], const char *prefix = nullptr) { @@ -189,6 +192,10 @@ public: Icon_RegisterT(m_hInst, szSection, pIcons, _Size, prefix, m_hLang); } + int addSound(const char *name, const wchar_t *section, const wchar_t *description, const wchar_t *defaultFile = nullptr); + + //////////////////////////////////////////////////////////////////////////////////////// + __forceinline INT_PTR delSetting(const char *name) { return db_unset(0, m_szModuleName, name); @@ -435,4 +442,8 @@ OBJLIST

ACCPROTOPLUGIN

::g_arInstances(1, PtrKeySortT); #endif #endif +EXTERN_C MIR_APP_DLL(HINSTANCE) GetInstByAddress(void* codePtr); +EXTERN_C MIR_APP_DLL(CMPluginBase*) GetPluginByLangId(int hLangpack); +EXTERN_C MIR_APP_DLL(CMPluginBase&) GetPluginByInstance(HINSTANCE hInst); + #endif // M_NEWPLUGINAPI_H__ diff --git a/libs/win32/mir_app.lib b/libs/win32/mir_app.lib index 68d9595d63..35d7e7b703 100644 Binary files a/libs/win32/mir_app.lib and b/libs/win32/mir_app.lib differ diff --git a/libs/win32/mir_core.lib b/libs/win32/mir_core.lib index 92ef6949b1..ec4dad9bc7 100644 Binary files a/libs/win32/mir_core.lib and b/libs/win32/mir_core.lib differ diff --git a/libs/win64/mir_app.lib b/libs/win64/mir_app.lib index 8399490398..e848d13530 100644 Binary files a/libs/win64/mir_app.lib and b/libs/win64/mir_app.lib differ diff --git a/libs/win64/mir_core.lib b/libs/win64/mir_core.lib index 5a162b096e..2478eb8d2a 100644 Binary files a/libs/win64/mir_core.lib and b/libs/win64/mir_core.lib differ diff --git a/plugins/Alarms/src/alarmlist.cpp b/plugins/Alarms/src/alarmlist.cpp index 4d39c16e1c..0cbacdff46 100755 --- a/plugins/Alarms/src/alarmlist.cpp +++ b/plugins/Alarms/src/alarmlist.cpp @@ -777,9 +777,9 @@ int IdleChanged(WPARAM, LPARAM lParam) void InitList() { - Skin_AddSound("Triggered1", LPGENW("Alarms"), LPGENW("Alert 1")); - Skin_AddSound("Triggered2", LPGENW("Alarms"), LPGENW("Alert 2")); - Skin_AddSound("Triggered3", LPGENW("Alarms"), LPGENW("Alert 3")); + g_plugin.addSound("Triggered1", LPGENW("Alarms"), LPGENW("Alert 1")); + g_plugin.addSound("Triggered2", LPGENW("Alarms"), LPGENW("Alert 2")); + g_plugin.addSound("Triggered3", LPGENW("Alarms"), LPGENW("Alert 3")); // load last checked time DBVARIANT dbv; diff --git a/plugins/AutoShutdown/src/shutdownsvc.cpp b/plugins/AutoShutdown/src/shutdownsvc.cpp index 377da09040..699820190c 100644 --- a/plugins/AutoShutdown/src/shutdownsvc.cpp +++ b/plugins/AutoShutdown/src/shutdownsvc.cpp @@ -495,7 +495,7 @@ void InitShutdownSvc(void) { /* Shutdown Dialog */ hwndShutdownDlg = nullptr; - Skin_AddSound("AutoShutdown_Countdown", LPGENW("Alerts"), LPGENW("Automatic shutdown countdown")); + g_plugin.addSound("AutoShutdown_Countdown", LPGENW("Alerts"), LPGENW("Automatic shutdown countdown")); /* Events */ hEventOkToShutdown = CreateHookableEvent(ME_AUTOSHUTDOWN_OKTOSHUTDOWN); diff --git a/plugins/AvatarHistory/src/AvatarHistory.cpp b/plugins/AvatarHistory/src/AvatarHistory.cpp index 789e210640..6c2cd9ff99 100644 --- a/plugins/AvatarHistory/src/AvatarHistory.cpp +++ b/plugins/AvatarHistory/src/AvatarHistory.cpp @@ -331,8 +331,8 @@ extern "C" __declspec(dllexport) int Load(void) Profile_GetPathW(MAX_PATH, profilePath); - Skin_AddSound("avatar_changed", LPGENW("Avatar history"), LPGENW("Contact changed avatar")); - Skin_AddSound("avatar_removed", LPGENW("Avatar history"), LPGENW("Contact removed avatar")); + g_plugin.addSound("avatar_changed", LPGENW("Avatar history"), LPGENW("Contact changed avatar")); + g_plugin.addSound("avatar_removed", LPGENW("Avatar history"), LPGENW("Contact removed avatar")); hAvatarWindowsList = WindowList_Create(); diff --git a/plugins/BuddyExpectator/src/BuddyExpectator.cpp b/plugins/BuddyExpectator/src/BuddyExpectator.cpp index db853ebe9e..4b8d9fab79 100644 --- a/plugins/BuddyExpectator/src/BuddyExpectator.cpp +++ b/plugins/BuddyExpectator/src/BuddyExpectator.cpp @@ -585,10 +585,10 @@ int ModulesLoaded(WPARAM, LPARAM) HookEvent(ME_USERINFO_INITIALISE, UserinfoInit); // add sounds support - Skin_AddSound("buddyExpectatorReturn", LPGENW("BuddyExpectator"), LPGENW("Contact returned")); - Skin_AddSound("buddyExpectatorStillAbsent", LPGENW("BuddyExpectator"), LPGENW("Contact still absent")); - Skin_AddSound("buddyExpectatorMissYou", LPGENW("BuddyExpectator"), LPGENW("Miss you event")); - Skin_AddSound("buddyExpectatorHide", LPGENW("BuddyExpectator"), LPGENW("Hide contact event")); + g_plugin.addSound("buddyExpectatorReturn", LPGENW("BuddyExpectator"), LPGENW("Contact returned")); + g_plugin.addSound("buddyExpectatorStillAbsent", LPGENW("BuddyExpectator"), LPGENW("Contact still absent")); + g_plugin.addSound("buddyExpectatorMissYou", LPGENW("BuddyExpectator"), LPGENW("Miss you event")); + g_plugin.addSound("buddyExpectatorHide", LPGENW("BuddyExpectator"), LPGENW("Hide contact event")); timer_id = SetTimer(nullptr, 0, 1000 * 60 * 60 * 4, TimerProc); // check every 4 hours diff --git a/plugins/ChangeKeyboardLayout/src/hook_events.cpp b/plugins/ChangeKeyboardLayout/src/hook_events.cpp index c7148fb985..22fc9ddc7d 100644 --- a/plugins/ChangeKeyboardLayout/src/hook_events.cpp +++ b/plugins/ChangeKeyboardLayout/src/hook_events.cpp @@ -122,8 +122,8 @@ int ModulesLoaded(WPARAM, LPARAM) ReadPopupOptions(); // Зарегим звук - Skin_AddSound(SND_ChangeLayout, ModuleNameW, LPGENW("Changing Layout")); - Skin_AddSound(SND_ChangeCase, ModuleNameW, LPGENW("Changing Case")); + g_plugin.addSound(SND_ChangeLayout, ModuleNameW, LPGENW("Changing Layout")); + g_plugin.addSound(SND_ChangeCase, ModuleNameW, LPGENW("Changing Case")); // Хук на нажатие клавиши kbHook_All = SetWindowsHookEx(WH_KEYBOARD, (HOOKPROC)Keyboard_Hook, nullptr, GetCurrentThreadId()); diff --git a/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp b/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp index bd7044e69b..5c11b907fb 100644 --- a/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp +++ b/plugins/ClientChangeNotify/src/ClientChangeNotify.cpp @@ -316,7 +316,7 @@ int MirandaLoaded(WPARAM, LPARAM) HookEvent(ME_SYSTEM_MODULEUNLOAD, ModuleLoad); HookEvent(ME_DB_CONTACT_SETTINGCHANGED, ContactSettingChanged); - Skin_AddSound(CLIENTCHANGED_SOUND, nullptr, LPGENW("ClientChangeNotify: Client changed")); + g_plugin.addSound(CLIENTCHANGED_SOUND, nullptr, LPGENW("ClientChangeNotify: Client changed")); if (bPopupExists) { CreateServiceFunction(MS_CCN_TOGGLEPOPUPS, srvTogglePopups); diff --git a/plugins/ConnectionNotify/src/ConnectionNotify.cpp b/plugins/ConnectionNotify/src/ConnectionNotify.cpp index 69892a4ef4..9f997ea8ff 100644 --- a/plugins/ConnectionNotify/src/ConnectionNotify.cpp +++ b/plugins/ConnectionNotify/src/ConnectionNotify.cpp @@ -866,11 +866,14 @@ extern "C" int __declspec(dllexport) Load(void) CreateProtoServiceFunction(PLUGINNAME, PS_SETSTATUS, SetStatus); CreateProtoServiceFunction(PLUGINNAME, PS_GETSTATUS, GetStatus); - Skin_AddSound(PLUGINNAME_NEWSOUND, PLUGINNAMEW, LPGENW("New Connection Notification")); + g_plugin.addSound(PLUGINNAME_NEWSOUND, PLUGINNAMEW, LPGENW("New Connection Notification")); + hOptInit = HookEvent(ME_OPT_INITIALISE, ConnectionNotifyOptInit);//register service to hook option call assert(hOptInit); + hHookModulesLoaded = HookEvent(ME_SYSTEM_MODULESLOADED, modulesloaded);//hook event that all plugins are loaded assert(hHookModulesLoaded); + hHookPreShutdown = HookEvent(ME_SYSTEM_PRESHUTDOWN, preshutdown); return 0; } diff --git a/plugins/ContactsPlus/src/main.cpp b/plugins/ContactsPlus/src/main.cpp index 872f18d593..b114990165 100644 --- a/plugins/ContactsPlus/src/main.cpp +++ b/plugins/ContactsPlus/src/main.cpp @@ -211,8 +211,8 @@ extern "C" __declspec(dllexport) int Load(void) CreateServiceFunction(MS_CONTACTS_RECEIVE, ServiceReceiveCommand); //define event sounds - Skin_AddSound("RecvContacts", LPGENW("Events"), LPGENW("Incoming Contacts"), L"contacts.wav"); - Skin_AddSound("SentContacts", LPGENW("Events"), LPGENW("Outgoing Contacts"), L"ocontacts.wav"); + g_plugin.addSound("RecvContacts", LPGENW("Events"), LPGENW("Incoming Contacts"), L"contacts.wav"); + g_plugin.addSound("SentContacts", LPGENW("Events"), LPGENW("Outgoing Contacts"), L"ocontacts.wav"); return 0; } diff --git a/plugins/FTPFileYM/src/ftpfile.cpp b/plugins/FTPFileYM/src/ftpfile.cpp index 9324f618ad..0df76f1e23 100644 --- a/plugins/FTPFileYM/src/ftpfile.cpp +++ b/plugins/FTPFileYM/src/ftpfile.cpp @@ -346,8 +346,8 @@ int ModulesLoaded(WPARAM, LPARAM) InitMenuItems(); InitTabsrmmButton(); - Skin_AddSound(SOUND_UPCOMPLETE, LPGENW("FTP File"), LPGENW("File upload complete")); - Skin_AddSound(SOUND_CANCEL, LPGENW("FTP File"), LPGENW("Upload canceled")); + g_plugin.addSound(SOUND_UPCOMPLETE, LPGENW("FTP File"), LPGENW("File upload complete")); + g_plugin.addSound(SOUND_CANCEL, LPGENW("FTP File"), LPGENW("Upload canceled")); curl_global_init(CURL_GLOBAL_ALL); diff --git a/plugins/GmailNotifier/src/main.cpp b/plugins/GmailNotifier/src/main.cpp index e36b288309..13544edddd 100644 --- a/plugins/GmailNotifier/src/main.cpp +++ b/plugins/GmailNotifier/src/main.cpp @@ -90,7 +90,7 @@ extern "C" int __declspec(dllexport) Load() mir_getLP(&pluginInfoEx); pcli = Clist_GetInterface(); - Skin_AddSound("Gmail", LPGENW("Other"), LPGENW("Gmail: New thread(s)")); + g_plugin.addSound("Gmail", LPGENW("Other"), LPGENW("Gmail: New thread(s)")); HookEvent(ME_CLIST_DOUBLECLICKED, OpenBrowser); NETLIBUSER nlu = {}; diff --git a/plugins/LotusNotify/src/LotusNotify.cpp b/plugins/LotusNotify/src/LotusNotify.cpp index 542e7eece9..69006c457a 100644 --- a/plugins/LotusNotify/src/LotusNotify.cpp +++ b/plugins/LotusNotify/src/LotusNotify.cpp @@ -1733,7 +1733,7 @@ extern "C" int __declspec(dllexport) Load(void) LoadSettings(); //read from db to variables - Skin_AddSound("LotusNotify", LPGENW("Lotus Notify"), LPGENW("New Lotus document detected")); + g_plugin.addSound("LotusNotify", LPGENW("Lotus Notify"), LPGENW("New Lotus document detected")); HookEvent(ME_OPT_INITIALISE, LotusNotifyOptInit); //register service to hook option call HookEvent(ME_SYSTEM_MODULESLOADED, modulesloaded); //hook event that all plugins are loaded diff --git a/plugins/MirLua/src/m_sounds.cpp b/plugins/MirLua/src/m_sounds.cpp index cd9a089ce4..e6737ed705 100644 --- a/plugins/MirLua/src/m_sounds.cpp +++ b/plugins/MirLua/src/m_sounds.cpp @@ -7,7 +7,12 @@ static int lua_AddSound(lua_State *L) ptrW section(mir_utf8decodeW(luaL_optstring(L, 3, MODULE))); ptrW filePath(mir_utf8decodeW(lua_tostring(L, 4))); - int res = Skin_AddSound(name, section, description, filePath, CMLuaEnvironment::GetEnvironmentId(L)); + int res; + CMPluginBase *pPlugin = GetPluginByLangId(CMLuaEnvironment::GetEnvironmentId(L)); + if (pPlugin != nullptr) + res = pPlugin->addSound(name, section, description, filePath); + else + res = 1; lua_pushboolean(L, res == 0); return 1; diff --git a/plugins/NewAwaySysMod/src/AwaySys.cpp b/plugins/NewAwaySysMod/src/AwaySys.cpp index a36c064cf9..6c4afc8c36 100644 --- a/plugins/NewAwaySysMod/src/AwaySys.cpp +++ b/plugins/NewAwaySysMod/src/AwaySys.cpp @@ -680,7 +680,7 @@ int MirandaLoaded(WPARAM, LPARAM) // we have to read the status message from contacts too... err CreateServiceFunction(MS_AWAYMSG_SHOWAWAYMSG, GetContactStatMsg); - Skin_AddSound(AWAYSYS_STATUSMSGREQUEST_SOUND, nullptr, LPGENW("NewAwaySys: Incoming status message request")); + g_plugin.addSound(AWAYSYS_STATUSMSGREQUEST_SOUND, nullptr, LPGENW("NewAwaySys: Incoming status message request")); if (ServiceExists(MS_VARS_REGISTERTOKEN)) { CreateServiceFunction(MS_AWAYSYS_FREEVARMEM, srvFreeVarMem); diff --git a/plugins/NewXstatusNotify/src/main.cpp b/plugins/NewXstatusNotify/src/main.cpp index 311b419b87..e9383fa63c 100644 --- a/plugins/NewXstatusNotify/src/main.cpp +++ b/plugins/NewXstatusNotify/src/main.cpp @@ -1099,10 +1099,10 @@ void InitMainMenuItem() static void InitSound() { for (int i = ID_STATUS_MIN; i <= ID_STATUS_MAX; i++) - Skin_AddSound(StatusList[Index(i)].lpzSkinSoundName, LPGENW("Status Notify"), StatusList[Index(i)].lpzSkinSoundDesc); + g_plugin.addSound(StatusList[Index(i)].lpzSkinSoundName, LPGENW("Status Notify"), StatusList[Index(i)].lpzSkinSoundDesc); for (int i = 0; i <= ID_STATUSEX_MAX; i++) - Skin_AddSound(StatusListEx[i].lpzSkinSoundName, LPGENW("Status Notify"), StatusListEx[i].lpzSkinSoundDesc); + g_plugin.addSound(StatusListEx[i].lpzSkinSoundName, LPGENW("Status Notify"), StatusListEx[i].lpzSkinSoundDesc); } static int InitTopToolbar(WPARAM, LPARAM) diff --git a/plugins/NotesAndReminders/src/main.cpp b/plugins/NotesAndReminders/src/main.cpp index 7a412c5198..30c88eab08 100644 --- a/plugins/NotesAndReminders/src/main.cpp +++ b/plugins/NotesAndReminders/src/main.cpp @@ -157,9 +157,9 @@ static void InitServices() { // register sounds - Skin_AddSound("AlertReminder", LPGENW("Alerts"), LPGENW("Reminder triggered")); - Skin_AddSound("AlertReminder2", LPGENW("Alerts"), LPGENW("Reminder triggered (Alternative 1)")); - Skin_AddSound("AlertReminder3", LPGENW("Alerts"), LPGENW("Reminder triggered (Alternative 2)")); + g_plugin.addSound("AlertReminder", LPGENW("Alerts"), LPGENW("Reminder triggered")); + g_plugin.addSound("AlertReminder2", LPGENW("Alerts"), LPGENW("Reminder triggered (Alternative 1)")); + g_plugin.addSound("AlertReminder3", LPGENW("Alerts"), LPGENW("Reminder triggered (Alternative 2)")); // register menu command services diff --git a/plugins/NotifyAnything/src/main.cpp b/plugins/NotifyAnything/src/main.cpp index b7d697feec..4b05c673ad 100644 --- a/plugins/NotifyAnything/src/main.cpp +++ b/plugins/NotifyAnything/src/main.cpp @@ -144,7 +144,7 @@ void registerSound(const std::wstring &name) std::wstring id = L"NotifyAnything_" + name; std::wstring desc = L"NotifyAnything: " + name; std::wstring file = name + L".wav"; - Skin_AddSound(_T2A(id.c_str()), LPGENW("Notify Anything"), desc.c_str(), file.c_str()); + g_plugin.addSound(_T2A(id.c_str()), LPGENW("Notify Anything"), desc.c_str(), file.c_str()); } HICON getIcon(const std::wstring &name) diff --git a/plugins/Nudge/src/main.cpp b/plugins/Nudge/src/main.cpp index aae1e09f51..d32aaedcd0 100644 --- a/plugins/Nudge/src/main.cpp +++ b/plugins/Nudge/src/main.cpp @@ -357,7 +357,7 @@ void Nudge_AddAccount(PROTOACCOUNT *proto) wchar_t soundDesc[MAXMODULELABELLENGTH + 10]; mir_snwprintf(soundDesc, LPGENW("Nudge for %s"), proto->tszAccountName); - Skin_AddSound(p->NudgeSoundname, LPGENW("Nudge"), soundDesc); + g_plugin.addSound(p->NudgeSoundname, LPGENW("Nudge"), soundDesc); arNudges.insert(p); } @@ -373,9 +373,9 @@ static void LoadProtocols(void) // Load the default nudge mir_snprintf(DefaultNudge.ProtocolName, "Default"); mir_snprintf(DefaultNudge.NudgeSoundname, "Nudge : Default"); - Skin_AddSound(DefaultNudge.NudgeSoundname, LPGENW("Nudge"), LPGENW("Default Nudge")); + g_plugin.addSound(DefaultNudge.NudgeSoundname, LPGENW("Nudge"), LPGENW("Default Nudge")); + DefaultNudge.Load(); - GlobalNudge.Load(); for (auto &pa : Accounts()) diff --git a/plugins/Ping/src/ping.cpp b/plugins/Ping/src/ping.cpp index 8e2a1be6b2..01d99dedd4 100644 --- a/plugins/Ping/src/ping.cpp +++ b/plugins/Ping/src/ping.cpp @@ -135,8 +135,8 @@ extern "C" __declspec(dllexport) int Load(void) LoadOptions(); - Skin_AddSound("PingTimeout", LPGENW("Ping"), LPGENW("Timeout")); - Skin_AddSound("PingReply", LPGENW("Ping"), LPGENW("Reply")); + g_plugin.addSound("PingTimeout", LPGENW("Ping"), LPGENW("Timeout")); + g_plugin.addSound("PingReply", LPGENW("Ping"), LPGENW("Reply")); HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded); HookEvent(ME_OPT_INITIALISE, PingOptInit); diff --git a/plugins/PluginUpdater/src/PluginUpdater.cpp b/plugins/PluginUpdater/src/PluginUpdater.cpp index 49baa4f787..00e23eb0c8 100644 --- a/plugins/PluginUpdater/src/PluginUpdater.cpp +++ b/plugins/PluginUpdater/src/PluginUpdater.cpp @@ -99,8 +99,8 @@ extern "C" __declspec(dllexport) int Load(void) InitEvents(); // add sounds - Skin_AddSound("updatecompleted", LPGENW("Plugin Updater"), LPGENW("Update completed")); - Skin_AddSound("updatefailed", LPGENW("Plugin Updater"), LPGENW("Update failed")); + g_plugin.addSound("updatecompleted", LPGENW("Plugin Updater"), LPGENW("Update completed")); + g_plugin.addSound("updatefailed", LPGENW("Plugin Updater"), LPGENW("Update failed")); // Upgrade old settings if (-1 == db_get_b(0, MODNAME, DB_SETTING_UPDATE_MODE, -1)) { diff --git a/plugins/SMS/src/SMS_svc.cpp b/plugins/SMS/src/SMS_svc.cpp index 92542c268e..1543d4bb77 100644 --- a/plugins/SMS/src/SMS_svc.cpp +++ b/plugins/SMS/src/SMS_svc.cpp @@ -45,8 +45,8 @@ int LoadModules(void) mi.flags = CMIF_UNICODE; ssSMSSettings.hContactMenuItems[0] = Menu_AddContactMenuItem(&mi); - Skin_AddSound("RecvSMSMsg", PROTOCOL_NAMEW, LPGENW("Incoming SMS Message")); - Skin_AddSound("RecvSMSConfirmation", PROTOCOL_NAMEW, LPGENW("Incoming SMS Confirmation")); + g_plugin.addSound("RecvSMSMsg", PROTOCOL_NAMEW, LPGENW("Incoming SMS Message")); + g_plugin.addSound("RecvSMSConfirmation", PROTOCOL_NAMEW, LPGENW("Incoming SMS Confirmation")); RefreshAccountList(NULL, NULL); return 0; diff --git a/plugins/Scriver/src/msgs.cpp b/plugins/Scriver/src/msgs.cpp index cb41109d0e..6537265502 100644 --- a/plugins/Scriver/src/msgs.cpp +++ b/plugins/Scriver/src/msgs.cpp @@ -647,12 +647,12 @@ int OnLoadModule(void) CreateServiceFunction(MS_MSG_SENDMESSAGEW, SendMessageCommandW); CreateServiceFunction(MS_MSG_TYPINGMESSAGE, TypingMessageCommand); - Skin_AddSound("RecvMsgActive", LPGENW("Instant messages"), LPGENW("Incoming (focused window)")); - Skin_AddSound("RecvMsgInactive", LPGENW("Instant messages"), LPGENW("Incoming (unfocused window)")); - Skin_AddSound("AlertMsg", LPGENW("Instant messages"), LPGENW("Incoming (new session)")); - Skin_AddSound("SendMsg", LPGENW("Instant messages"), LPGENW("Outgoing")); - Skin_AddSound("TNStart", LPGENW("Instant messages"), LPGENW("Contact started typing")); - Skin_AddSound("TNStop", LPGENW("Instant messages"), LPGENW("Contact stopped typing")); + g_plugin.addSound("RecvMsgActive", LPGENW("Instant messages"), LPGENW("Incoming (focused window)")); + g_plugin.addSound("RecvMsgInactive", LPGENW("Instant messages"), LPGENW("Incoming (unfocused window)")); + g_plugin.addSound("AlertMsg", LPGENW("Instant messages"), LPGENW("Incoming (new session)")); + g_plugin.addSound("SendMsg", LPGENW("Instant messages"), LPGENW("Outgoing")); + g_plugin.addSound("TNStart", LPGENW("Instant messages"), LPGENW("Contact started typing")); + g_plugin.addSound("TNStop", LPGENW("Instant messages"), LPGENW("Contact stopped typing")); hDragCursor = LoadCursor(g_plugin.getInst(), MAKEINTRESOURCE(IDC_DRAGCURSOR)); diff --git a/plugins/SecureIM/src/main.cpp b/plugins/SecureIM/src/main.cpp index b69c0ad649..e40c7ca475 100644 --- a/plugins/SecureIM/src/main.cpp +++ b/plugins/SecureIM/src/main.cpp @@ -211,8 +211,8 @@ static int onModulesLoaded(WPARAM, LPARAM) loadContactList(); // add new skin sound - Skin_AddSound("IncomingSecureMessage", LPGENW("SecureIM"), LPGENW("Incoming Secure Message"), L"Sounds\\iSecureMessage.wav"); - Skin_AddSound("OutgoingSecureMessage", LPGENW("SecureIM"), LPGENW("Outgoing Secure Message"), L"Sounds\\oSecureMessage.wav"); + g_plugin.addSound("IncomingSecureMessage", LPGENW("SecureIM"), LPGENW("Incoming Secure Message"), L"Sounds\\iSecureMessage.wav"); + g_plugin.addSound("OutgoingSecureMessage", LPGENW("SecureIM"), LPGENW("Outgoing Secure Message"), L"Sounds\\oSecureMessage.wav"); // init extra icons for (int i = 0; i < _countof(g_IEC); i++) diff --git a/plugins/SeenPlugin/src/main.cpp b/plugins/SeenPlugin/src/main.cpp index 058eec0d1c..d9ffefc59b 100644 --- a/plugins/SeenPlugin/src/main.cpp +++ b/plugins/SeenPlugin/src/main.cpp @@ -113,10 +113,10 @@ extern "C" __declspec(dllexport) int Load(void) LoadWatchedProtos(); - Skin_AddSound("LastSeenTrackedStatusChange", LPGENW("LastSeen"), LPGENW("User status change")); - Skin_AddSound("LastSeenTrackedStatusOnline", LPGENW("LastSeen"), LPGENW("Changed to Online")); - Skin_AddSound("LastSeenTrackedStatusOffline", LPGENW("LastSeen"), LPGENW("User Logged Off")); - Skin_AddSound("LastSeenTrackedStatusFromOffline", LPGENW("LastSeen"), LPGENW("User Logged In")); + g_plugin.addSound("LastSeenTrackedStatusChange", LPGENW("LastSeen"), LPGENW("User status change")); + g_plugin.addSound("LastSeenTrackedStatusOnline", LPGENW("LastSeen"), LPGENW("Changed to Online")); + g_plugin.addSound("LastSeenTrackedStatusOffline", LPGENW("LastSeen"), LPGENW("User Logged Off")); + g_plugin.addSound("LastSeenTrackedStatusFromOffline", LPGENW("LastSeen"), LPGENW("User Logged In")); return 0; } diff --git a/plugins/TabSRMM/src/globals.cpp b/plugins/TabSRMM/src/globals.cpp index 1a3f9fe099..d6db557e01 100644 --- a/plugins/TabSRMM/src/globals.cpp +++ b/plugins/TabSRMM/src/globals.cpp @@ -67,11 +67,11 @@ void CGlobals::reloadSystemStartup() PluginConfig.g_hMenuContext = LoadMenu(g_plugin.getInst(), MAKEINTRESOURCE(IDR_TABCONTEXT)); TranslateMenu(g_hMenuContext); - Skin_AddSound("RecvMsgActive", LPGENW("Instant messages"), LPGENW("Incoming (focused window)")); - Skin_AddSound("RecvMsgInactive", LPGENW("Instant messages"), LPGENW("Incoming (unfocused window)")); - Skin_AddSound("AlertMsg", LPGENW("Instant messages"), LPGENW("Incoming (new session)")); - Skin_AddSound("SendMsg", LPGENW("Instant messages"), LPGENW("Outgoing")); - Skin_AddSound("SendError", LPGENW("Instant messages"), LPGENW("Message send error")); + g_plugin.addSound("RecvMsgActive", LPGENW("Instant messages"), LPGENW("Incoming (focused window)")); + g_plugin.addSound("RecvMsgInactive", LPGENW("Instant messages"), LPGENW("Incoming (unfocused window)")); + g_plugin.addSound("AlertMsg", LPGENW("Instant messages"), LPGENW("Incoming (new session)")); + g_plugin.addSound("SendMsg", LPGENW("Instant messages"), LPGENW("Outgoing")); + g_plugin.addSound("SendError", LPGENW("Instant messages"), LPGENW("Message send error")); hCurSplitNS = LoadCursor(nullptr, IDC_SIZENS); hCurSplitWE = LoadCursor(nullptr, IDC_SIZEWE); @@ -210,7 +210,7 @@ void CGlobals::reloadAdv() m_bDontUseDefaultKbd = M.GetBool("adv_leaveKeyboardAlone", true); if (m_bSoundOnTyping && m_TypingSoundAdded == false) { - Skin_AddSound("SoundOnTyping", LPGENW("Other"), LPGENW("TabSRMM: typing")); + g_plugin.addSound("SoundOnTyping", LPGENW("Other"), LPGENW("TabSRMM: typing")); m_TypingSoundAdded = true; } m_bAllowOfflineMultisend = M.GetBool("AllowOfflineMultisend", true); diff --git a/plugins/TabSRMM/src/typingnotify.cpp b/plugins/TabSRMM/src/typingnotify.cpp index 2f6383b2de..b6f6261fc8 100644 --- a/plugins/TabSRMM/src/typingnotify.cpp +++ b/plugins/TabSRMM/src/typingnotify.cpp @@ -546,8 +546,8 @@ int TN_ModuleInit() hDisableMenu = Menu_AddMainMenuItem(&mi); } - Skin_AddSound("TNStart", LPGENW("Instant messages"), LPGENW("Contact started typing")); - Skin_AddSound("TNStop", LPGENW("Instant messages"), LPGENW("Contact stopped typing")); + g_plugin.addSound("TNStart", LPGENW("Instant messages"), LPGENW("Contact started typing")); + g_plugin.addSound("TNStop", LPGENW("Instant messages"), LPGENW("Contact stopped typing")); return 0; } diff --git a/plugins/TooltipNotify/src/TooltipNotify.cpp b/plugins/TooltipNotify/src/TooltipNotify.cpp index 5b0e55ae4b..952ec98a40 100644 --- a/plugins/TooltipNotify/src/TooltipNotify.cpp +++ b/plugins/TooltipNotify/src/TooltipNotify.cpp @@ -133,10 +133,10 @@ int CTooltipNotify::ModulesLoaded(WPARAM, LPARAM) db_set_b(NULL, MODULENAME, "firstrun", 0); } - Skin_AddSound(SND_ONLINE, LPGENW("Tooltip Notify"), LPGENW("Online"), L"online.wav"); - Skin_AddSound(SND_OFFLINE, LPGENW("Tooltip Notify"), LPGENW("Offline"), L"offline.wav"); - Skin_AddSound(SND_OTHER, LPGENW("Tooltip Notify"), LPGENW("Other"), L"other.wav"); - Skin_AddSound(SND_TYPING, LPGENW("Tooltip Notify"), LPGENW("Typing"), L"typing.wav"); + g_plugin.addSound(SND_ONLINE, LPGENW("Tooltip Notify"), LPGENW("Online"), L"online.wav"); + g_plugin.addSound(SND_OFFLINE, LPGENW("Tooltip Notify"), LPGENW("Offline"), L"offline.wav"); + g_plugin.addSound(SND_OTHER, LPGENW("Tooltip Notify"), LPGENW("Other"), L"other.wav"); + g_plugin.addSound(SND_TYPING, LPGENW("Tooltip Notify"), LPGENW("Typing"), L"typing.wav"); // register fonts RegisterFonts(); diff --git a/plugins/UserInfoEx/src/svc_reminder.cpp b/plugins/UserInfoEx/src/svc_reminder.cpp index b2dafa8374..2ea030b83e 100644 --- a/plugins/UserInfoEx/src/svc_reminder.cpp +++ b/plugins/UserInfoEx/src/svc_reminder.cpp @@ -893,9 +893,9 @@ void SvcReminderOnModulesLoaded(void) void SvcReminderLoadModule(void) { // init sounds - Skin_AddSound(SOUND_BIRTHDAY_TODAY, LPGENW("Birthday reminder"), L"Sounds\\BirthDay.wav"); - Skin_AddSound(SOUND_BIRTHDAY_SOON, LPGENW("Birthday reminder: it's coming"), L"Sounds\\BirthDayComing.wav"); - Skin_AddSound(SOUND_ANNIVERSARY, LPGENW("Anniversary Reminder"), L"Sounds\\Reminder.wav"); + g_plugin.addSound(SOUND_BIRTHDAY_TODAY, LPGENW("Birthday reminder"), L"Sounds\\BirthDay.wav"); + g_plugin.addSound(SOUND_BIRTHDAY_SOON, LPGENW("Birthday reminder: it's coming"), L"Sounds\\BirthDayComing.wav"); + g_plugin.addSound(SOUND_ANNIVERSARY, LPGENW("Anniversary Reminder"), L"Sounds\\Reminder.wav"); // create service functions CreateServiceFunction(MS_USERINFO_REMINDER_CHECK, CheckService); diff --git a/plugins/Weather/src/weather.cpp b/plugins/Weather/src/weather.cpp index b3f1b4706e..4e8637c590 100644 --- a/plugins/Weather/src/weather.cpp +++ b/plugins/Weather/src/weather.cpp @@ -200,8 +200,8 @@ extern "C" int __declspec(dllexport) Load(void) InitServices(); // add sound event - Skin_AddSound("weatherupdated", _A2W(WEATHERPROTONAME), LPGENW("Weather Condition Changed")); - Skin_AddSound("weatheralert", _A2W(WEATHERPROTONAME), LPGENW("Weather Alert Issued")); + g_plugin.addSound("weatherupdated", _A2W(WEATHERPROTONAME), LPGENW("Weather Condition Changed")); + g_plugin.addSound("weatheralert", _A2W(WEATHERPROTONAME), LPGENW("Weather Alert Issued")); // window needed for popup commands wchar_t SvcFunc[100]; diff --git a/plugins/WebView/src/main.cpp b/plugins/WebView/src/main.cpp index 76deec0957..eaaeee3d07 100644 --- a/plugins/WebView/src/main.cpp +++ b/plugins/WebView/src/main.cpp @@ -123,7 +123,7 @@ extern "C" int __declspec(dllexport) Load() InitServices(); //add sound event to options - Skin_AddSound("webviewalert", _A2W(MODULENAME), LPGENW("Alert event")); + g_plugin.addSound("webviewalert", _A2W(MODULENAME), LPGENW("Alert event")); //value is 1 if menu is disabled db_set_b(NULL, MODULENAME, MENU_IS_DISABLED_KEY, 1); diff --git a/plugins/WhenWasIt/src/WhenWasIt.cpp b/plugins/WhenWasIt/src/WhenWasIt.cpp index c9be02faa9..eaccb2a2c5 100644 --- a/plugins/WhenWasIt/src/WhenWasIt.cpp +++ b/plugins/WhenWasIt/src/WhenWasIt.cpp @@ -131,8 +131,8 @@ extern "C" int __declspec(dllexport) Load(void) hotkey.pszService = MS_WWI_CHECK_BIRTHDAYS; Hotkey_Register(&hotkey); - Skin_AddSound(BIRTHDAY_NEAR_SOUND, LPGENW("WhenWasIt"), LPGENW("Birthday near")); - Skin_AddSound(BIRTHDAY_TODAY_SOUND, LPGENW("WhenWasIt"), LPGENW("Birthday today")); + g_plugin.addSound(BIRTHDAY_NEAR_SOUND, LPGENW("WhenWasIt"), LPGENW("Birthday near")); + g_plugin.addSound(BIRTHDAY_TODAY_SOUND, LPGENW("WhenWasIt"), LPGENW("Birthday today")); Log("%s", "Leaving function " __FUNCTION__); return 0; diff --git a/plugins/XSoundNotify/src/xsn_main.cpp b/plugins/XSoundNotify/src/xsn_main.cpp index e56d6b5d98..7e7166f6d6 100644 --- a/plugins/XSoundNotify/src/xsn_main.cpp +++ b/plugins/XSoundNotify/src/xsn_main.cpp @@ -70,7 +70,7 @@ void InitSelfSounds() wchar_t infobuf[256]; mir_snwprintf(infobuf, L"%s [%s]", TranslateT("Self status"), pa->tszAccountName); - Skin_AddSound(namebuf, infobuf, Clist_GetStatusModeDescription(selfSounds[j].iStatus, 0)); + g_plugin.addSound(namebuf, infobuf, Clist_GetStatusModeDescription(selfSounds[j].iStatus, 0)); } } } diff --git a/plugins/YAMN/src/main.cpp b/plugins/YAMN/src/main.cpp index 150d9e8a55..db71aa8e05 100644 --- a/plugins/YAMN/src/main.cpp +++ b/plugins/YAMN/src/main.cpp @@ -297,8 +297,8 @@ extern "C" int __declspec(dllexport) Load(void) CreateServiceFunctions(); - Skin_AddSound(YAMN_NEWMAILSOUND, L"YAMN", YAMN_NEWMAILSNDDESC); - Skin_AddSound(YAMN_CONNECTFAILSOUND, L"YAMN", YAMN_CONNECTFAILSNDDESC); + g_plugin.addSound(YAMN_NEWMAILSOUND, L"YAMN", YAMN_NEWMAILSNDDESC); + g_plugin.addSound(YAMN_CONNECTFAILSOUND, L"YAMN", YAMN_CONNECTFAILSNDDESC); HookEvents(); diff --git a/protocols/FacebookRM/src/proto.cpp b/protocols/FacebookRM/src/proto.cpp index e1c7f3764a..64127caef8 100644 --- a/protocols/FacebookRM/src/proto.cpp +++ b/protocols/FacebookRM/src/proto.cpp @@ -1035,12 +1035,12 @@ void FacebookProto::InitHotkeys() */ void FacebookProto::InitSounds() { - Skin_AddSound("Notification", m_tszUserName, LPGENW("Notification")); - Skin_AddSound("NewsFeed", m_tszUserName, LPGENW("Newsfeed event")); - Skin_AddSound("OtherEvent", m_tszUserName, LPGENW("Other event")); - Skin_AddSound("Friendship", m_tszUserName, LPGENW("Friendship event")); - Skin_AddSound("Ticker", m_tszUserName, LPGENW("Ticker event")); - Skin_AddSound("Memories", m_tszUserName, LPGENW("Memories")); + g_plugin.addSound("Notification", m_tszUserName, LPGENW("Notification")); + g_plugin.addSound("NewsFeed", m_tszUserName, LPGENW("Newsfeed event")); + g_plugin.addSound("OtherEvent", m_tszUserName, LPGENW("Other event")); + g_plugin.addSound("Friendship", m_tszUserName, LPGENW("Friendship event")); + g_plugin.addSound("Ticker", m_tszUserName, LPGENW("Ticker event")); + g_plugin.addSound("Memories", m_tszUserName, LPGENW("Memories")); } /** diff --git a/protocols/MRA/src/MraProto.cpp b/protocols/MRA/src/MraProto.cpp index 4edeb5694b..3329a31aa0 100644 --- a/protocols/MRA/src/MraProto.cpp +++ b/protocols/MRA/src/MraProto.cpp @@ -47,7 +47,7 @@ CMraProto::CMraProto(const char* _module, const wchar_t* _displayName) : InitMenus(); mir_snprintf(szNewMailSound, "%s_new_email", m_szModuleName); - Skin_AddSound(szNewMailSound, m_tszUserName, MRA_SOUND_NEW_EMAIL); + g_plugin.addSound(szNewMailSound, m_tszUserName, MRA_SOUND_NEW_EMAIL); HookProtoEvent(ME_CLIST_PREBUILDSTATUSMENU, &CMraProto::MraRebuildStatusMenu); diff --git a/protocols/MSN/src/msn_proto.cpp b/protocols/MSN/src/msn_proto.cpp index 1361d363e0..3b307b07a6 100644 --- a/protocols/MSN/src/msn_proto.cpp +++ b/protocols/MSN/src/msn_proto.cpp @@ -113,11 +113,11 @@ CMsnProto::CMsnProto(const char* aProtoName, const wchar_t* aUserName) : mailsoundname = (char*)mir_alloc(64); mir_snprintf(mailsoundname, 64, "%s:Hotmail", m_szModuleName); - Skin_AddSound(mailsoundname, m_tszUserName, LPGENW("Live Mail")); + g_plugin.addSound(mailsoundname, m_tszUserName, LPGENW("Live Mail")); alertsoundname = (char*)mir_alloc(64); mir_snprintf(alertsoundname, 64, "%s:Alerts", m_szModuleName); - Skin_AddSound(alertsoundname, m_tszUserName, LPGENW("Live Alert")); + g_plugin.addSound(alertsoundname, m_tszUserName, LPGENW("Live Alert")); AvatarQueue_Init(); InitCustomFolders(); diff --git a/protocols/Omegle/src/proto.cpp b/protocols/Omegle/src/proto.cpp index 37c127f940..5bd7fc668d 100644 --- a/protocols/Omegle/src/proto.cpp +++ b/protocols/Omegle/src/proto.cpp @@ -57,10 +57,10 @@ PROTO(proto_name, username) facy.set_handle(m_hNetlibUser); - Skin_AddSound("StrangerTyp", m_tszUserName, LPGENW("Stranger is typing")); - Skin_AddSound("StrangerTypStop", m_tszUserName, LPGENW("Stranger stopped typing")); - Skin_AddSound("StrangerChange", m_tszUserName, LPGENW("Changing stranger")); - Skin_AddSound("StrangerMessage", m_tszUserName, LPGENW("Receive message")); + g_plugin.addSound("StrangerTyp", m_tszUserName, LPGENW("Stranger is typing")); + g_plugin.addSound("StrangerTypStop", m_tszUserName, LPGENW("Stranger stopped typing")); + g_plugin.addSound("StrangerChange", m_tszUserName, LPGENW("Changing stranger")); + g_plugin.addSound("StrangerMessage", m_tszUserName, LPGENW("Receive message")); } OmegleProto::~OmegleProto() diff --git a/protocols/SkypeWeb/src/skype_proto.cpp b/protocols/SkypeWeb/src/skype_proto.cpp index fe1b897aa1..416aad562c 100644 --- a/protocols/SkypeWeb/src/skype_proto.cpp +++ b/protocols/SkypeWeb/src/skype_proto.cpp @@ -51,8 +51,8 @@ CSkypeProto::CSkypeProto(const char* protoName, const wchar_t* userName) : CreateDirectoryTreeW(m_tszAvatarFolder.c_str()); //sounds - Skin_AddSound("skype_inc_call", L"SkypeWeb", LPGENW("Incoming call sound")); - Skin_AddSound("skype_call_canceled", L"SkypeWeb", LPGENW("Incoming call canceled sound")); + g_plugin.addSound("skype_inc_call", L"SkypeWeb", LPGENW("Incoming call sound")); + g_plugin.addSound("skype_call_canceled", L"SkypeWeb", LPGENW("Incoming call canceled sound")); SkypeSetTimer(); diff --git a/protocols/Twitter/src/theme.cpp b/protocols/Twitter/src/theme.cpp index d30633d1fb..e74d1872be 100644 --- a/protocols/Twitter/src/theme.cpp +++ b/protocols/Twitter/src/theme.cpp @@ -31,8 +31,8 @@ static IconItem iconList[] = void TwitterInitSounds(void) { - Skin_AddSound("TwitterNewContact", LPGENW("Twitter"), LPGENW("First tweet from new contact")); - Skin_AddSound("TwitterNew", LPGENW("Twitter"), LPGENW("New tweet")); + g_plugin.addSound("TwitterNewContact", LPGENW("Twitter"), LPGENW("First tweet from new contact")); + g_plugin.addSound("TwitterNew", LPGENW("Twitter"), LPGENW("New tweet")); } // TODO: uninit diff --git a/protocols/VKontakte/src/vk_proto.cpp b/protocols/VKontakte/src/vk_proto.cpp index e8325d3d41..597825a617 100644 --- a/protocols/VKontakte/src/vk_proto.cpp +++ b/protocols/VKontakte/src/vk_proto.cpp @@ -108,7 +108,7 @@ void CVkProto::OnModulesLoaded() HookProtoEvent(ME_DB_CONTACT_SETTINGCHANGED, &CVkProto::OnDbSettingChanged); //Sounds - Skin_AddSound("VKNewsFeed", m_tszUserName, LPGENW("VKontakte newsfeed & notification event")); + g_plugin.addSound("VKNewsFeed", m_tszUserName, LPGENW("VKontakte newsfeed & notification event")); InitPopups(); InitMenus(); diff --git a/src/core/stdfile/src/file.cpp b/src/core/stdfile/src/file.cpp index 9dda11aa92..4b39aff9b0 100644 --- a/src/core/stdfile/src/file.cpp +++ b/src/core/stdfile/src/file.cpp @@ -442,9 +442,9 @@ int LoadSendRecvFileModule(void) CreateServiceFunction("SRFile/OpenContRecDir", openContRecDir); CreateServiceFunction("SRFile/OpenRecDir", openRecDir); - Skin_AddSound("RecvFile", LPGENW("File"), LPGENW("Incoming")); - Skin_AddSound("FileDone", LPGENW("File"), LPGENW("Complete")); - Skin_AddSound("FileFailed", LPGENW("File"), LPGENW("Error")); - Skin_AddSound("FileDenied", LPGENW("File"), LPGENW("Denied")); + g_plugin.addSound("RecvFile", LPGENW("File"), LPGENW("Incoming")); + g_plugin.addSound("FileDone", LPGENW("File"), LPGENW("Complete")); + g_plugin.addSound("FileFailed", LPGENW("File"), LPGENW("Error")); + g_plugin.addSound("FileDenied", LPGENW("File"), LPGENW("Denied")); return 0; } diff --git a/src/core/stdmsg/src/msgs.cpp b/src/core/stdmsg/src/msgs.cpp index 0b982e5892..36ef8201bb 100644 --- a/src/core/stdmsg/src/msgs.cpp +++ b/src/core/stdmsg/src/msgs.cpp @@ -538,13 +538,13 @@ int LoadSendRecvMessageModule(void) CreateServiceFunction(MS_MSG_SENDMESSAGEW, SendMessageCommand_W); CreateServiceFunction(MS_MSG_READMESSAGE, ReadMessageCommand); - Skin_AddSound("RecvMsgActive", LPGENW("Instant messages"), LPGENW("Incoming (focused window)")); - Skin_AddSound("RecvMsgInactive", LPGENW("Instant messages"), LPGENW("Incoming (unfocused window)")); - Skin_AddSound("AlertMsg", LPGENW("Instant messages"), LPGENW("Incoming (new session)")); - Skin_AddSound("SendMsg", LPGENW("Instant messages"), LPGENW("Outgoing")); - Skin_AddSound("SendError", LPGENW("Instant messages"), LPGENW("Message send error")); - Skin_AddSound("TNStart", LPGENW("Instant messages"), LPGENW("Contact started typing")); - Skin_AddSound("TNStop", LPGENW("Instant messages"), LPGENW("Contact stopped typing")); + g_plugin.addSound("RecvMsgActive", LPGENW("Instant messages"), LPGENW("Incoming (focused window)")); + g_plugin.addSound("RecvMsgInactive", LPGENW("Instant messages"), LPGENW("Incoming (unfocused window)")); + g_plugin.addSound("AlertMsg", LPGENW("Instant messages"), LPGENW("Incoming (new session)")); + g_plugin.addSound("SendMsg", LPGENW("Instant messages"), LPGENW("Outgoing")); + g_plugin.addSound("SendError", LPGENW("Instant messages"), LPGENW("Message send error")); + g_plugin.addSound("TNStart", LPGENW("Instant messages"), LPGENW("Contact started typing")); + g_plugin.addSound("TNStop", LPGENW("Instant messages"), LPGENW("Contact stopped typing")); InitStatusIcons(); return 0; diff --git a/src/core/stduseronline/src/useronline.cpp b/src/core/stduseronline/src/useronline.cpp index 54063cb44c..163b705835 100644 --- a/src/core/stduseronline/src/useronline.cpp +++ b/src/core/stduseronline/src/useronline.cpp @@ -112,6 +112,7 @@ int LoadUserOnlineModule(void) HookEvent(ME_PROTO_ACK, UserOnlineAck); HookEvent(ME_SYSTEM_MODULESLOADED, UserOnlineModulesLoaded); HookEvent(ME_PROTO_ACCLISTCHANGED, UserOnlineAccountsChanged); - Skin_AddSound(MODULENAME, LPGENW("Alerts"), LPGENW("Online")); + + g_plugin.addSound(MODULENAME, LPGENW("Alerts"), LPGENW("Online")); return 0; } diff --git a/src/mir_app/src/CMPluginBase.cpp b/src/mir_app/src/CMPluginBase.cpp index 6fc1b0c689..fd7174a1bb 100644 --- a/src/mir_app/src/CMPluginBase.cpp +++ b/src/mir_app/src/CMPluginBase.cpp @@ -24,10 +24,55 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h" +static LIST pluginListAddr(10, HandleKeySortT); + +void RegisterModule(CMPluginBase *pPlugin) +{ + pluginListAddr.insert(pPlugin); +} + +MIR_APP_DLL(HINSTANCE) GetInstByAddress(void* codePtr) +{ + if (pluginListAddr.getCount() == 0) + return nullptr; + + int idx; + List_GetIndex((SortedList*)&pluginListAddr, (CMPluginBase*)&codePtr, &idx); + if (idx > 0) + idx--; + + HINSTANCE result = pluginListAddr[idx]->getInst(); + if (result < g_plugin.getInst() && codePtr > g_plugin.getInst()) + return g_plugin.getInst(); + + if (idx == 0 && codePtr < (void*)result) + return nullptr; + + return result; +} + +MIR_APP_DLL(CMPluginBase*) GetPluginByLangId(int _hLang) +{ + for (auto &it : pluginListAddr) + if (it->m_hLang == _hLang) + return it; + + return nullptr; +} + +MIR_APP_DLL(CMPluginBase&) GetPluginByInstance(HINSTANCE hInst) +{ + CMPluginBase *pPlugin = pluginListAddr.find((CMPluginBase*)&hInst); + return (pPlugin == nullptr) ? g_plugin : *pPlugin; +} + +///////////////////////////////////////////////////////////////////////////////////////// + CMPluginBase::CMPluginBase(const char *moduleName) : m_szModuleName(moduleName) { - ::RegisterModule(this); + if (m_hInst != nullptr) + pluginListAddr.insert(this); } CMPluginBase::~CMPluginBase() @@ -37,7 +82,7 @@ CMPluginBase::~CMPluginBase() m_hLogger = nullptr; } - ::UnregisterModule(this); + pluginListAddr.remove(this); } void CMPluginBase::tryOpenLog() diff --git a/src/mir_app/src/auth.cpp b/src/mir_app/src/auth.cpp index dacbbe24ee..2a13dfc960 100644 --- a/src/mir_app/src/auth.cpp +++ b/src/mir_app/src/auth.cpp @@ -356,7 +356,7 @@ int LoadSendRecvAuthModule(void) CreateServiceFunction(MS_AUTH_SHOWADDED, ShowAddedWindow); Miranda_WaitOnHandle(LaunchAuth); - Skin_AddSound("AuthRequest", LPGENW("Alerts"), LPGENW("Authorization request")); - Skin_AddSound("AddedEvent", LPGENW("Alerts"), LPGENW("Added event")); + g_plugin.addSound("AuthRequest", LPGENW("Alerts"), LPGENW("Authorization request")); + g_plugin.addSound("AddedEvent", LPGENW("Alerts"), LPGENW("Added event")); return 0; } diff --git a/src/mir_app/src/chat_opts.cpp b/src/mir_app/src/chat_opts.cpp index 2282f53374..b532848027 100644 --- a/src/mir_app/src/chat_opts.cpp +++ b/src/mir_app/src/chat_opts.cpp @@ -324,17 +324,17 @@ int OptionsInit(void) g_Settings->iWidth = db_get_dw(0, CHAT_MODULE, "roomwidth", -1); g_Settings->iHeight = db_get_dw(0, CHAT_MODULE, "roomheight", -1); - Skin_AddSound("ChatMessage", LPGENW("Group chats"), LPGENW("Incoming message")); - Skin_AddSound("ChatHighlight", LPGENW("Group chats"), LPGENW("Message is highlighted")); - Skin_AddSound("ChatAction", LPGENW("Group chats"), LPGENW("User has performed an action")); - Skin_AddSound("ChatJoin", LPGENW("Group chats"), LPGENW("User has joined")); - Skin_AddSound("ChatPart", LPGENW("Group chats"), LPGENW("User has left")); - Skin_AddSound("ChatKick", LPGENW("Group chats"), LPGENW("User has kicked some other user")); - Skin_AddSound("ChatMode", LPGENW("Group chats"), LPGENW("User's status was changed")); - Skin_AddSound("ChatNick", LPGENW("Group chats"), LPGENW("User has changed name")); - Skin_AddSound("ChatNotice", LPGENW("Group chats"), LPGENW("User has sent a notice")); - Skin_AddSound("ChatQuit", LPGENW("Group chats"), LPGENW("User has disconnected")); - Skin_AddSound("ChatTopic", LPGENW("Group chats"), LPGENW("The topic has been changed")); + g_plugin.addSound("ChatMessage", LPGENW("Group chats"), LPGENW("Incoming message")); + g_plugin.addSound("ChatHighlight", LPGENW("Group chats"), LPGENW("Message is highlighted")); + g_plugin.addSound("ChatAction", LPGENW("Group chats"), LPGENW("User has performed an action")); + g_plugin.addSound("ChatJoin", LPGENW("Group chats"), LPGENW("User has joined")); + g_plugin.addSound("ChatPart", LPGENW("Group chats"), LPGENW("User has left")); + g_plugin.addSound("ChatKick", LPGENW("Group chats"), LPGENW("User has kicked some other user")); + g_plugin.addSound("ChatMode", LPGENW("Group chats"), LPGENW("User's status was changed")); + g_plugin.addSound("ChatNick", LPGENW("Group chats"), LPGENW("User has changed name")); + g_plugin.addSound("ChatNotice", LPGENW("Group chats"), LPGENW("User has sent a notice")); + g_plugin.addSound("ChatQuit", LPGENW("Group chats"), LPGENW("User has disconnected")); + g_plugin.addSound("ChatTopic", LPGENW("Group chats"), LPGENW("The topic has been changed")); return 0; } diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def index e6e2e8f009..51440ad771 100644 --- a/src/mir_app/src/mir_app.def +++ b/src/mir_app/src/mir_app.def @@ -437,7 +437,6 @@ Hotkey_Unsubclass @457 Hotkey_Check @458 ?SetStatusText@CSrmmBaseDialog@@UAEXPB_WPAUHICON__@@@Z @459 NONAME Srmm_SetStatusText @460 -Skin_AddSound @461 Skin_PlaySound @462 Skin_PlaySoundFile @463 Clist_SetStatusMode @464 @@ -593,3 +592,7 @@ Contact_GetStatus @609 ?getMStringW@PROTO_INTERFACE@@QAE?AV?$CMStringT@_WV?$ChTraitsCRT@_W@@@@PBD@Z @620 NONAME ??0PROTOACCOUNT@@QAE@PBD@Z @621 NONAME ??1PROTOACCOUNT@@QAE@XZ @622 NONAME +?addSound@CMPluginBase@@QAEHPBDPB_W11@Z @623 NONAME +GetPluginByLangId @624 +GetInstByAddress @625 +GetPluginByInstance @626 diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def index dc486e6845..2073ce5374 100644 --- a/src/mir_app/src/mir_app64.def +++ b/src/mir_app/src/mir_app64.def @@ -437,7 +437,6 @@ Hotkey_Unsubclass @457 Hotkey_Check @458 ?SetStatusText@CSrmmBaseDialog@@UEAAXPEB_WPEAUHICON__@@@Z @459 NONAME Srmm_SetStatusText @460 -Skin_AddSound @461 Skin_PlaySound @462 Skin_PlaySoundFile @463 Clist_SetStatusMode @464 @@ -593,3 +592,7 @@ Contact_GetStatus @609 ?getMStringW@PROTO_INTERFACE@@QEAA?AV?$CMStringT@_WV?$ChTraitsCRT@_W@@@@PEBD@Z @620 NONAME ??0PROTOACCOUNT@@QEAA@PEBD@Z @621 NONAME ??1PROTOACCOUNT@@QEAA@XZ @622 NONAME +?addSound@CMPluginBase@@QEAAHPEBDPEB_W11@Z @623 NONAME +GetPluginByLangId @624 +GetInstByAddress @625 +GetPluginByInstance @626 diff --git a/src/mir_app/src/miranda.h b/src/mir_app/src/miranda.h index 718474091c..786b744f3d 100644 --- a/src/mir_app/src/miranda.h +++ b/src/mir_app/src/miranda.h @@ -188,6 +188,8 @@ INT_PTR stubChainRecv(WPARAM, LPARAM); /**** utils.cpp ************************************************************************/ +void RegisterModule(CMPluginBase*); + void HotkeyToName(wchar_t *buf, int size, BYTE shift, BYTE key); WORD GetHotkeyValue(INT_PTR idHotkey); diff --git a/src/mir_app/src/sounds.cpp b/src/mir_app/src/sounds.cpp index bc359b8ca5..198dd3cb95 100644 --- a/src/mir_app/src/sounds.cpp +++ b/src/mir_app/src/sounds.cpp @@ -59,7 +59,7 @@ MIR_APP_DLL(void) KillModuleSounds(int _hLang) static HANDLE hPlayEvent = nullptr; -MIR_APP_DLL(int) Skin_AddSound(const char *pszName, const wchar_t *pwszSection, const wchar_t *pwszDescription, const wchar_t *pwszDefaultFile, int _hLang) +int CMPluginBase::addSound(const char *pszName, const wchar_t *pwszSection, const wchar_t *pwszDescription, const wchar_t *pwszDefaultFile) { if (pszName == nullptr || pwszDescription == nullptr) return 1; @@ -67,7 +67,7 @@ MIR_APP_DLL(int) Skin_AddSound(const char *pszName, const wchar_t *pwszSection, SoundItem *item = new SoundItem; // due to OBJLIST item->name = mir_strdup(pszName); item->ptszTempFile = nullptr; - item->hLangpack = _hLang; + item->hLangpack = m_hLang; arSounds.insert(item); item->pwszDescription = mir_wstrdup(pwszDescription); diff --git a/src/mir_core/src/mir_core.def b/src/mir_core/src/mir_core.def index 3940104584..eecbb7c04d 100644 --- a/src/mir_core/src/mir_core.def +++ b/src/mir_core/src/mir_core.def @@ -19,7 +19,6 @@ CreateServiceFunctionParam @18 DestroyHookableEvent @19 DestroyServiceFunction @20 GetExceptionFilter @21 -GetInstByAddress @22 HookEvent @23 HookEventMessage @24 HookEventObj @25 @@ -52,7 +51,6 @@ PathToAbsolute @51 PathToAbsoluteW @52 PathToRelative @53 PathToRelativeW @54 -RegisterModule @55 ReloadLangpack @56 ServiceExists @57 SetExceptionFilter @58 @@ -66,7 +64,6 @@ TranslateMenu_LP @65 TranslateW_LP @66 Ucs2toUtf8Len @67 UnhookEvent @68 -UnregisterModule @69 Utf8Decode @70 Utf8DecodeCP @71 Utf8DecodeW @72 @@ -1068,4 +1065,3 @@ IsTerminalDisconnected @1245 CallObjectEventHook @1259 ?db_get_sm@@YG?AV?$CMStringT@DV?$ChTraitsCRT@D@@@@IPBD0@Z @1260 NONAME ?db_get_wsm@@YG?AV?$CMStringT@_WV?$ChTraitsCRT@_W@@@@IPBD0@Z @1261 NONAME -GetPluginByInstance @1262 diff --git a/src/mir_core/src/mir_core64.def b/src/mir_core/src/mir_core64.def index 2b6d5d926c..c0ebe31ddb 100644 --- a/src/mir_core/src/mir_core64.def +++ b/src/mir_core/src/mir_core64.def @@ -19,7 +19,6 @@ CreateServiceFunctionParam @18 DestroyHookableEvent @19 DestroyServiceFunction @20 GetExceptionFilter @21 -GetInstByAddress @22 HookEvent @23 HookEventMessage @24 HookEventObj @25 @@ -52,7 +51,6 @@ PathToAbsolute @51 PathToAbsoluteW @52 PathToRelative @53 PathToRelativeW @54 -RegisterModule @55 ReloadLangpack @56 ServiceExists @57 SetExceptionFilter @58 @@ -66,7 +64,6 @@ TranslateMenu_LP @65 TranslateW_LP @66 Ucs2toUtf8Len @67 UnhookEvent @68 -UnregisterModule @69 Utf8Decode @70 Utf8DecodeCP @71 Utf8DecodeW @72 @@ -1068,4 +1065,3 @@ IsTerminalDisconnected @1245 CallObjectEventHook @1259 ?db_get_sm@@YA?AV?$CMStringT@DV?$ChTraitsCRT@D@@@@IPEBD0@Z @1260 NONAME ?db_get_wsm@@YA?AV?$CMStringT@_WV?$ChTraitsCRT@_W@@@@IPEBD0@Z @1261 NONAME -GetPluginByInstance @1262 diff --git a/src/mir_core/src/miranda.cpp b/src/mir_core/src/miranda.cpp index e4f0b50fe8..80d28cf277 100644 --- a/src/mir_core/src/miranda.cpp +++ b/src/mir_core/src/miranda.cpp @@ -40,6 +40,9 @@ void InitMetaContacts(); void InitTimeZones(); void InitWinver(); +static int _hLang = 0; +int &hLangpack(_hLang); + HINSTANCE g_hInst = nullptr; HCURSOR g_hCursorNS, g_hCursorWE; diff --git a/src/mir_core/src/modules.cpp b/src/mir_core/src/modules.cpp index 6af89cbab2..921de193a0 100644 --- a/src/mir_core/src/modules.cpp +++ b/src/mir_core/src/modules.cpp @@ -695,55 +695,6 @@ static void DestroyServices() /////////////////////////////////////////////////////////////////////////////// -struct CMPlugin : public CMPluginBase -{ - CMPlugin() : - CMPluginBase(nullptr) - {} -} g_plugin; - -int &hLangpack(g_plugin.m_hLang); - -LIST pluginListAddr(10, HandleKeySortT); - -MIR_CORE_DLL(void) RegisterModule(CMPluginBase *pPlugin) -{ - if (pPlugin->getInst() != nullptr) - pluginListAddr.insert(pPlugin); -} - -MIR_CORE_DLL(void) UnregisterModule(CMPluginBase *pPlugin) -{ - pluginListAddr.remove(pPlugin); -} - -MIR_CORE_DLL(HINSTANCE) GetInstByAddress(void* codePtr) -{ - if (pluginListAddr.getCount() == 0) - return nullptr; - - int idx; - List_GetIndex((SortedList*)&pluginListAddr, (CMPluginBase*)&codePtr, &idx); - if (idx > 0) - idx--; - - HINSTANCE result = pluginListAddr[idx]->getInst(); - if (result < g_hInst && codePtr > g_hInst) - return g_hInst; - if (idx == 0 && codePtr < (void*)result) - return nullptr; - - return result; -} - -MIR_CORE_DLL(CMPluginBase&) GetPluginByInstance(HINSTANCE hInst) -{ - CMPluginBase *pPlugin = pluginListAddr.find((CMPluginBase*)&hInst); - return (pPlugin == nullptr) ? g_plugin : *pPlugin; -} - -/////////////////////////////////////////////////////////////////////////////// - int InitialiseModularEngine(void) { mainThreadId = GetCurrentThreadId(); -- cgit v1.2.3