From 6fad3235de6bec045fec19a7265e19e880ac84e2 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 30 Jul 2017 17:30:39 +0300 Subject: Hotkeys: code cleaning --- plugins/Actman/ua/i_uaplaces.inc | 3 +- plugins/AddContactPlus/src/main.cpp | 6 +- plugins/AutoShutdown/src/utils.cpp | 8 +- plugins/BasicHistory/src/HistoryWindow.cpp | 2 +- plugins/BasicHistory/src/Options.cpp | 9 +- plugins/BossKeyPlus/src/BossKey.cpp | 5 +- plugins/CSList/src/cslist.cpp | 6 +- plugins/Clist_modern/src/modern_keyboard.cpp | 15 ++- plugins/Console/src/Console.cpp | 7 +- plugins/CrashDumper/src/crshdmp.cpp | 9 +- plugins/DbEditorPP/src/main.cpp | 6 +- plugins/FTPFileYM/src/ftpfile.cpp | 7 +- plugins/FavContacts/src/services.cpp | 6 +- plugins/FloatingContacts/src/main.cpp | 8 +- plugins/ListeningTo/src/listeningto.cpp | 143 +++++++++++----------- plugins/MirLua/src/m_hotkeys.cpp | 10 +- plugins/NewsAggregator/Src/NewsAggregator.cpp | 6 +- plugins/NotesAndReminders/src/hotkeys.cpp | 11 +- plugins/OpenFolder/src/openFolder.cpp | 7 +- plugins/PackUpdater/Src/Events.cpp | 9 +- plugins/PluginUpdater/src/PluginUpdater.cpp | 6 +- plugins/Popup/src/main.cpp | 8 +- plugins/QuickContacts/src/quickcontacts.cpp | 21 ++-- plugins/QuickSearch/sr_global.pas | 3 +- plugins/RecentContacts/src/RecentContacts.cpp | 6 +- plugins/Scriver/src/input.cpp | 38 +++--- plugins/SendScreenshotPlus/src/Main.cpp | 8 +- plugins/Sessions/Src/Main.cpp | 12 +- plugins/SimpleStatusMsg/src/main.cpp | 8 +- plugins/SmileyAdd/src/main.cpp | 6 +- plugins/SpellChecker/src/spellchecker.cpp | 6 +- plugins/SpellChecker/src/utils.cpp | 9 +- plugins/TabSRMM/src/chat_window.cpp | 2 +- plugins/TabSRMM/src/generic_msghandlers.cpp | 2 +- plugins/TabSRMM/src/hotkeyhandler.cpp | 58 +++++---- plugins/TabSRMM/src/msgdialog.cpp | 2 +- plugins/TrafficCounter/src/TrafficCounter.cpp | 7 +- plugins/TranslitSwitcher/src/TranslitSwitcher.cpp | 16 +-- plugins/UserInfoEx/src/dlg_anniversarylist.cpp | 7 +- plugins/UserInfoEx/src/svc_refreshci.cpp | 7 +- plugins/UserInfoEx/src/svc_reminder.cpp | 7 +- plugins/Watrack/popup/popups.pas | 3 +- plugins/Watrack/status/status.pas | 3 +- plugins/Watrack/templates/i_expkey.inc | 4 +- plugins/WhenWasIt/src/WhenWasIt.cpp | 8 +- plugins/YAMN/src/main.cpp | 7 +- plugins/mRadio/i_hotkey.inc | 9 +- 47 files changed, 257 insertions(+), 299 deletions(-) (limited to 'plugins') diff --git a/plugins/Actman/ua/i_uaplaces.inc b/plugins/Actman/ua/i_uaplaces.inc index 974fef9ea5..e885088f8d 100644 --- a/plugins/Actman/ua/i_uaplaces.inc +++ b/plugins/Actman/ua/i_uaplaces.inc @@ -213,7 +213,6 @@ begin if (ActionItem.flags and UAF_HKREGGED)=0 then begin FillChar(hkd,SizeOf(hkd),0); - hkd.cbSize := SizeOf(hkd); // HOTKEYDESC_SIZE_V1 for pre-0.9 hkd.dwFlags := HKD_UNICODE; // since 0.9 only hkd.pszName := ActionItem.szNameID; hkd.pszDescription.w:= ActionItem.szActDescr; @@ -232,7 +231,7 @@ procedure DeleteCoreHotkey(var ActionItem:tMyActionItem); begin if ((ActionItem.flags and UAF_HKREGGED)<>0) then begin - CallService(MS_HOTKEY_UNREGISTER,0,LParam(ActionItem.szNameID)); + Hotkey_Unregister(ActionItem.szNameID); ActionItem.flags:=ActionItem.flags and not UAF_HKREGGED; end; end; diff --git a/plugins/AddContactPlus/src/main.cpp b/plugins/AddContactPlus/src/main.cpp index 937be49216..1326ab1206 100644 --- a/plugins/AddContactPlus/src/main.cpp +++ b/plugins/AddContactPlus/src/main.cpp @@ -126,11 +126,11 @@ static int CreateButton(WPARAM, LPARAM) static int OnModulesLoaded(WPARAM, LPARAM) { - HOTKEYDESC hkd = { sizeof(hkd) }; + HOTKEYDESC hkd = {}; hkd.dwFlags = HKD_UNICODE; hkd.pszName = "AddContactPlus_OpenDialog"; - hkd.pwszDescription = LPGENW("Open add contact dialog"); - hkd.pwszSection = LPGENW("Main"); + hkd.szDescription.w = LPGENW("Open add contact dialog"); + hkd.szSection.w = LPGENW("Main"); hkd.pszService = MS_ADDCONTACTPLUS_SHOW; hkd.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL | HOTKEYF_SHIFT, 'C') | HKF_MIRANDA_LOCAL; Hotkey_Register(&hkd); diff --git a/plugins/AutoShutdown/src/utils.cpp b/plugins/AutoShutdown/src/utils.cpp index c854534161..32272d33fe 100644 --- a/plugins/AutoShutdown/src/utils.cpp +++ b/plugins/AutoShutdown/src/utils.cpp @@ -199,14 +199,12 @@ BOOL GetFormatedDateTime(wchar_t *pszOut, int nSize, time_t timestamp, BOOL fSho void AddHotkey() { - HOTKEYDESC hkd = { 0 }; - hkd.cbSize = sizeof(hkd); + HOTKEYDESC hkd = {}; hkd.dwFlags = HKD_UNICODE; hkd.pszName = "AutoShutdown_Toggle"; - hkd.pwszDescription = LPGENW("Toggle automatic shutdown"); - hkd.pwszSection = LPGENW("Main"); + hkd.szDescription.w = LPGENW("Toggle automatic shutdown"); + hkd.szSection.w = LPGENW("Main"); hkd.pszService = "AutoShutdown/MenuCommand"; hkd.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL | HOTKEYF_SHIFT, 'T') | HKF_MIRANDA_LOCAL; - hkd.lParam = FALSE; Hotkey_Register(&hkd); } diff --git a/plugins/BasicHistory/src/HistoryWindow.cpp b/plugins/BasicHistory/src/HistoryWindow.cpp index 14de1f2307..b12eafe799 100644 --- a/plugins/BasicHistory/src/HistoryWindow.cpp +++ b/plugins/BasicHistory/src/HistoryWindow.cpp @@ -1529,7 +1529,7 @@ bool HistoryWindow::DoHotkey(UINT msg, LPARAM lParam, WPARAM wParam, int window) message.message = msg; message.lParam = lParam; message.wParam = wParam; - LRESULT mim_hotkey_check = CallService(MS_HOTKEY_CHECK, (WPARAM)&message, (LPARAM)("History")); + LRESULT mim_hotkey_check = Hotkey_Check(&message, "History"); switch (mim_hotkey_check) { case HISTORY_HK_FIND: SetFocus(findWindow); diff --git a/plugins/BasicHistory/src/Options.cpp b/plugins/BasicHistory/src/Options.cpp index 6b33158851..a5817a06dc 100644 --- a/plugins/BasicHistory/src/Options.cpp +++ b/plugins/BasicHistory/src/Options.cpp @@ -178,8 +178,8 @@ struct ColorOptionsList struct HotkeyOptionsList { const char *pszName; - const wchar_t *pwszDescription; - const wchar_t *pwszSection; + wchar_t *pwszDescription; + wchar_t *pwszSection; const char *pszService; WORD DefHotKey; LPARAM lParam; @@ -240,7 +240,6 @@ void Options::Load(void) HOTKEYDESC hid = { 0 }; fid.cbSize = sizeof(FontIDW); cid.cbSize = sizeof(ColourIDW); - hid.cbSize = sizeof(HOTKEYDESC); strncpy_s(fid.dbSettingsGroup, "BasicHistory_Fonts", _TRUNCATE); wcsncpy_s(fid.backgroundGroup, L"History", _TRUNCATE); wcsncpy_s(fid.group, LPGENW("History"), _TRUNCATE); @@ -271,8 +270,8 @@ void Options::Load(void) hid.dwFlags = HKD_UNICODE; for (int i = 0; i < g_hotkeysSize; ++i) { hid.pszName = g_HotkeyOptionsList[i].pszName; - hid.pwszDescription = g_HotkeyOptionsList[i].pwszDescription; - hid.pwszSection = g_HotkeyOptionsList[i].pwszSection; + hid.szDescription.w = g_HotkeyOptionsList[i].pwszDescription; + hid.szSection.w = g_HotkeyOptionsList[i].pwszSection; hid.pszService = g_HotkeyOptionsList[i].pszService; hid.DefHotKey = g_HotkeyOptionsList[i].DefHotKey; hid.lParam = g_HotkeyOptionsList[i].lParam; diff --git a/plugins/BossKeyPlus/src/BossKey.cpp b/plugins/BossKeyPlus/src/BossKey.cpp index 0c2766fa25..f9e01c480e 100644 --- a/plugins/BossKeyPlus/src/BossKey.cpp +++ b/plugins/BossKeyPlus/src/BossKey.cpp @@ -551,10 +551,9 @@ void BossKeyMenuItemUnInit(void) // Remove menu item void RegisterCoreHotKeys(void) { HOTKEYDESC hotkey = { 0 }; - hotkey.cbSize = sizeof(HOTKEYDESC); hotkey.pszName = "Hide/Show Miranda"; - hotkey.pszDescription = LPGEN("Hide/Show Miranda"); - hotkey.pszSection = "BossKey"; + hotkey.szDescription.a = LPGEN("Hide/Show Miranda"); + hotkey.szSection.a = "BossKey"; hotkey.pszService = MS_BOSSKEY_HIDE; hotkey.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL, VK_F12); diff --git a/plugins/CSList/src/cslist.cpp b/plugins/CSList/src/cslist.cpp index 7fc7af2ca4..24621383e2 100644 --- a/plugins/CSList/src/cslist.cpp +++ b/plugins/CSList/src/cslist.cpp @@ -163,11 +163,11 @@ extern "C" __declspec(dllexport) int Unload() void RegisterHotkeys(char buf[200], wchar_t* accName, int Number) { - HOTKEYDESC hotkey = { sizeof(hotkey) }; + HOTKEYDESC hotkey = {}; hotkey.dwFlags = HKD_UNICODE; hotkey.pszName = buf; - hotkey.pwszDescription = accName; - hotkey.pwszSection = LPGENW("Custom Status List"); + hotkey.szDescription.w = accName; + hotkey.szSection.w = LPGENW("Custom Status List"); hotkey.pszService = buf; hotkey.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL | HOTKEYF_SHIFT, '0' + Number); Hotkey_Register(&hotkey); diff --git a/plugins/Clist_modern/src/modern_keyboard.cpp b/plugins/Clist_modern/src/modern_keyboard.cpp index 76d5451df9..b1a05f50df 100644 --- a/plugins/Clist_modern/src/modern_keyboard.cpp +++ b/plugins/Clist_modern/src/modern_keyboard.cpp @@ -45,25 +45,24 @@ int InitSkinHotKeys(void) CreateServiceFunction("CLIST/HK/CloseMiranda", hkCloseMiranda); CreateServiceFunction("CLIST/HK/RestoreStatus", hkRestoreStatus); - HOTKEYDESC shk = { 0 }; - shk.cbSize = sizeof(shk); + HOTKEYDESC shk = {}; shk.dwFlags = HKD_UNICODE; - shk.pwszDescription = LPGENW("Close Miranda"); + shk.szSection.w = LPGENW("Main"); + shk.szDescription.w = LPGENW("Close Miranda"); shk.pszName = "CloseMiranda"; - shk.pwszSection = LPGENW("Main"); shk.pszService = "CLIST/HK/CloseMiranda"; Hotkey_Register(&shk); - shk.pwszDescription = LPGENW("Restore last status"); + shk.szSection.w = LPGENW("Status"); + shk.szDescription.w = LPGENW("Restore last status"); shk.pszName = "RestoreLastStatus"; - shk.pwszSection = LPGENW("Status"); shk.pszService = "CLIST/HK/RestoreStatus"; Hotkey_Register(&shk); - shk.pwszDescription = LPGENW("Show/Hide offline users"); + shk.szSection.w = LPGENW("Main"); + shk.szDescription.w = LPGENW("Show/Hide offline users"); shk.pszName = "ShowHideOfflineUsers"; - shk.pwszSection = LPGENW("Main"); shk.pszService = MS_CLIST_TOGGLEHIDEOFFLINE; Hotkey_Register(&shk); return 0; diff --git a/plugins/Console/src/Console.cpp b/plugins/Console/src/Console.cpp index b9925b4166..2a330aa36e 100644 --- a/plugins/Console/src/Console.cpp +++ b/plugins/Console/src/Console.cpp @@ -1132,11 +1132,10 @@ static int OnSystemModulesLoaded(WPARAM, LPARAM) HookEvent(ME_COLOUR_RELOAD, OnColourChange); - HOTKEYDESC hkd = { 0 }; - hkd.cbSize = sizeof(hkd); + HOTKEYDESC hkd = {}; hkd.pszName = "Console_Show_Hide"; - hkd.pszDescription = LPGEN("Show/Hide Console"); - hkd.pszSection = "Main"; + hkd.szSection.a = "Main"; + hkd.szDescription.a = LPGEN("Show/Hide Console"); hkd.pszService = MS_CONSOLE_SHOW_HIDE; hkd.DefHotKey = HOTKEYCODE(HOTKEYF_EXT, 'C'); Hotkey_Register(&hkd); diff --git a/plugins/CrashDumper/src/crshdmp.cpp b/plugins/CrashDumper/src/crshdmp.cpp index eebd830f2b..68fb2a48e1 100644 --- a/plugins/CrashDumper/src/crshdmp.cpp +++ b/plugins/CrashDumper/src/crshdmp.cpp @@ -317,16 +317,15 @@ static int ModulesLoaded(WPARAM, LPARAM) mi.pszService = MS_CRASHDUMPER_URL; Menu_ConfigureItem(Menu_AddMainMenuItem(&mi), MCI_OPT_EXECPARAM, 1); - HOTKEYDESC hk = { 0 }; - hk.cbSize = sizeof(hk); - hk.pszSection = PluginName; + HOTKEYDESC hk = {}; + hk.szSection.a = PluginName; - hk.pszDescription = LPGEN("Copy Version Info to clipboard"); + hk.szDescription.a = LPGEN("Copy Version Info to clipboard"); hk.pszName = "CopyVerInfo"; hk.pszService = MS_CRASHDUMPER_STORETOCLIP; Hotkey_Register(&hk); - hk.pszDescription = LPGEN("Show Version Info"); + hk.szDescription.a = LPGEN("Show Version Info"); hk.pszName = "ShowVerInfo"; hk.pszService = MS_CRASHDUMPER_VIEWINFO; Hotkey_Register(&hk); diff --git a/plugins/DbEditorPP/src/main.cpp b/plugins/DbEditorPP/src/main.cpp index 045834f1ab..0ec3a08be8 100644 --- a/plugins/DbEditorPP/src/main.cpp +++ b/plugins/DbEditorPP/src/main.cpp @@ -131,12 +131,12 @@ int ModulesLoaded(WPARAM, LPARAM) // Register hotkeys _A2T text(modFullname); - HOTKEYDESC hkd = { sizeof(hkd) }; + HOTKEYDESC hkd = {}; hkd.dwFlags = HKD_UNICODE; hkd.pszName = "hk_dbepp_open"; hkd.pszService = "DBEditorpp/MenuCommand"; - hkd.pwszDescription = LPGENW("Open Database Editor"); - hkd.pwszSection = text; + hkd.szDescription.w = LPGENW("Open Database Editor"); + hkd.szSection.w = text; hkd.DefHotKey = HOTKEYCODE(HOTKEYF_SHIFT | HOTKEYF_EXT, 'D'); Hotkey_Register(&hkd); diff --git a/plugins/FTPFileYM/src/ftpfile.cpp b/plugins/FTPFileYM/src/ftpfile.cpp index 90dc4e12eb..91de6e0066 100644 --- a/plugins/FTPFileYM/src/ftpfile.cpp +++ b/plugins/FTPFileYM/src/ftpfile.cpp @@ -170,11 +170,10 @@ void InitMenuItems() void InitHotkeys() { - HOTKEYDESC hk = { 0 }; - hk.cbSize = sizeof(hk); - hk.pszDescription = LPGEN("Show FTPFile manager"); + HOTKEYDESC hk = {}; + hk.szSection.a = MODULE; + hk.szDescription.a = LPGEN("Show FTPFile manager"); hk.pszName = "FTP_ShowManager"; - hk.pszSection = MODULE; hk.pszService = MS_FTPFILE_SHOWMANAGER; Hotkey_Register(&hk); } diff --git a/plugins/FavContacts/src/services.cpp b/plugins/FavContacts/src/services.cpp index e61459db72..d562f5e187 100644 --- a/plugins/FavContacts/src/services.cpp +++ b/plugins/FavContacts/src/services.cpp @@ -218,10 +218,10 @@ int ProcessModulesLoaded(WPARAM, LPARAM) ///////////////////////////////////////////////////////////////////////////////////// - HOTKEYDESC hotkey = { sizeof(hotkey) }; + HOTKEYDESC hotkey = {}; hotkey.pszName = "FavContacts/ShowMenu"; - hotkey.pszDescription = LPGEN("Show favorite contacts"); - hotkey.pszSection = "Contacts"; + hotkey.szDescription.a = LPGEN("Show favorite contacts"); + hotkey.szSection.a = "Contacts"; hotkey.pszService = MS_FAVCONTACTS_SHOWMENU_CENTERED; hotkey.DefHotKey = MAKEWORD('Q', HOTKEYF_EXT); Hotkey_Register(&hotkey); diff --git a/plugins/FloatingContacts/src/main.cpp b/plugins/FloatingContacts/src/main.cpp index 50d66b6e0f..9ac311a663 100644 --- a/plugins/FloatingContacts/src/main.cpp +++ b/plugins/FloatingContacts/src/main.cpp @@ -739,17 +739,17 @@ static void LoadMenus() hMainMenuItemHideAll = Menu_AddMainMenuItem(&mi); // Register hotkeys - HOTKEYDESC hkd = { sizeof(hkd) }; - hkd.pszSection = "Floating Contacts"; + HOTKEYDESC hkd = {}; + hkd.szSection.a = "Floating Contacts"; hkd.pszName = MODULE "/MainHideAllThumbs"; - hkd.pszDescription = LPGEN("Show/Hide all thumbs"); + hkd.szDescription.a = LPGEN("Show/Hide all thumbs"); hkd.pszService = MODULE "/MainHideAllThumbs"; Hotkey_Register(&hkd); CreateServiceFunction(MODULE "/HideWhenCListShow", OnHotKey_HideWhenCListShow); hkd.pszName = MODULE "/HideWhenCListShow"; - hkd.pszDescription = LPGEN("Hide when contact list is shown"); + hkd.szDescription.a = LPGEN("Hide when contact list is shown"); hkd.pszService = MODULE "/HideWhenCListShow"; Hotkey_Register(&hkd); } diff --git a/plugins/ListeningTo/src/listeningto.cpp b/plugins/ListeningTo/src/listeningto.cpp index ebda2b1ef2..b8daa9b2f1 100644 --- a/plugins/ListeningTo/src/listeningto.cpp +++ b/plugins/ListeningTo/src/listeningto.cpp @@ -293,23 +293,22 @@ int ModulesLoaded(WPARAM, LPARAM) } // Hotkeys support - HOTKEYDESC hkd = { 0 }; - hkd.cbSize = sizeof(hkd); - hkd.pszSection = LPGEN("Listening to"); + HOTKEYDESC hkd = {}; + hkd.szSection.a = LPGEN("Listening to"); hkd.pszService = MS_LISTENINGTO_HOTKEYS_ENABLE; hkd.pszName = "ListeningTo/EnableAll"; - hkd.pszDescription = LPGEN("Send to all protocols"); + hkd.szDescription.a = LPGEN("Send to all protocols"); Hotkey_Register(&hkd); hkd.pszService = MS_LISTENINGTO_HOTKEYS_DISABLE; hkd.pszName = "ListeningTo/DisableAll"; - hkd.pszDescription = LPGEN("Don't send to any protocols"); + hkd.szDescription.a = LPGEN("Don't send to any protocols"); Hotkey_Register(&hkd); hkd.pszService = MS_LISTENINGTO_HOTKEYS_TOGGLE; hkd.pszName = "ListeningTo/ToggleAll"; - hkd.pszDescription = LPGEN("Toggle send to all protocols"); + hkd.szDescription.a = LPGEN("Toggle send to all protocols"); Hotkey_Register(&hkd); // @@ -412,72 +411,72 @@ ProtocolInfo* GetProtoInfo(char *proto) return NULL; } -static void ReplaceVars(Buffer *buffer, MCONTACT hContact, wchar_t **variables, int numVariables) -{ - if (buffer->len < 3) - return; - - if (numVariables < 0) - return; - - for (size_t i = buffer->len - 1; i > 0; i--) { - if (buffer->str[i] == '%') { - // Find previous - size_t j; - for (j = i - 1; j > 0 && ((buffer->str[j] >= 'a' && buffer->str[j] <= 'z') - || (buffer->str[j] >= 'A' && buffer->str[j] <= 'Z') - || buffer->str[j] == '-' - || buffer->str[j] == '_'); j--); - - if (buffer->str[j] == '%') { - size_t foundLen = i - j + 1; - if (foundLen == 9 && wcsncmp(&buffer->str[j], L"%contact%", 9) == 0) { - buffer->replace(j, i + 1, pcli->pfnGetContactDisplayName(hContact, 0)); - } - else if (foundLen == 6 && wcsncmp(&buffer->str[j], L"%date%", 6) == 0) { - wchar_t tmp[128]; - TimeZone_ToStringT(time(NULL), L"d s", tmp, _countof(tmp)); - buffer->replace(j, i + 1, tmp); - } - else { - for (int k = 0; k < numVariables; k += 2) { - size_t len = mir_wstrlen(variables[k]); - if (foundLen == len + 2 && wcsncmp(&buffer->str[j] + 1, variables[k], len) == 0) { - buffer->replace(j, i + 1, variables[k + 1]); - break; - } - } - } - } - - i = j; - if (i == 0) - break; - } - else if (buffer->str[i] == '\\' && i + 1 <= buffer->len - 1 && buffer->str[i + 1] == 'n') { - buffer->str[i] = '\r'; - buffer->str[i + 1] = '\n'; - } - } -} - -void ReplaceTemplate(Buffer *out, MCONTACT hContact, wchar_t *templ, wchar_t **vars, int numVars) -{ - - if (ServiceExists(MS_VARS_FORMATSTRING)) { - wchar_t *tmp = variables_parse_ex(templ, NULL, hContact, vars, numVars); - if (tmp != NULL) { - out->append(tmp); - mir_free(tmp); - out->pack(); - return; - } - } - - out->append(templ); - ReplaceVars(out, hContact, vars, numVars); - out->pack(); -} +static void ReplaceVars(Buffer *buffer, MCONTACT hContact, wchar_t **variables, int numVariables) +{ + if (buffer->len < 3) + return; + + if (numVariables < 0) + return; + + for (size_t i = buffer->len - 1; i > 0; i--) { + if (buffer->str[i] == '%') { + // Find previous + size_t j; + for (j = i - 1; j > 0 && ((buffer->str[j] >= 'a' && buffer->str[j] <= 'z') + || (buffer->str[j] >= 'A' && buffer->str[j] <= 'Z') + || buffer->str[j] == '-' + || buffer->str[j] == '_'); j--); + + if (buffer->str[j] == '%') { + size_t foundLen = i - j + 1; + if (foundLen == 9 && wcsncmp(&buffer->str[j], L"%contact%", 9) == 0) { + buffer->replace(j, i + 1, pcli->pfnGetContactDisplayName(hContact, 0)); + } + else if (foundLen == 6 && wcsncmp(&buffer->str[j], L"%date%", 6) == 0) { + wchar_t tmp[128]; + TimeZone_ToStringT(time(NULL), L"d s", tmp, _countof(tmp)); + buffer->replace(j, i + 1, tmp); + } + else { + for (int k = 0; k < numVariables; k += 2) { + size_t len = mir_wstrlen(variables[k]); + if (foundLen == len + 2 && wcsncmp(&buffer->str[j] + 1, variables[k], len) == 0) { + buffer->replace(j, i + 1, variables[k + 1]); + break; + } + } + } + } + + i = j; + if (i == 0) + break; + } + else if (buffer->str[i] == '\\' && i + 1 <= buffer->len - 1 && buffer->str[i + 1] == 'n') { + buffer->str[i] = '\r'; + buffer->str[i + 1] = '\n'; + } + } +} + +void ReplaceTemplate(Buffer *out, MCONTACT hContact, wchar_t *templ, wchar_t **vars, int numVars) +{ + + if (ServiceExists(MS_VARS_FORMATSTRING)) { + wchar_t *tmp = variables_parse_ex(templ, NULL, hContact, vars, numVars); + if (tmp != NULL) { + out->append(tmp); + mir_free(tmp); + out->pack(); + return; + } + } + + out->append(templ); + ReplaceVars(out, hContact, vars, numVars); + out->pack(); +} void SetListeningInfo(char *proto, LISTENINGTOINFO *lti = NULL) { diff --git a/plugins/MirLua/src/m_hotkeys.cpp b/plugins/MirLua/src/m_hotkeys.cpp index e3c71cf38c..63358fd31c 100644 --- a/plugins/MirLua/src/m_hotkeys.cpp +++ b/plugins/MirLua/src/m_hotkeys.cpp @@ -2,8 +2,6 @@ void MakeHotkey(lua_State *L, HOTKEYDESC &hk) { - hk.cbSize = sizeof(HOTKEYDESC); - lua_getfield(L, -1, "Flags"); hk.dwFlags = lua_tointeger(L, -1); lua_pop(L, 1); @@ -16,11 +14,11 @@ void MakeHotkey(lua_State *L, HOTKEYDESC &hk) lua_pop(L, 1); lua_getfield(L, -1, "Description"); - hk.pwszDescription = mir_utf8decodeW(lua_tostring(L, -1)); + hk.szDescription.w = mir_utf8decodeW(lua_tostring(L, -1)); lua_pop(L, 1); lua_getfield(L, -1, "Section"); - hk.pwszSection = mir_utf8decodeW(luaL_optstring(L, -1, MODULE)); + hk.szSection.w = mir_utf8decodeW(luaL_optstring(L, -1, MODULE)); lua_pop(L, 1); lua_getfield(L, -1, "Hotkey"); @@ -58,9 +56,7 @@ static int hotkeys_Register(lua_State *L) static int hotkeys_Unregister(lua_State *L) { const char *name = luaL_checkstring(L, 1); - - CallService(MS_HOTKEY_UNREGISTER, 0, (LPARAM)name); - + Hotkey_Unregister(name); return 0; } diff --git a/plugins/NewsAggregator/Src/NewsAggregator.cpp b/plugins/NewsAggregator/Src/NewsAggregator.cpp index 329b921a95..44c9e4d035 100644 --- a/plugins/NewsAggregator/Src/NewsAggregator.cpp +++ b/plugins/NewsAggregator/Src/NewsAggregator.cpp @@ -89,11 +89,11 @@ extern "C" __declspec(dllexport) int Load(void) CreateServiceFunction(MS_NEWSAGGREGATOR_CHANGEFEED, ChangeFeed); CreateServiceFunction(MS_NEWSAGGREGATOR_ENABLED, EnableDisable); - HOTKEYDESC hkd = { sizeof(hkd) }; + HOTKEYDESC hkd = {}; hkd.dwFlags = HKD_UNICODE; hkd.pszName = "NewsAggregator/CheckAllFeeds"; - hkd.pwszDescription = LPGENW("Check All Feeds"); - hkd.pwszSection = LPGENW("News Aggregator"); + hkd.szDescription.w = LPGENW("Check All Feeds"); + hkd.szSection.w = LPGENW("News Aggregator"); hkd.pszService = MS_NEWSAGGREGATOR_CHECKALLFEEDS; hkd.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL+HKCOMB_A, 'O') | HKF_MIRANDA_LOCAL; Hotkey_Register(&hkd); diff --git a/plugins/NotesAndReminders/src/hotkeys.cpp b/plugins/NotesAndReminders/src/hotkeys.cpp index 566129094d..89e5133846 100644 --- a/plugins/NotesAndReminders/src/hotkeys.cpp +++ b/plugins/NotesAndReminders/src/hotkeys.cpp @@ -9,33 +9,32 @@ enum KB_ACTIONS {KB_NEW_NOTE = 1, KB_TOGGLE_NOTES, KB_NEW_REMINDER}; void RegisterKeyBindings() { HOTKEYDESC desc = {}; - desc.cbSize = sizeof(desc); - desc.pwszSection = _A2W(SECTIONNAME); + desc.szSection.w = _A2W(SECTIONNAME); desc.dwFlags = HKD_UNICODE; desc.pszName = MODULENAME"/NewNote"; - desc.pwszDescription = LPGENW("New Note"); + desc.szDescription.w = LPGENW("New Note"); desc.lParam = KB_NEW_NOTE; desc.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL|HOTKEYF_SHIFT, VK_INSERT); desc.pszService = MODULENAME"/MenuCommandAddNew"; Hotkey_Register(&desc); desc.pszName = MODULENAME"/ToggleNotesVis"; - desc.pwszDescription = LPGENW("Toggle Notes Visibility"); + desc.szDescription.w = LPGENW("Toggle Notes Visibility"); desc.lParam = KB_TOGGLE_NOTES; desc.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL|HOTKEYF_SHIFT, VK_ADD); desc.pszService = MODULENAME"/MenuCommandShowHide"; Hotkey_Register(&desc); desc.pszName = MODULENAME"/BringNotesFront"; - desc.pwszDescription = LPGENW("Bring All Notes to Front"); + desc.szDescription.w = LPGENW("Bring All Notes to Front"); desc.lParam = KB_TOGGLE_NOTES; desc.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL|HOTKEYF_SHIFT, VK_HOME); desc.pszService = MODULENAME"/MenuCommandBringAllFront"; Hotkey_Register(&desc); desc.pszName = MODULENAME"/NewReminder"; - desc.pwszDescription = LPGENW("New Reminder"); + desc.szDescription.w = LPGENW("New Reminder"); desc.lParam = KB_NEW_REMINDER; desc.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL|HOTKEYF_SHIFT, VK_SUBTRACT); desc.pszService = MODULENAME"/MenuCommandNewReminder"; diff --git a/plugins/OpenFolder/src/openFolder.cpp b/plugins/OpenFolder/src/openFolder.cpp index 5c5e1c7328..9765e517a6 100644 --- a/plugins/OpenFolder/src/openFolder.cpp +++ b/plugins/OpenFolder/src/openFolder.cpp @@ -87,12 +87,11 @@ extern "C" int __declspec(dllexport) Load() Icon_Register(hInst, LPGEN("Open Folder"), &icon, 1, OPENFOLDER_MODULE_NAME); // hotkeys service (0.8+) - HOTKEYDESC hotkey = { 0 }; - hotkey.cbSize = sizeof(hotkey); + HOTKEYDESC hotkey = {}; hotkey.dwFlags = HKD_UNICODE; hotkey.pszName = "Open Folder"; - hotkey.pwszDescription = LPGENW("Open Folder"); - hotkey.pwszSection = LPGENW("Main"); + hotkey.szDescription.w = LPGENW("Open Folder"); + hotkey.szSection.w = LPGENW("Main"); hotkey.pszService = MS_OPENFOLDER_OPEN; hotkey.DefHotKey = MAKEWORD( 'O', HOTKEYF_SHIFT | HOTKEYF_ALT ); Hotkey_Register(&hotkey); diff --git a/plugins/PackUpdater/Src/Events.cpp b/plugins/PackUpdater/Src/Events.cpp index 92d12fc948..be0be7c32d 100644 --- a/plugins/PackUpdater/Src/Events.cpp +++ b/plugins/PackUpdater/Src/Events.cpp @@ -25,15 +25,14 @@ BOOL Silent; int ModulesLoaded(WPARAM, LPARAM) { Silent = true; - HOTKEYDESC hkd = { 0 }; - hkd.cbSize = sizeof(hkd); + + HOTKEYDESC hkd = {}; hkd.dwFlags = HKD_UNICODE; hkd.pszName = "Check for pack updates"; - hkd.pwszDescription = LPGENW("Check for pack updates"); - hkd.pwszSection = LPGENW("Pack Updater"); + hkd.szDescription.w = LPGENW("Check for pack updates"); + hkd.szSection.w = LPGENW("Pack Updater"); hkd.pszService = MODNAME"/CheckUpdates"; hkd.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL, VK_F10) | HKF_MIRANDA_LOCAL; - hkd.lParam = FALSE; Hotkey_Register(&hkd); if (AllowUpdateOnStartup()) diff --git a/plugins/PluginUpdater/src/PluginUpdater.cpp b/plugins/PluginUpdater/src/PluginUpdater.cpp index 204f167cbf..9c09f5a6f9 100644 --- a/plugins/PluginUpdater/src/PluginUpdater.cpp +++ b/plugins/PluginUpdater/src/PluginUpdater.cpp @@ -114,10 +114,10 @@ extern "C" __declspec(dllexport) int Load(void) #endif // Add hotkey - HOTKEYDESC hkd = { sizeof(hkd) }; + HOTKEYDESC hkd = {}; hkd.pszName = "Check for updates"; - hkd.pszDescription = "Check for updates"; - hkd.pszSection = "Plugin Updater"; + hkd.szDescription.a = "Check for updates"; + hkd.szSection.a = "Plugin Updater"; hkd.pszService = MS_PU_CHECKUPDATES; hkd.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL, VK_F10) | HKF_MIRANDA_LOCAL; hkd.lParam = FALSE; diff --git a/plugins/Popup/src/main.cpp b/plugins/Popup/src/main.cpp index 429df0e8f2..9fdd80632a 100644 --- a/plugins/Popup/src/main.cpp +++ b/plugins/Popup/src/main.cpp @@ -209,17 +209,17 @@ INT_PTR GetStatus(WPARAM, LPARAM) // register Hotkey void LoadHotkey() { - HOTKEYDESC hk = { sizeof(hk) }; + HOTKEYDESC hk = {}; hk.dwFlags = HKD_UNICODE; hk.pszName = "Toggle Popups"; - hk.pwszDescription = LPGENW("Toggle Popups"); - hk.pwszSection = MODULNAME_PLUW; + hk.szDescription.w = LPGENW("Toggle Popups"); + hk.szSection.w = MODULNAME_PLUW; hk.pszService = MENUCOMMAND_SVC; Hotkey_Register(&hk); // 'Popup History' Hotkey hk.pszName = "Popup History"; - hk.pwszDescription = LPGENW("Popup History"); + hk.szDescription.w = LPGENW("Popup History"); hk.pszService = MENUCOMMAND_HISTORY; Hotkey_Register(&hk); } diff --git a/plugins/QuickContacts/src/quickcontacts.cpp b/plugins/QuickContacts/src/quickcontacts.cpp index 499005b6ae..d6b05ccb77 100644 --- a/plugins/QuickContacts/src/quickcontacts.cpp +++ b/plugins/QuickContacts/src/quickcontacts.cpp @@ -122,12 +122,11 @@ int ModulesLoaded(WPARAM, LPARAM) hasNewHotkeyModule = TRUE; - HOTKEYDESC hkd = {0}; - hkd.cbSize = sizeof(hkd); + HOTKEYDESC hkd = {}; hkd.dwFlags = HKD_UNICODE; hkd.pszName = "Quick Contacts/Open dialog"; - hkd.pwszDescription = LPGENW("Open dialog"); - hkd.pwszSection = LPGENW("Quick Contacts"); + hkd.szDescription.w = LPGENW("Open dialog"); + hkd.szSection.w = LPGENW("Quick Contacts"); hkd.pszService = MS_QC_SHOW_DIALOG; hkd.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL|HOTKEYF_ALT, 'Q'); Hotkey_Register(&hkd); @@ -137,37 +136,37 @@ int ModulesLoaded(WPARAM, LPARAM) hkd.lParam = HOTKEY_FILE; hkd.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL, 'F'); hkd.pszName = "Quick Contacts/File"; - hkd.pwszDescription = LPGENW("Send file"); + hkd.szDescription.w = LPGENW("Send file"); Hotkey_Register(&hkd); hkd.lParam = HOTKEY_URL; hkd.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL, 'U'); hkd.pszName = "Quick Contacts/URL"; - hkd.pwszDescription = LPGENW("Send URL"); + hkd.szDescription.w = LPGENW("Send URL"); Hotkey_Register(&hkd); hkd.lParam = HOTKEY_INFO; hkd.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL, 'I'); hkd.pszName = "Quick Contacts/Info"; - hkd.pwszDescription = LPGENW("Open user info"); + hkd.szDescription.w = LPGENW("Open user info"); Hotkey_Register(&hkd); hkd.lParam = HOTKEY_HISTORY; hkd.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL, 'H'); hkd.pszName = "Quick Contacts/History"; - hkd.pwszDescription = LPGENW("Open history"); + hkd.szDescription.w = LPGENW("Open history"); Hotkey_Register(&hkd); hkd.lParam = HOTKEY_MENU; hkd.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL, 'M'); hkd.pszName = "Quick Contacts/Menu"; - hkd.pwszDescription = LPGENW("Open contact menu"); + hkd.szDescription.w = LPGENW("Open contact menu"); Hotkey_Register(&hkd); hkd.lParam = HOTKEY_ALL_CONTACTS; hkd.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL, 'A'); hkd.pszName = "Quick Contacts/All Contacts"; - hkd.pwszDescription = LPGENW("Show all contacts"); + hkd.szDescription.w = LPGENW("Show all contacts"); Hotkey_Register(&hkd); if (ServiceExists(MS_SKIN_ADDHOTKEY)) @@ -641,7 +640,7 @@ LRESULT CALLBACK HookProc(int code, WPARAM, LPARAM lparam) MSG *msg = (MSG*)lparam; if (hasNewHotkeyModule) { - int action = CallService(MS_HOTKEY_CHECK, (WPARAM) msg, (LPARAM) "Quick Contacts"); + int action = Hotkey_Check(msg, "Quick Contacts"); if (action != 0) { SendMessage(hwndMain, WM_COMMAND, action, 0); diff --git a/plugins/QuickSearch/sr_global.pas b/plugins/QuickSearch/sr_global.pas index 8299edc8fc..5e5eb5dc4b 100644 --- a/plugins/QuickSearch/sr_global.pas +++ b/plugins/QuickSearch/sr_global.pas @@ -187,14 +187,13 @@ begin FillChar(hkrec,SizeOf(hkrec),0); with hkrec do begin - cbSize :=SizeOf(hkrec); pszName :=HKN_GLOBAL; pszDescription.a:='QuickSearch window hotkey'; pszSection.a :=qs_name; pszService :=QS_SHOWSERVICE; DefHotKey :=(HOTKEYF_ALT shl 8) or VK_F3; end; - CallService(MS_HOTKEY_REGISTER,0,lparam(@hkrec)); + Hotkey_Register(@hkrec); end; procedure removetoolbar; diff --git a/plugins/RecentContacts/src/RecentContacts.cpp b/plugins/RecentContacts/src/RecentContacts.cpp index c707f81ed1..c88932e102 100644 --- a/plugins/RecentContacts/src/RecentContacts.cpp +++ b/plugins/RecentContacts/src/RecentContacts.cpp @@ -532,10 +532,10 @@ static int OnModulesLoaded(WPARAM, LPARAM) LoadDBSettings(); // hotkeys - HOTKEYDESC hk = { sizeof(hk) }; + HOTKEYDESC hk = {}; hk.pszName = msLastUC_ShowList; - hk.pszDescription = LPGEN("Show Recent Contacts"); - hk.pszSection = "Contacts"; + hk.szSection.a = "Contacts"; + hk.szDescription.a = LPGEN("Show Recent Contacts"); hk.pszService = msLastUC_ShowList; hk.DefHotKey = MAKEWORD('R', HOTKEYF_CONTROL | HOTKEYF_SHIFT); Hotkey_Register(&hk); diff --git a/plugins/Scriver/src/input.cpp b/plugins/Scriver/src/input.cpp index f9d96235c6..c5034ea3eb 100644 --- a/plugins/Scriver/src/input.cpp +++ b/plugins/Scriver/src/input.cpp @@ -118,12 +118,8 @@ int CScriverWindow::InputAreaShortcuts(HWND hwnd, UINT msg, WPARAM wParam, LPARA BOOL isAlt = GetKeyState(VK_MENU) & 0x8000; BOOL isCtrl = (GetKeyState(VK_CONTROL) & 0x8000) && !isAlt; - MSG amsg; - amsg.hwnd = hwnd; - amsg.message = msg; - amsg.wParam = wParam; - amsg.lParam = lParam; - int action = CallService(MS_HOTKEY_CHECK, (WPARAM)&amsg, (LPARAM)"Messaging"); + MSG amsg = { hwnd, msg, wParam, lParam }; + int action = Hotkey_Check(&amsg, "Messaging"); switch (action) { case KB_PREV_TAB: @@ -265,10 +261,10 @@ int CScriverWindow::InputAreaShortcuts(HWND hwnd, UINT msg, WPARAM wParam, LPARA void RegisterKeyBindings() { char strDesc[64], strName[64]; - HOTKEYDESC desc = { sizeof(desc) }; - desc.pszSection = LPGEN("Messaging"); + HOTKEYDESC desc = {}; + desc.szSection.a = LPGEN("Messaging"); desc.pszName = "Scriver/Nav/Previous Tab"; - desc.pszDescription = LPGEN("Navigate: Previous tab"); + desc.szDescription.a = LPGEN("Navigate: Previous tab"); desc.lParam = KB_PREV_TAB; desc.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL | HOTKEYF_SHIFT, VK_TAB); Hotkey_Register(&desc); @@ -278,7 +274,7 @@ void RegisterKeyBindings() Hotkey_Register(&desc); desc.pszName = "Scriver/Nav/Next Tab"; - desc.pszDescription = LPGEN("Navigate: Next tab"); + desc.szDescription.a = LPGEN("Navigate: Next tab"); desc.lParam = KB_NEXT_TAB; desc.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL, VK_TAB); Hotkey_Register(&desc); @@ -288,7 +284,7 @@ void RegisterKeyBindings() Hotkey_Register(&desc); desc.pszName = strName; - desc.pszDescription = strDesc; + desc.szDescription.a = strDesc; for (int i = 0; i < 9; i++) { mir_snprintf(strName, "Scriver/Nav/Tab %d", i + 1); mir_snprintf(strDesc, Translate("Navigate: Tab %d"), i + 1); @@ -298,43 +294,43 @@ void RegisterKeyBindings() } desc.pszName = "Scriver/Wnd/Toggle Statusbar"; - desc.pszDescription = LPGEN("Window: Toggle status bar"); + desc.szDescription.a = LPGEN("Window: Toggle status bar"); desc.lParam = KB_SWITCHSTATUSBAR; desc.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL | HOTKEYF_SHIFT, 'S'); Hotkey_Register(&desc); desc.pszName = "Scriver/Wnd/Toggle Titlebar"; - desc.pszDescription = LPGEN("Window: Toggle title bar"); + desc.szDescription.a = LPGEN("Window: Toggle title bar"); desc.lParam = KB_SWITCHTITLEBAR; desc.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL | HOTKEYF_SHIFT, 'M'); Hotkey_Register(&desc); desc.pszName = "Scriver/Wnd/Toggle Toolbar"; - desc.pszDescription = LPGEN("Window: Toggle toolbar"); + desc.szDescription.a = LPGEN("Window: Toggle toolbar"); desc.lParam = KB_SWITCHTOOLBAR; desc.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL | HOTKEYF_SHIFT, 'T'); Hotkey_Register(&desc); desc.pszName = "Scriver/Wnd/Toggle Infobar"; - desc.pszDescription = LPGEN("Window: Toggle info bar"); + desc.szDescription.a = LPGEN("Window: Toggle info bar"); desc.lParam = KB_SWITCHINFOBAR; desc.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL | HOTKEYF_SHIFT, 'N'); Hotkey_Register(&desc); desc.pszName = "Scriver/Wnd/Clear Log"; - desc.pszDescription = LPGEN("Window: Clear log"); + desc.szDescription.a = LPGEN("Window: Clear log"); desc.lParam = KB_CLEAR_LOG; desc.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL, 'L'); Hotkey_Register(&desc); desc.pszName = "Scriver/Wnd/Minimize"; - desc.pszDescription = LPGEN("Window: Minimize"); + desc.szDescription.a = LPGEN("Window: Minimize"); desc.lParam = KB_MINIMIZE; desc.DefHotKey = HOTKEYCODE(HOTKEYF_SHIFT, VK_ESCAPE); Hotkey_Register(&desc); desc.pszName = "Scriver/Wnd/Close Tab"; - desc.pszDescription = LPGEN("Window: Close tab"); + desc.szDescription.a = LPGEN("Window: Close tab"); desc.lParam = KB_CLOSE; desc.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL, VK_F4); Hotkey_Register(&desc); @@ -342,19 +338,19 @@ void RegisterKeyBindings() Hotkey_Register(&desc); desc.pszName = "Scriver/Action/Quote"; - desc.pszDescription = LPGEN("Action: Quote"); + desc.szDescription.a = LPGEN("Action: Quote"); desc.lParam = KB_QUOTE; desc.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL, 'Q'); Hotkey_Register(&desc); desc.pszName = "Scriver/Action/Send All"; - desc.pszDescription = LPGEN("Action: Send to all"); + desc.szDescription.a = LPGEN("Action: Send to all"); desc.lParam = KB_SEND_ALL; desc.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL | HOTKEYF_SHIFT, VK_RETURN); Hotkey_Register(&desc); desc.pszName = "Scriver/Action/PasteSend"; - desc.pszDescription = LPGEN("Action: Paste and send"); + desc.szDescription.a = LPGEN("Action: Paste and send"); desc.lParam = KB_PASTESEND; desc.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL | HOTKEYF_SHIFT, VK_INSERT); Hotkey_Register(&desc); diff --git a/plugins/SendScreenshotPlus/src/Main.cpp b/plugins/SendScreenshotPlus/src/Main.cpp index 1e10b5b0e5..abca9d118b 100644 --- a/plugins/SendScreenshotPlus/src/Main.cpp +++ b/plugins/SendScreenshotPlus/src/Main.cpp @@ -317,15 +317,15 @@ DLL_EXPORT int Load(void) Menu_AddContactMenuItem(&mi); /// hotkey's - HOTKEYDESC hkd = { sizeof(hkd) }; + HOTKEYDESC hkd = {}; hkd.pszName = "Open SendSS+"; - hkd.pwszDescription = LPGENW("Open SendSS+"); - hkd.pwszSection = L"SendSS+"; + hkd.szDescription.w = LPGENW("Open SendSS+"); + hkd.szSection.w = L"SendSS+"; hkd.pszService = MS_SENDSS_OPENDIALOG; - //hkd.DefHotKey=HOTKEYCODE(HOTKEYF_CONTROL, VK_F10) | HKF_MIRANDA_LOCAL; hkd.lParam = 0xFFFF; hkd.dwFlags = HKD_UNICODE; Hotkey_Register(&hkd); + /// register highlighter window class HBRUSH brush = CreateSolidBrush(0x0000FF00);//owned by class WNDCLASS wndclass = { CS_HREDRAW | CS_VREDRAW, DefWindowProc, 0, 0, g_hSendSS, NULL, NULL, brush, NULL, L"SendSSHighlighter" }; diff --git a/plugins/Sessions/Src/Main.cpp b/plugins/Sessions/Src/Main.cpp index 5c4b8a3294..0d0baffe91 100644 --- a/plugins/Sessions/Src/Main.cpp +++ b/plugins/Sessions/Src/Main.cpp @@ -744,25 +744,25 @@ static int PluginInit(WPARAM, LPARAM) HookEvent(ME_TTB_MODULELOADED, CreateButtons); // Hotkeys - HOTKEYDESC hkd = { sizeof(hkd) }; - hkd.pszSection = LPGEN("Sessions"); + HOTKEYDESC hkd = {}; hkd.pszName = "OpenSessionsManager"; - hkd.pszDescription = LPGEN("Open Sessions Manager"); + hkd.szSection.a = LPGEN("Sessions"); + hkd.szDescription.a = LPGEN("Open Sessions Manager"); hkd.pszService = MS_SESSIONS_OPENMANAGER; Hotkey_Register(&hkd); hkd.pszName = "RestoreLastSession"; - hkd.pszDescription = LPGEN("Restore last Session"); + hkd.szDescription.a = LPGEN("Restore last Session"); hkd.pszService = MS_SESSIONS_RESTORELASTSESSION; Hotkey_Register(&hkd); hkd.pszName = "SaveSession"; - hkd.pszDescription = LPGEN("Save Session"); + hkd.szDescription.a = LPGEN("Save Session"); hkd.pszService = MS_SESSIONS_SAVEUSERSESSION; Hotkey_Register(&hkd); hkd.pszName = "CloseSession"; - hkd.pszDescription = LPGEN("Close Session"); + hkd.szDescription.a = LPGEN("Close Session"); hkd.pszService = MS_SESSIONS_CLOSESESSION; Hotkey_Register(&hkd); diff --git a/plugins/SimpleStatusMsg/src/main.cpp b/plugins/SimpleStatusMsg/src/main.cpp index 4b942d6ef9..a6bcbb866f 100644 --- a/plugins/SimpleStatusMsg/src/main.cpp +++ b/plugins/SimpleStatusMsg/src/main.cpp @@ -1343,13 +1343,11 @@ static int AddTopToolbarButton(WPARAM, LPARAM) void RegisterHotkey(void) { - HOTKEYDESC hkd = {0}; - - hkd.cbSize = sizeof(hkd); + HOTKEYDESC hkd = {}; hkd.dwFlags = HKD_UNICODE; hkd.pszName = "SimpleStatusMsg_OpenDialog"; - hkd.pwszDescription = LPGENW("Open status message dialog"); - hkd.pwszSection = LPGENW("Status message"); + hkd.szDescription.w = LPGENW("Open status message dialog"); + hkd.szSection.w = LPGENW("Status message"); hkd.pszService = MS_SIMPLESTATUSMSG_SHOWDIALOGINT; hkd.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL, VK_OEM_3); Hotkey_Register(&hkd); diff --git a/plugins/SmileyAdd/src/main.cpp b/plugins/SmileyAdd/src/main.cpp index a1a49e3a47..fb8ed6a51d 100644 --- a/plugins/SmileyAdd/src/main.cpp +++ b/plugins/SmileyAdd/src/main.cpp @@ -67,10 +67,10 @@ static int ModulesLoaded(WPARAM, LPARAM) g_SmileyCategories.AddAllProtocolsAsCategory(); g_SmileyCategories.ClearAndLoadAll(); - HOTKEYDESC desc = { sizeof(desc) }; + HOTKEYDESC desc = {}; desc.pszName = "smileyadd"; - desc.pszSection = MODULENAME; - desc.pszDescription = LPGEN("Smiley selector"); + desc.szSection.a = MODULENAME; + desc.szDescription.a = LPGEN("Smiley selector"); desc.DefHotKey = HOTKEYCODE(HOTKEYF_ALT, 'E'); Hotkey_Register(&desc); diff --git a/plugins/SpellChecker/src/spellchecker.cpp b/plugins/SpellChecker/src/spellchecker.cpp index 63d7ab3304..4726369e2b 100644 --- a/plugins/SpellChecker/src/spellchecker.cpp +++ b/plugins/SpellChecker/src/spellchecker.cpp @@ -211,10 +211,10 @@ static int ModulesLoaded(WPARAM, LPARAM) Srmm_AddIcon(&sid); } - HOTKEYDESC hkd = { sizeof(hkd) }; + HOTKEYDESC hkd = {}; hkd.pszName = "Spell Checker/Toggle"; - hkd.pszSection = LPGEN("Spell Checker"); - hkd.pszDescription = LPGEN("Enable/disable spell checker"); + hkd.szSection.a = LPGEN("Spell Checker"); + hkd.szDescription.a = LPGEN("Enable/disable spell checker"); hkd.DefHotKey = HOTKEYCODE(HOTKEYF_SHIFT | HOTKEYF_ALT, 'S'); hkd.lParam = HOTKEY_ACTION_TOGGLE; Hotkey_Register(&hkd); diff --git a/plugins/SpellChecker/src/utils.cpp b/plugins/SpellChecker/src/utils.cpp index 6c1e6dd82c..0c62b9e307 100644 --- a/plugins/SpellChecker/src/utils.cpp +++ b/plugins/SpellChecker/src/utils.cpp @@ -552,13 +552,8 @@ LRESULT CALLBACK EditProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) return -1; // Hotkey support - MSG msgData = { 0 }; - msgData.hwnd = hwnd; - msgData.message = msg; - msgData.wParam = wParam; - msgData.lParam = lParam; - - int action = CallService(MS_HOTKEY_CHECK, (WPARAM)&msgData, (LPARAM)"Spell Checker"); + MSG msgData = { hwnd, msg, wParam, lParam }; + int action = Hotkey_Check(&msgData, "Spell Checker"); if (action == HOTKEY_ACTION_TOGGLE) { ToggleEnabled(dlg); return 1; diff --git a/plugins/TabSRMM/src/chat_window.cpp b/plugins/TabSRMM/src/chat_window.cpp index c13e94dc84..2b2080af00 100644 --- a/plugins/TabSRMM/src/chat_window.cpp +++ b/plugins/TabSRMM/src/chat_window.cpp @@ -1993,7 +1993,7 @@ INT_PTR CChatRoomDlg::DlgProc(UINT uMsg, WPARAM wParam, LPARAM lParam) return _dlgReturn(m_hwnd, 1); } - LRESULT mim_hotkey_check = CallService(MS_HOTKEY_CHECK, (WPARAM)&message, (LPARAM)(TABSRMM_HK_SECTION_GC)); + LRESULT mim_hotkey_check = Hotkey_Check(&message, TABSRMM_HK_SECTION_GC); if (mim_hotkey_check) m_bkeyProcessed = true; diff --git a/plugins/TabSRMM/src/generic_msghandlers.cpp b/plugins/TabSRMM/src/generic_msghandlers.cpp index 96c17b3607..e65ac89e63 100644 --- a/plugins/TabSRMM/src/generic_msghandlers.cpp +++ b/plugins/TabSRMM/src/generic_msghandlers.cpp @@ -118,7 +118,7 @@ void CTabBaseDlg::DM_InitTip() bool CTabBaseDlg::DM_GenericHotkeysCheck(MSG *message) { - LRESULT mim_hotkey_check = CallService(MS_HOTKEY_CHECK, (WPARAM)message, (LPARAM)TABSRMM_HK_SECTION_GENERIC); + LRESULT mim_hotkey_check = Hotkey_Check(message, TABSRMM_HK_SECTION_GENERIC); switch (mim_hotkey_check) { case TABSRMM_HK_PASTEANDSEND: diff --git a/plugins/TabSRMM/src/hotkeyhandler.cpp b/plugins/TabSRMM/src/hotkeyhandler.cpp index af951250db..914b0d89c7 100644 --- a/plugins/TabSRMM/src/hotkeyhandler.cpp +++ b/plugins/TabSRMM/src/hotkeyhandler.cpp @@ -40,33 +40,33 @@ static UINT WM_TASKBARCREATED; static HANDLE hSvcHotkeyProcessor = 0; static HOTKEYDESC _hotkeydescs[] = { - { 0, "tabsrmm_mostrecent", LPGEN("Most recent unread session"), TABSRMM_HK_SECTION_IM, MS_TABMSG_HOTKEYPROCESS, HOTKEYCODE(HOTKEYF_CONTROL | HOTKEYF_SHIFT, 'R'), TABSRMM_HK_LASTUNREAD }, - { 0, "tabsrmm_paste_and_send", LPGEN("Paste and send"), TABSRMM_HK_SECTION_GENERIC, 0, HOTKEYCODE(HOTKEYF_CONTROL | HOTKEYF_SHIFT, 'D'), TABSRMM_HK_PASTEANDSEND }, - { 0, "tabsrmm_uprefs", LPGEN("Contact's messaging preferences"), TABSRMM_HK_SECTION_IM, 0, HOTKEYCODE(HOTKEYF_CONTROL | HOTKEYF_SHIFT, 'C'), TABSRMM_HK_SETUSERPREFS }, - { 0, "tabsrmm_copts", LPGEN("Container options"), TABSRMM_HK_SECTION_GENERIC, 0, HOTKEYCODE(HOTKEYF_CONTROL, 'O'), TABSRMM_HK_CONTAINEROPTIONS }, - { 0, "tabsrmm_nudge", LPGEN("Send nudge"), TABSRMM_HK_SECTION_IM, 0, HOTKEYCODE(HOTKEYF_CONTROL, 'N'), TABSRMM_HK_NUDGE }, - { 0, "tabsrmm_sendfile", LPGEN("Send a file"), TABSRMM_HK_SECTION_IM, 0, HOTKEYCODE(HOTKEYF_ALT, 'F'), TABSRMM_HK_SENDFILE }, - { 0, "tabsrmm_quote", LPGEN("Quote message"), TABSRMM_HK_SECTION_IM, 0, HOTKEYCODE(HOTKEYF_ALT, 'Q'), TABSRMM_HK_QUOTEMSG }, - { 0, "tabsrmm_sendlater", LPGEN("Toggle send later"), TABSRMM_HK_SECTION_IM, 0, HOTKEYCODE(HOTKEYF_CONTROL | HOTKEYF_SHIFT, 'S'), TABSRMM_HK_TOGGLESENDLATER }, - - { 0, "tabsrmm_send", LPGEN("Send message"), TABSRMM_HK_SECTION_GENERIC, 0, 0, TABSRMM_HK_SEND }, - { 0, "tabsrmm_hist", LPGEN("Show message history"), TABSRMM_HK_SECTION_GENERIC, 0, HOTKEYCODE(HOTKEYF_ALT, 'H'), TABSRMM_HK_HISTORY }, - { 0, "tabsrmm_sendmenu", LPGEN("Show send menu"), TABSRMM_HK_SECTION_IM, 0, HOTKEYCODE(HOTKEYF_CONTROL, 'S'), TABSRMM_HK_SENDMENU }, - { 0, "tabsrmm_protomenu", LPGEN("Show protocol menu"), TABSRMM_HK_SECTION_IM, 0, HOTKEYCODE(HOTKEYF_CONTROL, 'P'), TABSRMM_HK_PROTOMENU }, - { 0, "tabsrmm_umenu", LPGEN("Show user menu"), TABSRMM_HK_SECTION_IM, 0, HOTKEYCODE(HOTKEYF_ALT, 'D'), TABSRMM_HK_USERMENU }, - { 0, "tabsrmm_udet", LPGEN("Show user details"), TABSRMM_HK_SECTION_IM, 0, HOTKEYCODE(HOTKEYF_ALT, 'U'), TABSRMM_HK_USERDETAILS }, - { 0, "tabsrmm_tbar", LPGEN("Toggle toolbar"), TABSRMM_HK_SECTION_GENERIC, 0, HOTKEYCODE(HOTKEYF_ALT | HOTKEYF_SHIFT, 'T'), TABSRMM_HK_TOGGLETOOLBAR }, - { 0, "tabsrmm_ipanel", LPGEN("Toggle info panel"), TABSRMM_HK_SECTION_GENERIC, 0, HOTKEYCODE(HOTKEYF_ALT | HOTKEYF_CONTROL, 'I'), TABSRMM_HK_TOGGLEINFOPANEL }, - { 0, "tabsrmm_rtl", LPGEN("Toggle text direction"), TABSRMM_HK_SECTION_IM, 0, HOTKEYCODE(HOTKEYF_ALT | HOTKEYF_CONTROL, 'B'), TABSRMM_HK_TOGGLERTL }, - { 0, "tabsrmm_msend", LPGEN("Toggle multi send"), TABSRMM_HK_SECTION_IM, 0, HOTKEYCODE(HOTKEYF_ALT | HOTKEYF_CONTROL, 'M'), TABSRMM_HK_TOGGLEMULTISEND }, - { 0, "tabsrmm_clearlog", LPGEN("Clear message log"), TABSRMM_HK_SECTION_GENERIC, 0, HOTKEYCODE(HOTKEYF_CONTROL, 'L'), TABSRMM_HK_CLEARLOG }, - { 0, "tabsrmm_notes", LPGEN("Edit user notes"), TABSRMM_HK_SECTION_IM, 0, HOTKEYCODE(HOTKEYF_SHIFT | HOTKEYF_CONTROL, 'N'), TABSRMM_HK_EDITNOTES }, - { 0, "tabsrmm_sbar", LPGEN("Collapse side bar"), TABSRMM_HK_SECTION_GENERIC, 0, HOTKEYCODE(0, VK_F9), TABSRMM_HK_TOGGLESIDEBAR }, - { 0, "tabsrmm_muc_cmgr", LPGEN("Channel manager"), TABSRMM_HK_SECTION_GC, 0, HOTKEYCODE(HOTKEYF_SHIFT | HOTKEYF_CONTROL, 'C'), TABSRMM_HK_CHANNELMGR }, - { 0, "tabsrmm_muc_filter", LPGEN("Toggle filter"), TABSRMM_HK_SECTION_GC, 0, HOTKEYCODE(HOTKEYF_SHIFT | HOTKEYF_CONTROL, 'F'), TABSRMM_HK_FILTERTOGGLE }, - { 0, "tabsrmm_muc_nick", LPGEN("Toggle nick list"), TABSRMM_HK_SECTION_GC, 0, HOTKEYCODE(HOTKEYF_SHIFT | HOTKEYF_CONTROL, 'N'), TABSRMM_HK_LISTTOGGLE }, - { 0, "tabsrmm_muc_server_show", LPGEN("Show server window"), TABSRMM_HK_SECTION_GC, 0, HOTKEYCODE(HOTKEYF_SHIFT | HOTKEYF_CONTROL, '1'), TABSRMM_HK_MUC_SHOWSERVER }, - { 0, "tabsrmm_close_other", LPGEN("Close other tabs"), TABSRMM_HK_SECTION_GENERIC, 0, HOTKEYCODE(HOTKEYF_ALT | HOTKEYF_CONTROL, 'W'), TABSRMM_HK_CLOSE_OTHER }, + { "tabsrmm_mostrecent", LPGEN("Most recent unread session"), TABSRMM_HK_SECTION_IM, MS_TABMSG_HOTKEYPROCESS, HOTKEYCODE(HOTKEYF_CONTROL | HOTKEYF_SHIFT, 'R'), TABSRMM_HK_LASTUNREAD }, + { "tabsrmm_paste_and_send", LPGEN("Paste and send"), TABSRMM_HK_SECTION_GENERIC, 0, HOTKEYCODE(HOTKEYF_CONTROL | HOTKEYF_SHIFT, 'D'), TABSRMM_HK_PASTEANDSEND }, + { "tabsrmm_uprefs", LPGEN("Contact's messaging preferences"), TABSRMM_HK_SECTION_IM, 0, HOTKEYCODE(HOTKEYF_CONTROL | HOTKEYF_SHIFT, 'C'), TABSRMM_HK_SETUSERPREFS }, + { "tabsrmm_copts", LPGEN("Container options"), TABSRMM_HK_SECTION_GENERIC, 0, HOTKEYCODE(HOTKEYF_CONTROL, 'O'), TABSRMM_HK_CONTAINEROPTIONS }, + { "tabsrmm_nudge", LPGEN("Send nudge"), TABSRMM_HK_SECTION_IM, 0, HOTKEYCODE(HOTKEYF_CONTROL, 'N'), TABSRMM_HK_NUDGE }, + { "tabsrmm_sendfile", LPGEN("Send a file"), TABSRMM_HK_SECTION_IM, 0, HOTKEYCODE(HOTKEYF_ALT, 'F'), TABSRMM_HK_SENDFILE }, + { "tabsrmm_quote", LPGEN("Quote message"), TABSRMM_HK_SECTION_IM, 0, HOTKEYCODE(HOTKEYF_ALT, 'Q'), TABSRMM_HK_QUOTEMSG }, + { "tabsrmm_sendlater", LPGEN("Toggle send later"), TABSRMM_HK_SECTION_IM, 0, HOTKEYCODE(HOTKEYF_CONTROL | HOTKEYF_SHIFT, 'S'), TABSRMM_HK_TOGGLESENDLATER }, + + { "tabsrmm_send", LPGEN("Send message"), TABSRMM_HK_SECTION_GENERIC, 0, 0, TABSRMM_HK_SEND }, + { "tabsrmm_hist", LPGEN("Show message history"), TABSRMM_HK_SECTION_GENERIC, 0, HOTKEYCODE(HOTKEYF_ALT, 'H'), TABSRMM_HK_HISTORY }, + { "tabsrmm_sendmenu", LPGEN("Show send menu"), TABSRMM_HK_SECTION_IM, 0, HOTKEYCODE(HOTKEYF_CONTROL, 'S'), TABSRMM_HK_SENDMENU }, + { "tabsrmm_protomenu", LPGEN("Show protocol menu"), TABSRMM_HK_SECTION_IM, 0, HOTKEYCODE(HOTKEYF_CONTROL, 'P'), TABSRMM_HK_PROTOMENU }, + { "tabsrmm_umenu", LPGEN("Show user menu"), TABSRMM_HK_SECTION_IM, 0, HOTKEYCODE(HOTKEYF_ALT, 'D'), TABSRMM_HK_USERMENU }, + { "tabsrmm_udet", LPGEN("Show user details"), TABSRMM_HK_SECTION_IM, 0, HOTKEYCODE(HOTKEYF_ALT, 'U'), TABSRMM_HK_USERDETAILS }, + { "tabsrmm_tbar", LPGEN("Toggle toolbar"), TABSRMM_HK_SECTION_GENERIC, 0, HOTKEYCODE(HOTKEYF_ALT | HOTKEYF_SHIFT, 'T'), TABSRMM_HK_TOGGLETOOLBAR }, + { "tabsrmm_ipanel", LPGEN("Toggle info panel"), TABSRMM_HK_SECTION_GENERIC, 0, HOTKEYCODE(HOTKEYF_ALT | HOTKEYF_CONTROL, 'I'), TABSRMM_HK_TOGGLEINFOPANEL }, + { "tabsrmm_rtl", LPGEN("Toggle text direction"), TABSRMM_HK_SECTION_IM, 0, HOTKEYCODE(HOTKEYF_ALT | HOTKEYF_CONTROL, 'B'), TABSRMM_HK_TOGGLERTL }, + { "tabsrmm_msend", LPGEN("Toggle multi send"), TABSRMM_HK_SECTION_IM, 0, HOTKEYCODE(HOTKEYF_ALT | HOTKEYF_CONTROL, 'M'), TABSRMM_HK_TOGGLEMULTISEND }, + { "tabsrmm_clearlog", LPGEN("Clear message log"), TABSRMM_HK_SECTION_GENERIC, 0, HOTKEYCODE(HOTKEYF_CONTROL, 'L'), TABSRMM_HK_CLEARLOG }, + { "tabsrmm_notes", LPGEN("Edit user notes"), TABSRMM_HK_SECTION_IM, 0, HOTKEYCODE(HOTKEYF_SHIFT | HOTKEYF_CONTROL, 'N'), TABSRMM_HK_EDITNOTES }, + { "tabsrmm_sbar", LPGEN("Collapse side bar"), TABSRMM_HK_SECTION_GENERIC, 0, HOTKEYCODE(0, VK_F9), TABSRMM_HK_TOGGLESIDEBAR }, + { "tabsrmm_muc_cmgr", LPGEN("Channel manager"), TABSRMM_HK_SECTION_GC, 0, HOTKEYCODE(HOTKEYF_SHIFT | HOTKEYF_CONTROL, 'C'), TABSRMM_HK_CHANNELMGR }, + { "tabsrmm_muc_filter", LPGEN("Toggle filter"), TABSRMM_HK_SECTION_GC, 0, HOTKEYCODE(HOTKEYF_SHIFT | HOTKEYF_CONTROL, 'F'), TABSRMM_HK_FILTERTOGGLE }, + { "tabsrmm_muc_nick", LPGEN("Toggle nick list"), TABSRMM_HK_SECTION_GC, 0, HOTKEYCODE(HOTKEYF_SHIFT | HOTKEYF_CONTROL, 'N'), TABSRMM_HK_LISTTOGGLE }, + { "tabsrmm_muc_server_show", LPGEN("Show server window"), TABSRMM_HK_SECTION_GC, 0, HOTKEYCODE(HOTKEYF_SHIFT | HOTKEYF_CONTROL, '1'), TABSRMM_HK_MUC_SHOWSERVER }, + { "tabsrmm_close_other", LPGEN("Close other tabs"), TABSRMM_HK_SECTION_GENERIC, 0, HOTKEYCODE(HOTKEYF_ALT | HOTKEYF_CONTROL, 'W'), TABSRMM_HK_CLOSE_OTHER }, }; LRESULT ProcessHotkeysByMsgFilter(const CCtrlBase &pCtrl, UINT msg, WPARAM wParam, LPARAM lParam) @@ -133,10 +133,8 @@ LONG_PTR CALLBACK HotkeyHandlerDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP switch (msg) { case WM_CREATE: - for (int i = 0; i < _countof(_hotkeydescs); i++) { - _hotkeydescs[i].cbSize = sizeof(HOTKEYDESC); + for (int i = 0; i < _countof(_hotkeydescs); i++) Hotkey_Register(&_hotkeydescs[i]); - } WM_TASKBARCREATED = RegisterWindowMessageA("TaskbarCreated"); ShowWindow(hwndDlg, SW_HIDE); diff --git a/plugins/TabSRMM/src/msgdialog.cpp b/plugins/TabSRMM/src/msgdialog.cpp index 3af970f9d9..29b8826dd0 100644 --- a/plugins/TabSRMM/src/msgdialog.cpp +++ b/plugins/TabSRMM/src/msgdialog.cpp @@ -1550,7 +1550,7 @@ int CSrmmWindow::OnFilter(MSGFILTER *pFilter) } if ((msg == WM_KEYDOWN || msg == WM_SYSKEYDOWN) && !(GetKeyState(VK_RMENU) & 0x8000)) { - LRESULT mim_hotkey_check = CallService(MS_HOTKEY_CHECK, (WPARAM)&message, (LPARAM)TABSRMM_HK_SECTION_IM); + LRESULT mim_hotkey_check = Hotkey_Check(&message, TABSRMM_HK_SECTION_IM); if (mim_hotkey_check) m_bkeyProcessed = true; diff --git a/plugins/TrafficCounter/src/TrafficCounter.cpp b/plugins/TrafficCounter/src/TrafficCounter.cpp index 0694b3da0b..f4d9c3c188 100644 --- a/plugins/TrafficCounter/src/TrafficCounter.cpp +++ b/plugins/TrafficCounter/src/TrafficCounter.cpp @@ -275,11 +275,10 @@ int TrafficCounterModulesLoaded(WPARAM, LPARAM) CreateServiceFunction("TrafficCounter/ShowHide", MenuCommand_TrafficShowHide); // Регистрируем горячую клавишу для показа/скрытия фрейма { - HOTKEYDESC hkd = { 0 }; - hkd.cbSize = sizeof(hkd); + HOTKEYDESC hkd = {}; hkd.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL | HOTKEYF_SHIFT, 'T'); - hkd.pszSection = "Traffic Counter"; - hkd.pszDescription = LPGEN("Show/Hide frame"); + hkd.szSection.a = "Traffic Counter"; + hkd.szDescription.a = LPGEN("Show/Hide frame"); hkd.pszName = "TC_Show_Hide"; hkd.pszService = "TrafficCounter/ShowHide"; Hotkey_Register(&hkd); diff --git a/plugins/TranslitSwitcher/src/TranslitSwitcher.cpp b/plugins/TranslitSwitcher/src/TranslitSwitcher.cpp index 21bdd2b69e..5f529e3837 100644 --- a/plugins/TranslitSwitcher/src/TranslitSwitcher.cpp +++ b/plugins/TranslitSwitcher/src/TranslitSwitcher.cpp @@ -120,43 +120,43 @@ extern "C" __declspec(dllexport) int Load(void) HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoaded); - HOTKEYDESC hkd = { sizeof(hkd) }; + HOTKEYDESC hkd = {}; hkd.dwFlags = HKD_UNICODE; hkd.pszName = "TranslitSwitcher/ConvertAllOrSelected"; - hkd.pwszDescription = LPGENW("Convert All / Selected"); - hkd.pwszSection = L"TranslitSwitcher"; + hkd.szDescription.w = LPGENW("Convert All / Selected"); + hkd.szSection.w = L"TranslitSwitcher"; hkd.pszService = MS_TS_SWITCHLAYOUT; hkd.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL + HKCOMB_A, 'R') | HKF_MIRANDA_LOCAL; Hotkey_Register(&hkd); hkd.pszName = "TranslitSwitcher/ConvertLastOrSelected"; - hkd.pwszDescription = LPGENW("Convert Last / Selected"); + hkd.szDescription.w = LPGENW("Convert Last / Selected"); hkd.DefHotKey = HOTKEYCODE(HOTKEYF_ALT + HKCOMB_A, 'R') | HKF_MIRANDA_LOCAL; hkd.lParam = true; Hotkey_Register(&hkd); hkd.pszName = "TranslitSwitcher/TranslitAllOrSelected"; - hkd.pwszDescription = LPGENW("Translit All / Selected"); + hkd.szDescription.w = LPGENW("Translit All / Selected"); hkd.pszService = MS_TS_TRANSLITLAYOUT; hkd.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL + HKCOMB_A, 'T') | HKF_MIRANDA_LOCAL; hkd.lParam = false; Hotkey_Register(&hkd); hkd.pszName = "TranslitSwitcher/TranslitLastOrSelected"; - hkd.pwszDescription = LPGENW("Translit Last / Selected"); + hkd.szDescription.w = LPGENW("Translit Last / Selected"); hkd.DefHotKey = HOTKEYCODE(HOTKEYF_ALT + HKCOMB_A, 'T') | HKF_MIRANDA_LOCAL; hkd.lParam = true; Hotkey_Register(&hkd); hkd.pszName = "TranslitSwitcher/InvertCaseAllOrSelected"; - hkd.pwszDescription = LPGENW("Invert Case All / Selected"); + hkd.szDescription.w = LPGENW("Invert Case All / Selected"); hkd.pszService = MS_TS_INVERTCASE; hkd.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL + HKCOMB_A, 'Y') | HKF_MIRANDA_LOCAL; hkd.lParam = false; Hotkey_Register(&hkd); hkd.pszName = "TranslitSwitcher/InvertCaseLastOrSelected"; - hkd.pwszDescription = LPGENW("Invert Case Last / Selected"); + hkd.szDescription.w = LPGENW("Invert Case Last / Selected"); hkd.DefHotKey = HOTKEYCODE(HOTKEYF_ALT + HKCOMB_A, 'Y') | HKF_MIRANDA_LOCAL; hkd.lParam = true; Hotkey_Register(&hkd); diff --git a/plugins/UserInfoEx/src/dlg_anniversarylist.cpp b/plugins/UserInfoEx/src/dlg_anniversarylist.cpp index c1e2392f04..f999611d19 100644 --- a/plugins/UserInfoEx/src/dlg_anniversarylist.cpp +++ b/plugins/UserInfoEx/src/dlg_anniversarylist.cpp @@ -977,11 +977,10 @@ void DlgAnniversaryListLoadModule() { CreateServiceFunction(MS_USERINFO_REMINDER_LIST, DlgAnniversaryListShow); - HOTKEYDESC hk = { 0 }; - hk.cbSize = sizeof(HOTKEYDESC); - hk.pszSection = MODNAME; + HOTKEYDESC hk = {}; hk.pszName = "AnniversaryList"; - hk.pszDescription = LPGEN("Popup anniversary list"); + hk.szSection.a = MODNAME; + hk.szDescription.a = LPGEN("Popup anniversary list"); hk.pszService = MS_USERINFO_REMINDER_LIST; Hotkey_Register(&hk); } diff --git a/plugins/UserInfoEx/src/svc_refreshci.cpp b/plugins/UserInfoEx/src/svc_refreshci.cpp index f9b4da5021..4b26516ad1 100644 --- a/plugins/UserInfoEx/src/svc_refreshci.cpp +++ b/plugins/UserInfoEx/src/svc_refreshci.cpp @@ -875,11 +875,10 @@ void SvcRefreshContactInfoLoadModule(void) HookEvent(ME_SYSTEM_PRESHUTDOWN, OnPreShutdown); HookEvent(ME_DB_CONTACT_ADDED, OnContactAdded); - HOTKEYDESC hk = { 0 }; - hk.cbSize = sizeof(HOTKEYDESC); - hk.pszSection = MODNAME; + HOTKEYDESC hk = {}; hk.pszName = "RefreshContactDetails"; - hk.pszDescription = LPGEN("Refresh contact details"); + hk.szSection.a = MODNAME; + hk.szDescription.a = LPGEN("Refresh contact details"); hk.pszService = MS_USERINFO_REFRESH; Hotkey_Register(&hk); } diff --git a/plugins/UserInfoEx/src/svc_reminder.cpp b/plugins/UserInfoEx/src/svc_reminder.cpp index 83f3c91491..ffaa8b8a0b 100644 --- a/plugins/UserInfoEx/src/svc_reminder.cpp +++ b/plugins/UserInfoEx/src/svc_reminder.cpp @@ -917,11 +917,10 @@ void SvcReminderLoadModule(void) CreateServiceFunction(MS_USERINFO_REMINDER_AGGRASIVEBACKUP, BackupBirthdayService); // register hotkey - HOTKEYDESC hk = { 0 }; - hk.cbSize = sizeof(HOTKEYDESC); - hk.pszSection = MODNAME; + HOTKEYDESC hk = {}; hk.pszName = "ReminderCheck"; - hk.pszDescription = LPGEN("Check anniversaries"); + hk.szSection.a = MODNAME; + hk.szDescription.a = LPGEN("Check anniversaries"); hk.pszService = MS_USERINFO_REMINDER_CHECK; Hotkey_Register(&hk); diff --git a/plugins/Watrack/popup/popups.pas b/plugins/Watrack/popup/popups.pas index 026f03e82b..8e7782de69 100644 --- a/plugins/Watrack/popup/popups.pas +++ b/plugins/Watrack/popup/popups.pas @@ -297,14 +297,13 @@ begin FillChar(hkrec,SizeOf(hkrec),0); with hkrec do begin - cbSize :=SizeOf(hkrec); pszName :=HKN_POPUP; pszDescription.a:='WATrack popup hotkey'; pszSection.a :=PluginName; pszService :=MS_WAT_SHOWMUSICINFO; DefHotKey:=((HOTKEYF_ALT or HOTKEYF_CONTROL) shl 8) or VK_F7 or HKF_MIRANDA_LOCAL; end; - CallService(MS_HOTKEY_REGISTER,0,lparam(@hkrec)); + Hotkey_Register(@hkrec); end; {$include pop_dlg.inc} diff --git a/plugins/Watrack/status/status.pas b/plugins/Watrack/status/status.pas index 81c1f20d9a..101c2dcf8b 100644 --- a/plugins/Watrack/status/status.pas +++ b/plugins/Watrack/status/status.pas @@ -24,7 +24,6 @@ begin FillChar(hkrec,SizeOf(hkrec),0); with hkrec do begin - cbSize :=SizeOf(hkrec); pszName :=HKN_INSERT; pszDescription.a:='Global WATrack hotkey'; pszSection.a :=PluginName; @@ -32,7 +31,7 @@ begin DefHotKey :=((HOTKEYF_ALT or HOTKEYF_CONTROL) shl 8) or VK_F5; // lParam :=0; end; - CallService(MS_HOTKEY_REGISTER,0,lparam(@hkrec)); + Hotkey_Register(@hkrec); end; {$include i_st_vars.inc} diff --git a/plugins/Watrack/templates/i_expkey.inc b/plugins/Watrack/templates/i_expkey.inc index fd990cda31..c8e589609f 100644 --- a/plugins/Watrack/templates/i_expkey.inc +++ b/plugins/Watrack/templates/i_expkey.inc @@ -22,13 +22,11 @@ begin FillChar(hkrec,SizeOf(hkrec),0); with hkrec do begin - cbSize :=SizeOf(hkrec); pszName :=HKN_EXPORT; pszDescription.a:='WATrack data insert hotkey'; pszSection.a :=PluginName; pszService :=MS_WAT_EXPORT; DefHotKey :=((HOTKEYF_ALT or HOTKEYF_SHIFT) shl 8) or VK_F7; -// lParam :=0; end; - CallService(MS_HOTKEY_REGISTER,0,lparam(@hkrec)); + Hotkey_Register(@hkrec); end; diff --git a/plugins/WhenWasIt/src/WhenWasIt.cpp b/plugins/WhenWasIt/src/WhenWasIt.cpp index b97c5dda1f..f6fd93f05f 100644 --- a/plugins/WhenWasIt/src/WhenWasIt.cpp +++ b/plugins/WhenWasIt/src/WhenWasIt.cpp @@ -118,16 +118,16 @@ extern "C" int __declspec(dllexport) Load(void) Menu_AddContactMenuItem(&mi); // Register hotkeys - HOTKEYDESC hotkey = { sizeof(hotkey) }; - hotkey.pszSection = LPGEN("Birthdays"); + HOTKEYDESC hotkey = {}; + hotkey.szSection.a = LPGEN("Birthdays"); hotkey.pszName = "wwi_birthday_list"; - hotkey.pszDescription = LPGEN("Birthday list"); + hotkey.szDescription.a = LPGEN("Birthday list"); hotkey.pszService = MS_WWI_LIST_SHOW; Hotkey_Register(&hotkey); hotkey.pszName = "wwi_check_birthdays"; - hotkey.pszDescription = LPGEN("Check for birthdays"); + hotkey.szDescription.a = LPGEN("Check for birthdays"); hotkey.pszService = MS_WWI_CHECK_BIRTHDAYS; Hotkey_Register(&hotkey); diff --git a/plugins/YAMN/src/main.cpp b/plugins/YAMN/src/main.cpp index 33498fe920..d13f61a6ba 100644 --- a/plugins/YAMN/src/main.cpp +++ b/plugins/YAMN/src/main.cpp @@ -332,12 +332,11 @@ extern "C" int __declspec(dllexport) Load(void) LoadIcons(); LoadPlugins(); - HOTKEYDESC hkd = {0}; - hkd.cbSize = sizeof(hkd); + HOTKEYDESC hkd = {}; hkd.pszName = "YAMN_hotkey"; hkd.pszService = MS_YAMN_FORCECHECK; - hkd.pszSection = YAMN_DBMODULE; - hkd.pszDescription = LPGEN("Check mail"); + hkd.szSection.a = YAMN_DBMODULE; + hkd.szDescription.a = LPGEN("Check mail"); hkd.DefHotKey = HOTKEYCODE(HOTKEYF_CONTROL, VK_F11); Hotkey_Register(&hkd); diff --git a/plugins/mRadio/i_hotkey.inc b/plugins/mRadio/i_hotkey.inc index 9797b61f1c..d3f739d844 100644 --- a/plugins/mRadio/i_hotkey.inc +++ b/plugins/mRadio/i_hotkey.inc @@ -30,7 +30,6 @@ begin FillChar(hkrec,SizeOf(hkrec),0); - hkrec.cbSize := SizeOf(hkrec); hkrec.pszSection.a := PluginName; hkrec.pszService := MS_RADIO_HOTKEY; @@ -38,25 +37,25 @@ begin hkrec.pszName := HKN_PLAYPAUSE; hkrec.pszDescription.a:= 'Play/Pause'; hkrec.lParam := MRC_PAUSE; - CallService(MS_HOTKEY_REGISTER,0,lparam(@hkrec)); + Hotkey_Register(@hkrec); hkrec.DefHotKey := DefRadioKeyStop; hkrec.pszName := HKN_STOP; hkrec.pszDescription.a:= 'Stop'; hkrec.lParam := MRC_STOP; - CallService(MS_HOTKEY_REGISTER,0,lparam(@hkrec)); + Hotkey_Register(@hkrec); hkrec.DefHotKey := DefRadioKeyMute; hkrec.pszName := HKN_MUTE; hkrec.pszDescription.a:= 'Mute'; hkrec.lParam := MRC_MUTE; - CallService(MS_HOTKEY_REGISTER,0,lparam(@hkrec)); + Hotkey_Register(@hkrec); hkrec.DefHotKey := DefRadioKeyRecord; hkrec.pszName := HKN_RECORD; hkrec.pszDescription.a:= 'Start/Stop Record'; hkrec.lParam := MRC_RECORD; - CallService(MS_HOTKEY_REGISTER,0,lparam(@hkrec)); + Hotkey_Register(@hkrec); end; procedure UnregisterHotKey; -- cgit v1.2.3