From 5f3e1a04da3f45067435a321b17e25ef0445e66a Mon Sep 17 00:00:00 2001 From: George Hazan Date: Wed, 17 Apr 2024 12:58:57 +0300 Subject: code cleaing --- protocols/Dummy/src/dummy_options.cpp | 4 +-- protocols/Dummy/src/dummy_proto.cpp | 58 ++++++++++++++++++++--------------- protocols/Dummy/src/stdafx.h | 2 ++ 3 files changed, 37 insertions(+), 27 deletions(-) (limited to 'protocols/Dummy/src') diff --git a/protocols/Dummy/src/dummy_options.cpp b/protocols/Dummy/src/dummy_options.cpp index 807ea84bb7..d1d7175905 100644 --- a/protocols/Dummy/src/dummy_options.cpp +++ b/protocols/Dummy/src/dummy_options.cpp @@ -33,9 +33,7 @@ INT_PTR CALLBACK DummyAccountProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM Window_SetIcon_IcoLib(hwndDlg, ppro->m_hProtoIcon); { - SendDlgItemMessageA(hwndDlg, IDC_TEMPLATE, CB_INSERTSTRING, 0, reinterpret_cast(Translate(templates[0].name))); - for (size_t i = 1; templates[i].name != 0; i++) - SendDlgItemMessageA(hwndDlg, IDC_TEMPLATE, CB_INSERTSTRING, i, reinterpret_cast(templates[i].name)); + FillTemplateCombo(hwndDlg, IDC_TEMPLATE); int templateId = ppro->getTemplateId(); SendDlgItemMessage(hwndDlg, IDC_TEMPLATE, CB_SETCURSEL, templateId, 0); diff --git a/protocols/Dummy/src/dummy_proto.cpp b/protocols/Dummy/src/dummy_proto.cpp index 27d2858600..a6f8c58d6d 100644 --- a/protocols/Dummy/src/dummy_proto.cpp +++ b/protocols/Dummy/src/dummy_proto.cpp @@ -24,32 +24,40 @@ const ttemplate templates[] = #ifndef MIRANDA_VERSION_ISALPHA { "Discord", "id", LPGEN("Discord ID") }, #endif - { "EmLAN", "Nick", LPGEN("User name") }, - { "Facebook", "ID", LPGEN("Facebook ID") }, - { "GG", "UIN", LPGEN("Gadu-Gadu number") }, - { "ICQ", "UIN", LPGEN("User ID") }, - { "ICQCorp", "UIN", LPGEN("ICQ number") }, - { "IRC", "Nick", LPGEN("Nickname") }, - { "Jabber", "jid", LPGEN("JID") }, - { "MinecraftDynmap", "Nick", LPGEN("Visible name") }, - { "MRA", "e-mail", LPGEN("E-mail address") }, - { "MSN", "wlid", LPGEN("Live ID") }, - { "Omegle", "nick", LPGEN("Visible name") }, - { "Sametime", "stid", LPGEN("ID") }, - { "Skype (SkypeKit)", "sid", LPGEN("Skype name") }, - { "Skype (Classic)", "Username", LPGEN("Skype name") }, - { "Skype (Web)", "Username", LPGEN("Skype name") }, - { "Steam", "SteamID", LPGEN("Steam ID") }, - { "Tlen", "jid", LPGEN("Tlen login") }, - { "Tox", "ToxID", LPGEN("Tox ID") }, - { "Twitter", "Username", LPGEN("Username") }, - { "VK", "ID", LPGEN("VKontakte ID") }, - { "WhatsApp", "ID", LPGEN("WhatsApp ID") }, - { "XFire", "Username", LPGEN("Username") }, - { "Yahoo", "yahoo_id", LPGEN("ID") }, - { 0, 0, 0 } + { "EmLAN", "Nick", LPGEN("User name") }, + { "Facebook", "ID", LPGEN("Facebook ID") }, + { "GG", "UIN", LPGEN("Gadu-Gadu number") }, + { "ICQ", "UIN", LPGEN("User ID") }, + { "ICQCorp", "UIN", LPGEN("ICQ number") }, + { "IRC", "Nick", LPGEN("Nickname") }, + { "Jabber", "jid", LPGEN("JID") }, + { "MinecraftDynmap", "Nick", LPGEN("Visible name") }, + { "MRA", "e-mail", LPGEN("E-mail address") }, + { "MSN", "wlid", LPGEN("Live ID") }, + { "Omegle", "nick", LPGEN("Visible name") }, + { "Sametime", "stid", LPGEN("ID") }, + { "Skype (SkypeKit)", "sid", LPGEN("Skype name") }, + { "Skype (Classic)", "Username", LPGEN("Skype name") }, + { "Skype (Web)", "Username", LPGEN("Skype name") }, + { "Steam", "SteamID", LPGEN("Steam ID") }, + { "Tlen", "jid", LPGEN("Tlen login") }, + { "Tox", "ToxID", LPGEN("Tox ID") }, + { "Twitter", "Username", LPGEN("Username") }, + { "VK", "ID", LPGEN("VKontakte ID") }, + { "WhatsApp", "ID", LPGEN("WhatsApp ID") }, + { "XFire", "Username", LPGEN("Username") }, + { "Yahoo", "yahoo_id", LPGEN("ID") }, + { "Telegram", "id", LPGEN("Telegram ID") }, }; +void FillTemplateCombo(HWND hwndDlg, int iCtrlId) +{ + for (auto &it : templates) { + int i = &it - templates; + SendDlgItemMessageA(hwndDlg, iCtrlId, CB_INSERTSTRING, i, LPARAM(i == 0 ? Translate(it.name) : it.name)); + } +} + void CDummyProto::SearchIdAckThread(void *targ) { PROTOSEARCHRESULT psr = { 0 }; @@ -63,6 +71,8 @@ void CDummyProto::SearchIdAckThread(void *targ) mir_free(targ); } +///////////////////////////////////////////////////////////////////////////////////////// + static int sttCompareProtocols(const CDummyProto *p1, const CDummyProto *p2) { return mir_wstrcmp(p1->m_tszUserName, p2->m_tszUserName); diff --git a/protocols/Dummy/src/stdafx.h b/protocols/Dummy/src/stdafx.h index 17db5c82d4..4dd662c2db 100644 --- a/protocols/Dummy/src/stdafx.h +++ b/protocols/Dummy/src/stdafx.h @@ -59,3 +59,5 @@ along with this program. If not, see . #include "resource.h" #include "dummy.h" #include "dummy_proto.h" + +void FillTemplateCombo(HWND hwndDlg, int iCtrlId); -- cgit v1.2.3