Skip to content

Commit

Permalink
code cleaing
Browse files Browse the repository at this point in the history
  • Loading branch information
georgehazan committed Apr 17, 2024
1 parent f15a631 commit 5f3e1a0
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 27 deletions.
4 changes: 1 addition & 3 deletions protocols/Dummy/src/dummy_options.cpp
Expand Up @@ -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<LPARAM>(Translate(templates[0].name)));
for (size_t i = 1; templates[i].name != 0; i++)
SendDlgItemMessageA(hwndDlg, IDC_TEMPLATE, CB_INSERTSTRING, i, reinterpret_cast<LPARAM>(templates[i].name));
FillTemplateCombo(hwndDlg, IDC_TEMPLATE);

int templateId = ppro->getTemplateId();
SendDlgItemMessage(hwndDlg, IDC_TEMPLATE, CB_SETCURSEL, templateId, 0);
Expand Down
58 changes: 34 additions & 24 deletions protocols/Dummy/src/dummy_proto.cpp
Expand Up @@ -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 };
Expand All @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions protocols/Dummy/src/stdafx.h
Expand Up @@ -59,3 +59,5 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "resource.h"
#include "dummy.h"
#include "dummy_proto.h"

void FillTemplateCombo(HWND hwndDlg, int iCtrlId);

1 comment on commit 5f3e1a0

@georgehazan
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

occasionally fixes #4358

Please sign in to comment.