From 106cab98d0aa170af4c96a34f4886597ec0496a6 Mon Sep 17 00:00:00 2001 From: aunsane Date: Sat, 3 Feb 2018 20:12:34 +0300 Subject: Steam: added polling error limit setting --- protocols/Steam/src/resource.h | 6 ++++-- protocols/Steam/src/stdafx.h | 2 ++ protocols/Steam/src/steam_options.cpp | 23 +++++++++++++++-------- protocols/Steam/src/steam_options.h | 3 +++ protocols/Steam/src/steam_polling.cpp | 4 +--- 5 files changed, 25 insertions(+), 13 deletions(-) (limited to 'protocols/Steam/src') diff --git a/protocols/Steam/src/resource.h b/protocols/Steam/src/resource.h index fa9145b922..db1260e482 100644 --- a/protocols/Steam/src/resource.h +++ b/protocols/Steam/src/resource.h @@ -32,6 +32,8 @@ #define IDC_BM_LIST 1064 #define IDC_LIST 1065 #define IDC_TEXT 1082 +#define IDC_POLLINGERRORLIMIT 1085 +#define IDC_POLLINGERRORLIMITSPIN 1086 #define IDC_OPENDOMAIN 1200 #define IDC_GETDOMAIN 1200 @@ -39,9 +41,9 @@ // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS -#define _APS_NEXT_RESOURCE_VALUE 125 +#define _APS_NEXT_RESOURCE_VALUE 126 #define _APS_NEXT_COMMAND_VALUE 40001 -#define _APS_NEXT_CONTROL_VALUE 1085 +#define _APS_NEXT_CONTROL_VALUE 1087 #define _APS_NEXT_SYMED_VALUE 101 #endif #endif diff --git a/protocols/Steam/src/stdafx.h b/protocols/Steam/src/stdafx.h index bf171853c9..8e1320dd22 100644 --- a/protocols/Steam/src/stdafx.h +++ b/protocols/Steam/src/stdafx.h @@ -45,6 +45,8 @@ #define STEAM_API_IDLEOUT_AWAY 600 #define STEAM_API_IDLEOUT_SNOOZE 8000 +#define STEAM_API_POLLING_ERRORS_LIMIT 5 + class CSteamProto; extern HINSTANCE g_hInstance; diff --git a/protocols/Steam/src/steam_options.cpp b/protocols/Steam/src/steam_options.cpp index 405b15e787..f28648c69b 100644 --- a/protocols/Steam/src/steam_options.cpp +++ b/protocols/Steam/src/steam_options.cpp @@ -3,15 +3,20 @@ CSteamOptionsMain::CSteamOptionsMain(CSteamProto *proto, int idDialog, HWND hwndParent) : CSteamDlgBase(proto, idDialog, false), m_username(this, IDC_USERNAME), m_password(this, IDC_PASSWORD), - m_group(this, IDC_GROUP), m_biggerAvatars(this, IDC_BIGGER_AVATARS), m_showChatEvents(this, IDC_SHOW_CHAT_EVENTS) + m_group(this, IDC_GROUP), m_biggerAvatars(this, IDC_BIGGER_AVATARS), m_showChatEvents(this, IDC_SHOW_CHAT_EVENTS), + m_pollingErrorLimit(this, IDC_POLLINGERRORLIMIT), m_pollingErrorLimitSpin(this, IDC_POLLINGERRORLIMITSPIN) { SetParent(hwndParent); CreateLink(m_username, "Username", L""); CreateLink(m_password, "Password", L""); CreateLink(m_group, "DefaultGroup", L"Steam"); - CreateLink(m_biggerAvatars, "UseBigAvatars", DBVT_BYTE, FALSE); - CreateLink(m_showChatEvents, "ShowChatEvents", DBVT_BYTE, TRUE); + + if (idDialog == IDD_OPT_MAIN) { + CreateLink(m_biggerAvatars, "UseBigAvatars", DBVT_BYTE, FALSE); + CreateLink(m_showChatEvents, "ShowChatEvents", DBVT_BYTE, TRUE); + CreateLink(m_pollingErrorLimit, "PollingErrorsLimit", DBVT_BYTE, STEAM_API_POLLING_ERRORS_LIMIT); + } } void CSteamOptionsMain::OnInitDialog() @@ -21,6 +26,9 @@ void CSteamOptionsMain::OnInitDialog() SendMessage(m_username.GetHwnd(), EM_LIMITTEXT, 64, 0); SendMessage(m_password.GetHwnd(), EM_LIMITTEXT, 64, 0); SendMessage(m_group.GetHwnd(), EM_LIMITTEXT, 64, 0); + + m_pollingErrorLimitSpin.SetRange(255, 1); + m_pollingErrorLimitSpin.SetPosition(m_proto->getByte("PollingErrorsLimit", STEAM_API_POLLING_ERRORS_LIMIT)); } void CSteamOptionsMain::OnApply() @@ -30,7 +38,6 @@ void CSteamOptionsMain::OnApply() m_proto->m_defaultGroup = mir_wstrdup(group); Clist_GroupCreate(0, group); } - if (m_proto->IsOnline()) // may be we should show message box with warning? m_proto->SetStatus(ID_STATUS_OFFLINE); @@ -40,7 +47,6 @@ void CSteamOptionsMain::OnApply() } if (m_password.IsChanged()) m_proto->delSetting("TokenSecret"); - mir_free(group); } ///////////////////////////////////////////////////////////////////////////////// @@ -80,8 +86,9 @@ int CSteamProto::OnOptionsInit(WPARAM wParam, LPARAM) odp.pDialog = CSteamOptionsMain::CreateOptionsPage(this); Options_AddPage(wParam, &odp); - odp.szTab.w = LPGENW("Blocked contacts"); - odp.pDialog = CSteamOptionsBlockList::CreateOptionsPage(this); - Options_AddPage(wParam, &odp); + //odp.szTab.w = LPGENW("Blocked contacts"); + //odp.pDialog = CSteamOptionsBlockList::CreateOptionsPage(this); + //Options_AddPage(wParam, &odp); + return 0; } \ No newline at end of file diff --git a/protocols/Steam/src/steam_options.h b/protocols/Steam/src/steam_options.h index 5aca344e28..388bf2c70a 100644 --- a/protocols/Steam/src/steam_options.h +++ b/protocols/Steam/src/steam_options.h @@ -11,6 +11,9 @@ private: CCtrlCheck m_biggerAvatars; CCtrlCheck m_showChatEvents; + CCtrlEdit m_pollingErrorLimit; + CCtrlSpin m_pollingErrorLimitSpin; + protected: CSteamOptionsMain(CSteamProto *proto, int idDialog, HWND hwndParent = NULL); diff --git a/protocols/Steam/src/steam_polling.cpp b/protocols/Steam/src/steam_polling.cpp index e812e8e87f..b5d27b9c37 100644 --- a/protocols/Steam/src/steam_polling.cpp +++ b/protocols/Steam/src/steam_polling.cpp @@ -1,7 +1,5 @@ #include "stdafx.h" -#define POLLING_ERRORS_LIMIT 5 - void CSteamProto::ParsePollData(const JSONNode &data) { std::string steamIds; @@ -221,7 +219,7 @@ void CSteamProto::PollingThread(void*) PollParam param; param.errors = 0; - param.errorsLimit = getByte("PollingErrorsLimit", POLLING_ERRORS_LIMIT); + param.errorsLimit = getByte("PollingErrorsLimit", STEAM_API_POLLING_ERRORS_LIMIT); while (IsOnline() && param.errors < param.errorsLimit) { // request->nlc = m_pollingConnection; ptrA umqId(getStringA("UMQID")); -- cgit v1.2.3