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/res/Resource.rc | 26 ++++++++++++++++++-------- 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 +--- 6 files changed, 43 insertions(+), 21 deletions(-) diff --git a/protocols/Steam/res/Resource.rc b/protocols/Steam/res/Resource.rc index e5d99ce616..913e4b4a32 100644 --- a/protocols/Steam/res/Resource.rc +++ b/protocols/Steam/res/Resource.rc @@ -101,17 +101,21 @@ EXSTYLE WS_EX_CONTROLPARENT FONT 8, "MS Shell Dlg", 0, 0, 0x1 BEGIN GROUPBOX "Account",IDC_STATIC,7,7,291,44 - LTEXT "Username:",IDC_STATIC,15,19,69,8 - EDITTEXT IDC_USERNAME,90,17,201,13,ES_AUTOHSCROLL - LTEXT "Password:",IDC_STATIC,15,35,69,8 - EDITTEXT IDC_PASSWORD,90,33,201,13,ES_PASSWORD | ES_AUTOHSCROLL + LTEXT "Username:",IDC_STATIC,15,19,81,8 + EDITTEXT IDC_USERNAME,102,17,189,13,ES_AUTOHSCROLL + LTEXT "Password:",IDC_STATIC,15,35,81,8 + EDITTEXT IDC_PASSWORD,102,33,189,13,ES_PASSWORD | ES_AUTOHSCROLL GROUPBOX "Contacts",IDC_STATIC,7,57,291,50 - LTEXT "Default group:",IDC_STATIC,15,71,69,8 - EDITTEXT IDC_GROUP,90,69,201,14,ES_AUTOHSCROLL + LTEXT "Default group:",IDC_STATIC,15,71,81,8 + EDITTEXT IDC_GROUP,102,69,189,14,ES_AUTOHSCROLL CONTROL "Use bigger avatars",IDC_BIGGER_AVATARS,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,17,90,271,10 GROUPBOX "Message sessions",IDC_STATIC,7,115,291,32 CONTROL "Show chat state events (i.e., user closed chat session)",IDC_SHOW_CHAT_EVENTS, "Button",BS_AUTOCHECKBOX | WS_TABSTOP,15,129,271,10 + GROUPBOX "Connection",IDC_STATIC,7,155,291,68 + LTEXT "Error limit before logout:",IDC_STATIC,15,167,81,8 + EDITTEXT IDC_POLLINGERRORLIMIT,102,166,60,14,ES_AUTOHSCROLL | ES_NUMBER + CONTROL "",IDC_POLLINGERRORLIMITSPIN,"msctls_updown32",UDS_SETBUDDYINT | UDS_ALIGNRIGHT | UDS_AUTOBUDDY | UDS_ARROWKEYS | UDS_NOTHOUSANDS | UDS_HOTTRACK,152,166,10,14 END IDD_CAPTCHA DIALOGEX 0, 0, 143, 81 @@ -196,8 +200,9 @@ BEGIN BEGIN LEFTMARGIN, 7 VERTGUIDE, 15 - VERTGUIDE, 84 - VERTGUIDE, 90 + VERTGUIDE, 96 + VERTGUIDE, 102 + VERTGUIDE, 162 VERTGUIDE, 291 VERTGUIDE, 298 TOPMARGIN, 7 @@ -268,6 +273,11 @@ BEGIN 0 END +IDD_OPT_MAIN AFX_DIALOG_LAYOUT +BEGIN + 0 +END + #endif // English resources ///////////////////////////////////////////////////////////////////////////// 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