summaryrefslogtreecommitdiff
path: root/protocols/Gadu-Gadu
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2022-11-15 19:19:40 +0300
committerGeorge Hazan <ghazan@miranda.im>2022-11-15 19:19:40 +0300
commit7fc3edada208ae690149378c457aaf3adebdaad7 (patch)
tree6729052cf673bc45140b62df9e3a21bd78f53d3a /protocols/Gadu-Gadu
parentd765fdf96860559ed40914c23006f28d011b9fa5 (diff)
fixes #3213 (GG: we should treat empty list as non-existent)
Diffstat (limited to 'protocols/Gadu-Gadu')
-rw-r--r--protocols/Gadu-Gadu/gadugadu.vcxproj1
-rw-r--r--protocols/Gadu-Gadu/gadugadu.vcxproj.filters3
-rw-r--r--protocols/Gadu-Gadu/src/avatar.cpp26
-rw-r--r--protocols/Gadu-Gadu/src/core.cpp18
-rw-r--r--protocols/Gadu-Gadu/src/dialogs.cpp317
-rw-r--r--protocols/Gadu-Gadu/src/filetransfer.cpp4
-rw-r--r--protocols/Gadu-Gadu/src/gg.cpp6
-rw-r--r--protocols/Gadu-Gadu/src/gg.h5
-rw-r--r--protocols/Gadu-Gadu/src/gg_proto.cpp17
-rw-r--r--protocols/Gadu-Gadu/src/gg_proto.h19
-rw-r--r--protocols/Gadu-Gadu/src/keepalive.cpp2
-rw-r--r--protocols/Gadu-Gadu/src/options.cpp652
-rw-r--r--protocols/Gadu-Gadu/src/options.h81
-rw-r--r--protocols/Gadu-Gadu/src/userutils.cpp2
14 files changed, 569 insertions, 584 deletions
diff --git a/protocols/Gadu-Gadu/gadugadu.vcxproj b/protocols/Gadu-Gadu/gadugadu.vcxproj
index 151560ca4c..dc2e58ea69 100644
--- a/protocols/Gadu-Gadu/gadugadu.vcxproj
+++ b/protocols/Gadu-Gadu/gadugadu.vcxproj
@@ -117,7 +117,6 @@
<ClInclude Include="src\libgadu\resolver.h" />
<ClInclude Include="src\libgadu\session.h" />
<ClInclude Include="src\libgadu\win32.h" />
- <ClInclude Include="src\options.h" />
<ClInclude Include="src\resource.h" />
<ClInclude Include="src\version.h" />
</ItemGroup>
diff --git a/protocols/Gadu-Gadu/gadugadu.vcxproj.filters b/protocols/Gadu-Gadu/gadugadu.vcxproj.filters
index 9caf9ef813..e7a60dff41 100644
--- a/protocols/Gadu-Gadu/gadugadu.vcxproj.filters
+++ b/protocols/Gadu-Gadu/gadugadu.vcxproj.filters
@@ -188,9 +188,6 @@
<ClInclude Include="src\gg_proto.h">
<Filter>Header Files</Filter>
</ClInclude>
- <ClInclude Include="src\options.h">
- <Filter>Header Files</Filter>
- </ClInclude>
<ClInclude Include="src\resource.h">
<Filter>Header Files</Filter>
</ClInclude>
diff --git a/protocols/Gadu-Gadu/src/avatar.cpp b/protocols/Gadu-Gadu/src/avatar.cpp
index d0f72df6cd..6f77e19f90 100644
--- a/protocols/Gadu-Gadu/src/avatar.cpp
+++ b/protocols/Gadu-Gadu/src/avatar.cpp
@@ -427,22 +427,24 @@ void __cdecl GaduProto::setavatarthread(void *param)
// send request
int resultSuccess = 0;
int needRepeat = 0;
- NLHR_PTR resp(Netlib_HttpTransaction(m_hNetlibUser, &req));
- if (resp) {
- if (resp->resultCode == 200 && resp->dataLength > 0 && resp->pData) {
- debugLogA("setavatarthread(): 1 resp.data= %s", resp->pData);
- resultSuccess = 1;
+ {
+ NLHR_PTR resp(Netlib_HttpTransaction(m_hNetlibUser, &req));
+ if (resp) {
+ if (resp->resultCode == 200 && resp->dataLength > 0 && resp->pData) {
+ debugLogA("setavatarthread(): 1 resp.data= %s", resp->pData);
+ resultSuccess = 1;
+ }
+ else {
+ debugLogA("setavatarthread() Invalid response code from HTTP request [%d]", resp->resultCode);
+ if (resp->resultCode == 399 || resp->resultCode == 403 || resp->resultCode == 401) {
+ needRepeat = 1;
+ }
+ }
}
else {
- debugLogA("setavatarthread() Invalid response code from HTTP request [%d]", resp->resultCode);
- if (resp->resultCode == 399 || resp->resultCode == 403 || resp->resultCode == 401) {
- needRepeat = 1;
- }
+ debugLogA("setavatarthread(): No response from HTTP request");
}
}
- else {
- debugLogA("setavatarthread(): No response from HTTP request");
- }
// check if we should repeat request
if (needRepeat) {
diff --git a/protocols/Gadu-Gadu/src/core.cpp b/protocols/Gadu-Gadu/src/core.cpp
index 920a6e2877..f1daddfbd4 100644
--- a/protocols/Gadu-Gadu/src/core.cpp
+++ b/protocols/Gadu-Gadu/src/core.cpp
@@ -299,8 +299,8 @@ void __cdecl GaduProto::mainthread(void *)
int hostcount = 0;
GGHOST hosts[64];
- if (m_gaduOptions.useManualHosts) {
- CMStringW serverHosts = m_gaduOptions.serverHosts;
+ if (m_useManualHosts) {
+ CMStringW serverHosts = m_serverHosts;
if (!serverHosts.IsEmpty()) {
ptrA pHostsList(mir_u2a(serverHosts.c_str()));
hostcount = gg_decodehosts(pHostsList, hosts, 64);
@@ -333,7 +333,7 @@ void __cdecl GaduProto::mainthread(void *)
}
// Readup SSL/TLS setting
- if (p.tls = m_gaduOptions.useSslConnection)
+ if (p.tls = m_useSslConnection)
debugLogA("mainthread() (%x): Using TLS/SSL for connections.", this);
// Gadu-Gadu accepts image sizes upto 255
@@ -354,8 +354,8 @@ void __cdecl GaduProto::mainthread(void *)
}
// Check if dcc is running and setup forwarding port
- if (m_dcc && m_gaduOptions.useForwarding) {
- CMStringW forwardHost = m_gaduOptions.forwardHost;
+ if (m_dcc && m_useForwarding) {
+ CMStringW forwardHost = m_forwardHost;
ptrA pHost(mir_u2a(forwardHost.c_str()));
if (!forwardHost.IsEmpty()) {
if (!(p.external_addr = gg_dnslookup(this, pHost))) {
@@ -366,7 +366,7 @@ void __cdecl GaduProto::mainthread(void *)
debugLogA("mainthread() (%x): Loading forwarding host %s and port %d.", pHost.get(), p.external_port, this);
if (p.external_addr)
- p.external_port = m_gaduOptions.forwardPort;
+ p.external_port = m_forwardPort;
}
}
// Setup client port
@@ -428,13 +428,13 @@ retry:
perror = error;
}
debugLogW(L"mainthread() (%x): %s", this, perror);
- if (m_gaduOptions.showConnectionErrors)
+ if (m_showConnectionErrors)
showpopup(m_tszUserName, perror, GG_POPUP_ERROR | GG_POPUP_ALLOW_MSGBOX | GG_POPUP_ONCE);
// Check if we should reconnect
if ((gg_failno >= GG_FAILURE_RESOLVING && gg_failno != GG_FAILURE_PASSWORD && gg_failno != GG_FAILURE_INTRUDER && gg_failno != GG_FAILURE_UNAVAILABLE)
&& errno == EACCES
- && (m_gaduOptions.autoRecconect || (hostnum < hostcount - 1)))
+ && (m_autoRecconect || (hostnum < hostcount - 1)))
{
uint32_t dwInterval = getDword(GG_KEY_RECONNINTERVAL, GG_KEYDEF_RECONNINTERVAL);
BOOL bRetry = TRUE;
@@ -1145,7 +1145,7 @@ retry:
// If it was unwanted disconnection reconnect
if (m_iDesiredStatus != ID_STATUS_OFFLINE
- && m_gaduOptions.autoRecconect)
+ && m_autoRecconect)
{
debugLogA("mainthread() (%x): Unintentional disconnection detected. Going to reconnect...", this);
hostnum = 0;
diff --git a/protocols/Gadu-Gadu/src/dialogs.cpp b/protocols/Gadu-Gadu/src/dialogs.cpp
index 66fb6cf9f4..656db1888a 100644
--- a/protocols/Gadu-Gadu/src/dialogs.cpp
+++ b/protocols/Gadu-Gadu/src/dialogs.cpp
@@ -20,8 +20,6 @@
#include "gg.h"
-INT_PTR CALLBACK gg_userutildlgproc(HWND m_hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
-
////////////////////////////////////////////////////////////////////////////////
// Check if new user data has been filled in for specified account
//
@@ -45,8 +43,8 @@ void GaduProto::checknewuser(uin_t uin, const char* passwd)
////////////////////////////////////////////////////////////////////////////////
// Options Page : Proc
-//
-static void gg_optsdlgcheck(HWND m_hwnd)
+
+void gg_optsdlgcheck(HWND m_hwnd)
{
wchar_t text[128];
GetDlgItemText(m_hwnd, IDC_UIN, text, _countof(text));
@@ -71,317 +69,8 @@ static void gg_optsdlgcheck(HWND m_hwnd)
}
////////////////////////////////////////////////////////////////////////////////////////////
-// Proc: General options dialog
-//
-static INT_PTR CALLBACK gg_genoptsdlgproc(HWND m_hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- GaduProto *gg = (GaduProto *)GetWindowLongPtr(m_hwnd, GWLP_USERDATA);
-
- switch (msg) {
- case WM_INITDIALOG:
- {
- DBVARIANT dbv;
- uint32_t num;
- gg = (GaduProto *)lParam;
- SetWindowLongPtr(m_hwnd, GWLP_USERDATA, (LONG_PTR)lParam);
-
- TranslateDialogDefault(m_hwnd);
- if (num = gg->getDword(GG_KEY_UIN, 0)) {
- SetDlgItemTextA(m_hwnd, IDC_UIN, ditoa(num));
- ShowWindow(GetDlgItem(m_hwnd, IDC_CREATEACCOUNT), SW_HIDE);
- }
- else {
- ShowWindow(GetDlgItem(m_hwnd, IDC_CHPASS), SW_HIDE);
- ShowWindow(GetDlgItem(m_hwnd, IDC_REMOVEACCOUNT), SW_HIDE);
- ShowWindow(GetDlgItem(m_hwnd, IDC_LOSTPASS), SW_HIDE);
- }
- if (!gg->getString(GG_KEY_PASSWORD, &dbv)) {
- SetDlgItemTextA(m_hwnd, IDC_PASSWORD, dbv.pszVal);
- db_free(&dbv);
- }
- if (!gg->getString(GG_KEY_EMAIL, &dbv)) {
- SetDlgItemTextA(m_hwnd, IDC_EMAIL, dbv.pszVal);
- db_free(&dbv);
- }
- else {
- ShowWindow(GetDlgItem(m_hwnd, IDC_LOSTPASS), SW_HIDE);
- ShowWindow(GetDlgItem(m_hwnd, IDC_CHPASS), SW_HIDE);
- }
-
- CheckDlgButton(m_hwnd, IDC_FRIENDSONLY, gg->getByte(GG_KEY_FRIENDSONLY, GG_KEYDEF_FRIENDSONLY) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(m_hwnd, IDC_SHOWINVISIBLE, gg->getByte(GG_KEY_SHOWINVISIBLE, GG_KEYDEF_SHOWINVISIBLE) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(m_hwnd, IDC_LEAVESTATUSMSG, gg->getByte(GG_KEY_LEAVESTATUSMSG, GG_KEYDEF_LEAVESTATUSMSG) ? BST_CHECKED : BST_UNCHECKED);
- if (gg->gc_enabled)
- CheckDlgButton(m_hwnd, IDC_IGNORECONF, gg->getByte(GG_KEY_IGNORECONF, GG_KEYDEF_IGNORECONF) ? BST_CHECKED : BST_UNCHECKED);
- else {
- EnableWindow(GetDlgItem(m_hwnd, IDC_IGNORECONF), FALSE);
- CheckDlgButton(m_hwnd, IDC_IGNORECONF, BST_CHECKED);
- }
- CheckDlgButton(m_hwnd, IDC_IMGRECEIVE, gg->getByte(GG_KEY_IMGRECEIVE, GG_KEYDEF_IMGRECEIVE) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(m_hwnd, IDC_SHOWLINKS, gg->getByte(GG_KEY_SHOWLINKS, GG_KEYDEF_SHOWLINKS) ? BST_CHECKED : BST_UNCHECKED);
- CheckDlgButton(m_hwnd, IDC_ENABLEAVATARS, gg->getByte(GG_KEY_ENABLEAVATARS, GG_KEYDEF_ENABLEAVATARS) ? BST_CHECKED : BST_UNCHECKED);
-
- EnableWindow(GetDlgItem(m_hwnd, IDC_LEAVESTATUS), IsDlgButtonChecked(m_hwnd, IDC_LEAVESTATUSMSG));
- EnableWindow(GetDlgItem(m_hwnd, IDC_IMGMETHOD), IsDlgButtonChecked(m_hwnd, IDC_IMGRECEIVE));
- SendDlgItemMessage(m_hwnd, IDC_LEAVESTATUS, CB_ADDSTRING, 0, (LPARAM)TranslateT("<Last Status>")); // 0
- SendDlgItemMessage(m_hwnd, IDC_LEAVESTATUS, CB_ADDSTRING, 0, (LPARAM)Clist_GetStatusModeDescription(ID_STATUS_ONLINE, 0));
- SendDlgItemMessage(m_hwnd, IDC_LEAVESTATUS, CB_ADDSTRING, 0, (LPARAM)Clist_GetStatusModeDescription(ID_STATUS_AWAY, 0));
- SendDlgItemMessage(m_hwnd, IDC_LEAVESTATUS, CB_ADDSTRING, 0, (LPARAM)Clist_GetStatusModeDescription(ID_STATUS_DND, 0));
- SendDlgItemMessage(m_hwnd, IDC_LEAVESTATUS, CB_ADDSTRING, 0, (LPARAM)Clist_GetStatusModeDescription(ID_STATUS_FREECHAT, 0));
- SendDlgItemMessage(m_hwnd, IDC_LEAVESTATUS, CB_ADDSTRING, 0, (LPARAM)Clist_GetStatusModeDescription(ID_STATUS_INVISIBLE, 0));
-
- switch (gg->getWord(GG_KEY_LEAVESTATUS, GG_KEYDEF_LEAVESTATUS)) {
- case ID_STATUS_ONLINE:
- SendDlgItemMessage(m_hwnd, IDC_LEAVESTATUS, CB_SETCURSEL, 1, 0);
- break;
- case ID_STATUS_AWAY:
- SendDlgItemMessage(m_hwnd, IDC_LEAVESTATUS, CB_SETCURSEL, 2, 0);
- break;
- case ID_STATUS_DND:
- SendDlgItemMessage(m_hwnd, IDC_LEAVESTATUS, CB_SETCURSEL, 3, 0);
- break;
- case ID_STATUS_FREECHAT:
- SendDlgItemMessage(m_hwnd, IDC_LEAVESTATUS, CB_SETCURSEL, 4, 0);
- break;
- case ID_STATUS_INVISIBLE:
- SendDlgItemMessage(m_hwnd, IDC_LEAVESTATUS, CB_SETCURSEL, 5, 0);
- break;
- default:
- SendDlgItemMessage(m_hwnd, IDC_LEAVESTATUS, CB_SETCURSEL, 0, 0);
- }
-
- SendDlgItemMessage(m_hwnd, IDC_IMGMETHOD, CB_ADDSTRING, 0, (LPARAM)TranslateT("System tray icon"));
- SendDlgItemMessage(m_hwnd, IDC_IMGMETHOD, CB_ADDSTRING, 0, (LPARAM)TranslateT("Popup window"));
- SendDlgItemMessage(m_hwnd, IDC_IMGMETHOD, CB_ADDSTRING, 0, (LPARAM)TranslateT("Message with [img] BBCode"));
- SendDlgItemMessage(m_hwnd, IDC_IMGMETHOD, CB_SETCURSEL, gg->getByte(GG_KEY_IMGMETHOD, GG_KEYDEF_IMGMETHOD), 0);
- }
- break;
-
- case WM_COMMAND:
- if ((LOWORD(wParam) == IDC_UIN || LOWORD(wParam) == IDC_PASSWORD || LOWORD(wParam) == IDC_EMAIL)
- && (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus()))
- return 0;
-
- switch (LOWORD(wParam)) {
- case IDC_EMAIL:
- case IDC_UIN:
- gg_optsdlgcheck(m_hwnd);
- break;
-
- case IDC_LEAVESTATUSMSG:
- EnableWindow(GetDlgItem(m_hwnd, IDC_LEAVESTATUS), IsDlgButtonChecked(m_hwnd, IDC_LEAVESTATUSMSG));
- break;
-
- case IDC_IMGRECEIVE:
- EnableWindow(GetDlgItem(m_hwnd, IDC_IMGMETHOD), IsDlgButtonChecked(m_hwnd, IDC_IMGRECEIVE));
- break;
-
- case IDC_LOSTPASS:
- {
- char email[128];
- uin_t uin;
- GetDlgItemTextA(m_hwnd, IDC_UIN, email, _countof(email));
- uin = atoi(email);
- GetDlgItemTextA(m_hwnd, IDC_EMAIL, email, _countof(email));
- if (!mir_strlen(email))
- MessageBox(nullptr, TranslateT("You need to specify your registration e-mail first."),
- gg->m_tszUserName, MB_OK | MB_ICONEXCLAMATION);
- else if (MessageBox(nullptr,
- TranslateT("Your password will be sent to your registration e-mail.\nDo you want to continue?"),
- gg->m_tszUserName,
- MB_OKCANCEL | MB_ICONQUESTION) == IDOK)
- gg->remindpassword(uin, email);
- return FALSE;
- }
- case IDC_CREATEACCOUNT:
- case IDC_REMOVEACCOUNT:
- if (gg->isonline()) {
- if (MessageBox(
- nullptr,
- TranslateT("You should disconnect before making any permanent changes with your account.\nDo you want to disconnect now?"),
- gg->m_tszUserName,
- MB_OKCANCEL | MB_ICONEXCLAMATION) == IDCANCEL)
- break;
- else
- gg->disconnect();
- }
- case IDC_CHPASS:
- case IDC_CHEMAIL:
- {
- // Readup data
- GGUSERUTILDLGDATA dat;
- int ret;
- char pass[128], email[128];
- GetDlgItemTextA(m_hwnd, IDC_UIN, pass, _countof(pass));
- dat.uin = atoi(pass);
- GetDlgItemTextA(m_hwnd, IDC_PASSWORD, pass, _countof(pass));
- GetDlgItemTextA(m_hwnd, IDC_EMAIL, email, _countof(email));
- dat.pass = pass;
- dat.email = email;
- dat.gg = gg;
- if (LOWORD(wParam) == IDC_CREATEACCOUNT) {
- dat.mode = GG_USERUTIL_CREATE;
- ret = DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_CREATEACCOUNT), m_hwnd, gg_userutildlgproc, (LPARAM)&dat);
- }
- else if (LOWORD(wParam) == IDC_CHPASS) {
- dat.mode = GG_USERUTIL_PASS;
- ret = DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_CHPASS), m_hwnd, gg_userutildlgproc, (LPARAM)&dat);
- }
- else if (LOWORD(wParam) == IDC_CHEMAIL) {
- dat.mode = GG_USERUTIL_EMAIL;
- ret = DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_CHEMAIL), m_hwnd, gg_userutildlgproc, (LPARAM)&dat);
- }
- else {
- dat.mode = GG_USERUTIL_REMOVE;
- ret = DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_REMOVEACCOUNT), m_hwnd, gg_userutildlgproc, (LPARAM)&dat);
- }
-
- if (ret == IDOK) {
- DBVARIANT dbv;
- uint32_t num;
- // Show reload required window
- ShowWindow(GetDlgItem(m_hwnd, IDC_RELOADREQD), SW_SHOW);
-
- // Update uin
- if (num = gg->getDword(GG_KEY_UIN, 0))
- SetDlgItemTextA(m_hwnd, IDC_UIN, ditoa(num));
- else
- SetDlgItemTextA(m_hwnd, IDC_UIN, "");
-
- // Update password
- if (!gg->getString(GG_KEY_PASSWORD, &dbv)) {
- SetDlgItemTextA(m_hwnd, IDC_PASSWORD, dbv.pszVal);
- db_free(&dbv);
- }
- else SetDlgItemTextA(m_hwnd, IDC_PASSWORD, "");
-
- // Update e-mail
- if (!gg->getString(GG_KEY_EMAIL, &dbv)) {
- SetDlgItemTextA(m_hwnd, IDC_EMAIL, dbv.pszVal);
- db_free(&dbv);
- }
- else SetDlgItemTextA(m_hwnd, IDC_EMAIL, "");
-
- // Update links
- gg_optsdlgcheck(m_hwnd);
-
- // Remove details
- if (LOWORD(wParam) != IDC_CHPASS && LOWORD(wParam) != IDC_CHEMAIL) {
- gg->delSetting(GG_KEY_NICK);
- gg->delSetting(GG_KEY_PD_NICKNAME);
- gg->delSetting(GG_KEY_PD_CITY);
- gg->delSetting(GG_KEY_PD_FIRSTNAME);
- gg->delSetting(GG_KEY_PD_LASTNAME);
- gg->delSetting(GG_KEY_PD_FAMILYNAME);
- gg->delSetting(GG_KEY_PD_FAMILYCITY);
- gg->delSetting(GG_KEY_PD_AGE);
- gg->delSetting(GG_KEY_PD_BIRTHYEAR);
- gg->delSetting(GG_KEY_PD_GANDER);
- }
- }
- }
- break;
- }
- SendMessage(GetParent(m_hwnd), PSM_CHANGED, 0, 0);
- break;
-
- case WM_NOTIFY:
- switch (((LPNMHDR)lParam)->code) {
- case PSN_APPLY:
- int status_flags = GG_STATUS_FLAG_UNKNOWN;
- char str[128];
-
- // Write Gadu-Gadu number & password
- GetDlgItemTextA(m_hwnd, IDC_UIN, str, _countof(str));
- uin_t uin = atoi(str);
- GetDlgItemTextA(m_hwnd, IDC_PASSWORD, str, _countof(str));
- gg->checknewuser(uin, str);
- gg->setDword(GG_KEY_UIN, uin);
- gg->setString(GG_KEY_PASSWORD, str);
-
- // Write Gadu-Gadu email
- GetDlgItemTextA(m_hwnd, IDC_EMAIL, str, _countof(str));
- gg->setString(GG_KEY_EMAIL, str);
-
- // Write checkboxes
- gg->setByte(GG_KEY_FRIENDSONLY, (uint8_t)IsDlgButtonChecked(m_hwnd, IDC_FRIENDSONLY));
- gg->setByte(GG_KEY_SHOWINVISIBLE, (uint8_t)IsDlgButtonChecked(m_hwnd, IDC_SHOWINVISIBLE));
- gg->setByte(GG_KEY_LEAVESTATUSMSG, (uint8_t)IsDlgButtonChecked(m_hwnd, IDC_LEAVESTATUSMSG));
- if (gg->gc_enabled)
- gg->setByte(GG_KEY_IGNORECONF, (uint8_t)IsDlgButtonChecked(m_hwnd, IDC_IGNORECONF));
- gg->setByte(GG_KEY_IMGRECEIVE, (uint8_t)IsDlgButtonChecked(m_hwnd, IDC_IMGRECEIVE));
- gg->setByte(GG_KEY_SHOWLINKS, (uint8_t)IsDlgButtonChecked(m_hwnd, IDC_SHOWLINKS));
- if (IsDlgButtonChecked(m_hwnd, IDC_SHOWLINKS))
- status_flags |= GG_STATUS_FLAG_SPAM;
- gg->gg_EnterCriticalSection(&gg->sess_mutex, "gg_genoptsdlgproc", 34, "sess_mutex", 1);
- gg_change_status_flags(gg->m_sess, status_flags);
- gg->gg_LeaveCriticalSection(&gg->sess_mutex, "gg_genoptsdlgproc", 34, 1, "sess_mutex", 1);
- gg->setByte(GG_KEY_ENABLEAVATARS, (uint8_t)IsDlgButtonChecked(m_hwnd, IDC_ENABLEAVATARS));
-
- gg->setByte(GG_KEY_IMGMETHOD, (uint8_t)SendDlgItemMessage(m_hwnd, IDC_IMGMETHOD, CB_GETCURSEL, 0, 0));
-
- // Write leave status
- switch (SendDlgItemMessage(m_hwnd, IDC_LEAVESTATUS, CB_GETCURSEL, 0, 0)) {
- case 1:
- gg->setWord(GG_KEY_LEAVESTATUS, ID_STATUS_ONLINE);
- break;
- case 2:
- gg->setWord(GG_KEY_LEAVESTATUS, ID_STATUS_AWAY);
- break;
- case 3:
- gg->setWord(GG_KEY_LEAVESTATUS, ID_STATUS_DND);
- break;
- case 4:
- gg->setWord(GG_KEY_LEAVESTATUS, ID_STATUS_FREECHAT);
- break;
- case 5:
- gg->setWord(GG_KEY_LEAVESTATUS, ID_STATUS_INVISIBLE);
- break;
- default:
- gg->setWord(GG_KEY_LEAVESTATUS, GG_KEYDEF_LEAVESTATUS);
- }
- }
- break;
- }
- return FALSE;
-}
-
-////////////////////////////////////////////////////////////////////////////////
-// Options Page : Init
-//
-int GaduProto::options_init(WPARAM wParam, LPARAM)
-{
- OPTIONSDIALOGPAGE odp = {};
- odp.flags = ODPF_UNICODE;
- odp.position = 1003000;
- odp.szGroup.w = LPGENW("Network");
- odp.szTitle.w = m_tszUserName;
- odp.dwInitParam = (LPARAM)this;
- odp.flags = ODPF_UNICODE | ODPF_BOLDGROUPS | ODPF_DONTTRANSLATE;
-
- odp.szTab.w = LPGENW("General");
- odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_GG_GENERAL);
- odp.pfnDlgProc = gg_genoptsdlgproc;
- g_plugin.addOptions(wParam, &odp);
-
- odp.pszTemplate = nullptr;
-
- odp.szTab.w = LPGENW("Conference");
- odp.position = 1;
- odp.pDialog = new GaduOptionsDlgConference(this);
- g_plugin.addOptions(wParam, &odp);
-
- odp.szTab.w = LPGENW("Advanced");
- odp.position = 2;
- odp.pDialog = new GaduOptionsDlgAdvanced(this);
- g_plugin.addOptions(wParam, &odp);
-
- return 0;
-}
-
-////////////////////////////////////////////////////////////////////////////////////////////
// Proc: Account manager options dialog
-//
+
INT_PTR CALLBACK gg_acc_mgr_guidlgproc(HWND m_hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
GaduProto *gg = (GaduProto *)GetWindowLongPtr(m_hwnd, GWLP_USERDATA);
diff --git a/protocols/Gadu-Gadu/src/filetransfer.cpp b/protocols/Gadu-Gadu/src/filetransfer.cpp
index cd5192279c..291929a2da 100644
--- a/protocols/Gadu-Gadu/src/filetransfer.cpp
+++ b/protocols/Gadu-Gadu/src/filetransfer.cpp
@@ -45,7 +45,7 @@ void GaduProto::dccstart()
}
// Check if we wan't direct connections
- if (!m_gaduOptions.useDirectConnections)
+ if (!m_useDirectConnections)
{
debugLogA("dccstart(): No direct connections setup.");
if (hEvent)
@@ -123,7 +123,7 @@ void __cdecl GaduProto::dccmainthread(void*)
}
// Create listen socket on config direct port
- if (!(m_dcc = gg_dcc_socket_create(uin, static_cast<uint16_t>(m_gaduOptions.directConnectionPort))))
+ if (!(m_dcc = gg_dcc_socket_create(uin, static_cast<uint16_t>(m_directConnectionPort))))
{
debugLogA("dccmainthread(): Cannot create DCC listen socket. Exiting.");
// Signalize mainthread we haven't start
diff --git a/protocols/Gadu-Gadu/src/gg.cpp b/protocols/Gadu-Gadu/src/gg.cpp
index 0a3361d47a..9b4e1ff1b1 100644
--- a/protocols/Gadu-Gadu/src/gg.cpp
+++ b/protocols/Gadu-Gadu/src/gg.cpp
@@ -191,9 +191,9 @@ void GaduProto::cleanuplastplugin(uint32_t version)
//2. force SSL and keepalive; overwrite old server list;
if (version < PLUGIN_MAKE_VERSION(0, 11, 0, 4)) {
setWString("ServerHosts", GG_KEYDEF_SERVERHOSTS);
- m_gaduOptions.useManualHosts = 1;
- m_gaduOptions.useSslConnection = 1;
- m_gaduOptions.keepConnectionAlive = 1;
+ m_useManualHosts = 1;
+ m_useSslConnection = 1;
+ m_keepConnectionAlive = 1;
}
}
diff --git a/protocols/Gadu-Gadu/src/gg.h b/protocols/Gadu-Gadu/src/gg.h
index 15c22b6a6f..76039c9765 100644
--- a/protocols/Gadu-Gadu/src/gg.h
+++ b/protocols/Gadu-Gadu/src/gg.h
@@ -276,6 +276,10 @@ extern IconItem iconList[];
/////////////////////////////////////////////////
// Methods
+void gg_optsdlgcheck(HWND m_hwnd);
+
+INT_PTR CALLBACK gg_userutildlgproc(HWND m_hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
+
/* Helper functions */
const wchar_t *http_error_string(int h);
unsigned long crc_get(char *mem);
@@ -303,7 +307,6 @@ void gg_links_init();
const char *ggdebug_eventtype(gg_event *e);
// Plugin headers
-#include "options.h" //include before protocol declaration
#include "gg_proto.h"
#include "resource.h"
diff --git a/protocols/Gadu-Gadu/src/gg_proto.cpp b/protocols/Gadu-Gadu/src/gg_proto.cpp
index 8cbccc1d90..ee0222f8c3 100644
--- a/protocols/Gadu-Gadu/src/gg_proto.cpp
+++ b/protocols/Gadu-Gadu/src/gg_proto.cpp
@@ -25,7 +25,20 @@ GaduProto::GaduProto(const char *pszProtoName, const wchar_t *tszUserName) :
PROTO<GaduProto>(pszProtoName, tszUserName),
avatar_requests(1, NumericKeySortT),
avatar_transfers(1, NumericKeySortT),
- m_gaduOptions(this)
+
+ // options
+ m_forwardPort(this, "ForwardPort", 1550),
+ m_forwardHost(this, "ForwardHost", L""),
+ m_serverHosts(this, "ServerHosts", GG_KEYDEF_SERVERHOSTS),
+ m_autoRecconect(this, "AReconnect", 0),
+ m_useForwarding(this, "Forwarding", 0),
+ m_useManualHosts(this, "ManualHost", 1),
+ m_useSslConnection(this, "SSLConnection", 1),
+ m_keepConnectionAlive(this, "KeepAlive", 1),
+ m_showConnectionErrors(this, "ShowCErrors", 0),
+ m_useDirectConnections(this, "DirectConns", 1),
+ m_directConnectionPort(this, "DirectPort", 1550),
+ m_useMsgDeliveryAcknowledge(this, "MessageAck", 1)
{
#ifdef DEBUGMODE
extendedLogging = 0;
@@ -507,7 +520,7 @@ int GaduProto::SendMsg(MCONTACT hContact, int, const char *msg)
gg_LeaveCriticalSection(&sess_mutex, "SendMsg", 53, 1, "sess_mutex", 1);
// Auto-ack message without waiting for server ack
- if (!m_gaduOptions.useMsgDeliveryAcknowledge)
+ if (!m_useMsgDeliveryAcknowledge)
ProtoBroadcastAsync(hContact, ACKTYPE_MESSAGE, ACKRESULT_SUCCESS, (HANDLE)seq, 0);
return seq;
diff --git a/protocols/Gadu-Gadu/src/gg_proto.h b/protocols/Gadu-Gadu/src/gg_proto.h
index 8bb112ebc6..f84691c0b8 100644
--- a/protocols/Gadu-Gadu/src/gg_proto.h
+++ b/protocols/Gadu-Gadu/src/gg_proto.h
@@ -212,7 +212,24 @@ struct GaduProto : public PROTO<GaduProto>
void block_uninit();
//////////////////////////////////////////////////////////////////////////////////////
- GaduOptions m_gaduOptions;
+ // options
+
+ CMOption<uint8_t> m_autoRecconect;
+ CMOption<uint8_t> m_keepConnectionAlive;
+ CMOption<uint8_t> m_showConnectionErrors;
+ CMOption<uint8_t> m_useDirectConnections;
+ CMOption<uint8_t> m_useForwarding;
+ CMOption<uint8_t> m_useManualHosts;
+ CMOption<uint8_t> m_useMsgDeliveryAcknowledge;
+ CMOption<uint8_t> m_useSslConnection;
+
+ CMOption<uint16_t> m_directConnectionPort;
+ CMOption<uint16_t> m_forwardPort;
+
+ CMOption<wchar_t*> m_forwardHost;
+ CMOption<wchar_t*> m_serverHosts;
+
+ //////////////////////////////////////////////////////////////////////////////////////
CRITICAL_SECTION ft_mutex, sess_mutex, img_mutex, modemsg_mutex, avatar_mutex, sessions_mutex;
list_t watches, transfers, requests, chats, imagedlgs, sessions;
diff --git a/protocols/Gadu-Gadu/src/keepalive.cpp b/protocols/Gadu-Gadu/src/keepalive.cpp
index 67e445c221..53bdd8d87f 100644
--- a/protocols/Gadu-Gadu/src/keepalive.cpp
+++ b/protocols/Gadu-Gadu/src/keepalive.cpp
@@ -52,7 +52,7 @@ static VOID CALLBACK gg_keepalive(HWND, UINT, UINT_PTR idEvent, DWORD)
void GaduProto::keepalive_init()
{
- if (m_gaduOptions.keepConnectionAlive)
+ if (m_keepConnectionAlive)
{
int i;
for (i = 0; i < MAX_TIMERS && g_timers[i] != nullptr; i++);
diff --git a/protocols/Gadu-Gadu/src/options.cpp b/protocols/Gadu-Gadu/src/options.cpp
index 2b2a3cc4c3..bfe9a6394b 100644
--- a/protocols/Gadu-Gadu/src/options.cpp
+++ b/protocols/Gadu-Gadu/src/options.cpp
@@ -1,175 +1,521 @@
#include "gg.h"
-GaduOptions::GaduOptions(PROTO_INTERFACE *proto) :
- autoRecconect(proto, "AReconnect", 0),
- keepConnectionAlive(proto, "KeepAlive", 1),
- showConnectionErrors(proto, "ShowCErrors", 0),
- useDirectConnections(proto, "DirectConns", 1),
- useForwarding(proto, "Forwarding", 0),
- useManualHosts(proto, "ManualHost", 1),
- useMsgDeliveryAcknowledge(proto, "MessageAck", 1),
- useSslConnection(proto, "SSLConnection", 1),
- directConnectionPort(proto, "DirectPort", 1550),
- forwardPort(proto, "ForwardPort", 1550),
- forwardHost(proto, "ForwardHost", L""),
- serverHosts(proto, "ServerHosts", GG_KEYDEF_SERVERHOSTS)
-{}
-
-GaduOptionsDlgConference::GaduOptionsDlgConference(GaduProto *proto) :
- GaduDlgBase(proto, IDD_OPT_GG_CONFERENCE),
- cmbPolicyForAllChatParticipants(this, IDC_GC_POLICY_TOTAL),
- edtNumberOfAllChatParticipants(this, IDC_GC_COUNT_TOTAL_SPIN, 250),
- cmbPolicyForUnknownChatParticipants(this, IDC_GC_POLICY_UNKNOWN),
- edtNumberOfUnknownChatParticipants(this, IDC_GC_COUNT_UNKNOWN_SPIN, 250),
- cmbDefaultChatPolicy(this, IDC_GC_POLICY_DEFAULT)
+using GaduDlgBase = CProtoDlgBase<GaduProto>;
+
+////////////////////////////////////////////////////////////////////////////////////////////
+// Proc: General options dialog
+
+static INT_PTR CALLBACK gg_genoptsdlgproc(HWND m_hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
- CreateLink(cmbPolicyForAllChatParticipants, GG_KEY_GC_POLICY_TOTAL, DBVT_WORD, GG_KEYDEF_GC_POLICY_TOTAL);
- CreateLink(edtNumberOfAllChatParticipants, GG_KEY_GC_COUNT_TOTAL, DBVT_WORD, GG_KEYDEF_GC_COUNT_TOTAL);
+ GaduProto *gg = (GaduProto *)GetWindowLongPtr(m_hwnd, GWLP_USERDATA);
- CreateLink(cmbPolicyForUnknownChatParticipants, GG_KEY_GC_POLICY_UNKNOWN, DBVT_WORD, GG_KEYDEF_GC_POLICY_UNKNOWN);
- CreateLink(edtNumberOfUnknownChatParticipants, GG_KEY_GC_COUNT_UNKNOWN, DBVT_WORD, GG_KEYDEF_GC_COUNT_UNKNOWN);
+ switch (msg) {
+ case WM_INITDIALOG:
+ {
+ DBVARIANT dbv;
+ uint32_t num;
+ gg = (GaduProto *)lParam;
+ SetWindowLongPtr(m_hwnd, GWLP_USERDATA, (LONG_PTR)lParam);
- CreateLink(cmbDefaultChatPolicy, GG_KEY_GC_POLICY_DEFAULT, DBVT_WORD, GG_KEYDEF_GC_POLICY_DEFAULT);
-}
+ TranslateDialogDefault(m_hwnd);
+ if (num = gg->getDword(GG_KEY_UIN, 0)) {
+ SetDlgItemTextA(m_hwnd, IDC_UIN, ditoa(num));
+ ShowWindow(GetDlgItem(m_hwnd, IDC_CREATEACCOUNT), SW_HIDE);
+ }
+ else {
+ ShowWindow(GetDlgItem(m_hwnd, IDC_CHPASS), SW_HIDE);
+ ShowWindow(GetDlgItem(m_hwnd, IDC_REMOVEACCOUNT), SW_HIDE);
+ ShowWindow(GetDlgItem(m_hwnd, IDC_LOSTPASS), SW_HIDE);
+ }
+ if (!gg->getString(GG_KEY_PASSWORD, &dbv)) {
+ SetDlgItemTextA(m_hwnd, IDC_PASSWORD, dbv.pszVal);
+ db_free(&dbv);
+ }
+ if (!gg->getString(GG_KEY_EMAIL, &dbv)) {
+ SetDlgItemTextA(m_hwnd, IDC_EMAIL, dbv.pszVal);
+ db_free(&dbv);
+ }
+ else {
+ ShowWindow(GetDlgItem(m_hwnd, IDC_LOSTPASS), SW_HIDE);
+ ShowWindow(GetDlgItem(m_hwnd, IDC_CHPASS), SW_HIDE);
+ }
-bool GaduOptionsDlgConference::OnInitDialog()
-{
- cmbPolicyForAllChatParticipants.AddString(TranslateT("Allow"), 0L);
- cmbPolicyForAllChatParticipants.AddString(TranslateT("Ask"), 1L);
- cmbPolicyForAllChatParticipants.AddString(TranslateT("Ignore"), 2L);
- int listIndex = m_proto->getWord(GG_KEY_GC_POLICY_TOTAL, GG_KEYDEF_GC_POLICY_TOTAL);
- cmbPolicyForAllChatParticipants.SetCurSel(listIndex);
-
- cmbPolicyForUnknownChatParticipants.AddString(TranslateT("Allow"), 0L);
- cmbPolicyForUnknownChatParticipants.AddString(TranslateT("Ask"), 1L);
- cmbPolicyForUnknownChatParticipants.AddString(TranslateT("Ignore"), 2L);
- listIndex = m_proto->getWord(GG_KEY_GC_POLICY_UNKNOWN, GG_KEYDEF_GC_POLICY_UNKNOWN);
- cmbPolicyForUnknownChatParticipants.SetCurSel(listIndex);
-
- cmbDefaultChatPolicy.AddString(TranslateT("Allow"), 0L);
- cmbDefaultChatPolicy.AddString(TranslateT("Ask"), 1L);
- cmbDefaultChatPolicy.AddString(TranslateT("Ignore"), 2L);
- listIndex = m_proto->getWord(GG_KEY_GC_POLICY_DEFAULT, GG_KEYDEF_GC_POLICY_DEFAULT);
- cmbDefaultChatPolicy.SetCurSel(listIndex);
- return true;
+ CheckDlgButton(m_hwnd, IDC_FRIENDSONLY, gg->getByte(GG_KEY_FRIENDSONLY, GG_KEYDEF_FRIENDSONLY) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(m_hwnd, IDC_SHOWINVISIBLE, gg->getByte(GG_KEY_SHOWINVISIBLE, GG_KEYDEF_SHOWINVISIBLE) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(m_hwnd, IDC_LEAVESTATUSMSG, gg->getByte(GG_KEY_LEAVESTATUSMSG, GG_KEYDEF_LEAVESTATUSMSG) ? BST_CHECKED : BST_UNCHECKED);
+ if (gg->gc_enabled)
+ CheckDlgButton(m_hwnd, IDC_IGNORECONF, gg->getByte(GG_KEY_IGNORECONF, GG_KEYDEF_IGNORECONF) ? BST_CHECKED : BST_UNCHECKED);
+ else {
+ EnableWindow(GetDlgItem(m_hwnd, IDC_IGNORECONF), FALSE);
+ CheckDlgButton(m_hwnd, IDC_IGNORECONF, BST_CHECKED);
+ }
+ CheckDlgButton(m_hwnd, IDC_IMGRECEIVE, gg->getByte(GG_KEY_IMGRECEIVE, GG_KEYDEF_IMGRECEIVE) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(m_hwnd, IDC_SHOWLINKS, gg->getByte(GG_KEY_SHOWLINKS, GG_KEYDEF_SHOWLINKS) ? BST_CHECKED : BST_UNCHECKED);
+ CheckDlgButton(m_hwnd, IDC_ENABLEAVATARS, gg->getByte(GG_KEY_ENABLEAVATARS, GG_KEYDEF_ENABLEAVATARS) ? BST_CHECKED : BST_UNCHECKED);
+
+ EnableWindow(GetDlgItem(m_hwnd, IDC_LEAVESTATUS), IsDlgButtonChecked(m_hwnd, IDC_LEAVESTATUSMSG));
+ EnableWindow(GetDlgItem(m_hwnd, IDC_IMGMETHOD), IsDlgButtonChecked(m_hwnd, IDC_IMGRECEIVE));
+ SendDlgItemMessage(m_hwnd, IDC_LEAVESTATUS, CB_ADDSTRING, 0, (LPARAM)TranslateT("<Last Status>")); // 0
+ SendDlgItemMessage(m_hwnd, IDC_LEAVESTATUS, CB_ADDSTRING, 0, (LPARAM)Clist_GetStatusModeDescription(ID_STATUS_ONLINE, 0));
+ SendDlgItemMessage(m_hwnd, IDC_LEAVESTATUS, CB_ADDSTRING, 0, (LPARAM)Clist_GetStatusModeDescription(ID_STATUS_AWAY, 0));
+ SendDlgItemMessage(m_hwnd, IDC_LEAVESTATUS, CB_ADDSTRING, 0, (LPARAM)Clist_GetStatusModeDescription(ID_STATUS_DND, 0));
+ SendDlgItemMessage(m_hwnd, IDC_LEAVESTATUS, CB_ADDSTRING, 0, (LPARAM)Clist_GetStatusModeDescription(ID_STATUS_FREECHAT, 0));
+ SendDlgItemMessage(m_hwnd, IDC_LEAVESTATUS, CB_ADDSTRING, 0, (LPARAM)Clist_GetStatusModeDescription(ID_STATUS_INVISIBLE, 0));
+
+ switch (gg->getWord(GG_KEY_LEAVESTATUS, GG_KEYDEF_LEAVESTATUS)) {
+ case ID_STATUS_ONLINE:
+ SendDlgItemMessage(m_hwnd, IDC_LEAVESTATUS, CB_SETCURSEL, 1, 0);
+ break;
+ case ID_STATUS_AWAY:
+ SendDlgItemMessage(m_hwnd, IDC_LEAVESTATUS, CB_SETCURSEL, 2, 0);
+ break;
+ case ID_STATUS_DND:
+ SendDlgItemMessage(m_hwnd, IDC_LEAVESTATUS, CB_SETCURSEL, 3, 0);
+ break;
+ case ID_STATUS_FREECHAT:
+ SendDlgItemMessage(m_hwnd, IDC_LEAVESTATUS, CB_SETCURSEL, 4, 0);
+ break;
+ case ID_STATUS_INVISIBLE:
+ SendDlgItemMessage(m_hwnd, IDC_LEAVESTATUS, CB_SETCURSEL, 5, 0);
+ break;
+ default:
+ SendDlgItemMessage(m_hwnd, IDC_LEAVESTATUS, CB_SETCURSEL, 0, 0);
+ }
+
+ SendDlgItemMessage(m_hwnd, IDC_IMGMETHOD, CB_ADDSTRING, 0, (LPARAM)TranslateT("System tray icon"));
+ SendDlgItemMessage(m_hwnd, IDC_IMGMETHOD, CB_ADDSTRING, 0, (LPARAM)TranslateT("Popup window"));
+ SendDlgItemMessage(m_hwnd, IDC_IMGMETHOD, CB_ADDSTRING, 0, (LPARAM)TranslateT("Message with [img] BBCode"));
+ SendDlgItemMessage(m_hwnd, IDC_IMGMETHOD, CB_SETCURSEL, gg->getByte(GG_KEY_IMGMETHOD, GG_KEYDEF_IMGMETHOD), 0);
+ }
+ break;
+
+ case WM_COMMAND:
+ if ((LOWORD(wParam) == IDC_UIN || LOWORD(wParam) == IDC_PASSWORD || LOWORD(wParam) == IDC_EMAIL)
+ && (HIWORD(wParam) != EN_CHANGE || (HWND)lParam != GetFocus()))
+ return 0;
+
+ switch (LOWORD(wParam)) {
+ case IDC_EMAIL:
+ case IDC_UIN:
+ gg_optsdlgcheck(m_hwnd);
+ break;
+
+ case IDC_LEAVESTATUSMSG:
+ EnableWindow(GetDlgItem(m_hwnd, IDC_LEAVESTATUS), IsDlgButtonChecked(m_hwnd, IDC_LEAVESTATUSMSG));
+ break;
+
+ case IDC_IMGRECEIVE:
+ EnableWindow(GetDlgItem(m_hwnd, IDC_IMGMETHOD), IsDlgButtonChecked(m_hwnd, IDC_IMGRECEIVE));
+ break;
+
+ case IDC_LOSTPASS:
+ {
+ char email[128];
+ uin_t uin;
+ GetDlgItemTextA(m_hwnd, IDC_UIN, email, _countof(email));
+ uin = atoi(email);
+ GetDlgItemTextA(m_hwnd, IDC_EMAIL, email, _countof(email));
+ if (!mir_strlen(email))
+ MessageBox(nullptr, TranslateT("You need to specify your registration e-mail first."),
+ gg->m_tszUserName, MB_OK | MB_ICONEXCLAMATION);
+ else if (MessageBox(nullptr,
+ TranslateT("Your password will be sent to your registration e-mail.\nDo you want to continue?"),
+ gg->m_tszUserName,
+ MB_OKCANCEL | MB_ICONQUESTION) == IDOK)
+ gg->remindpassword(uin, email);
+ return FALSE;
+ }
+ case IDC_CREATEACCOUNT:
+ case IDC_REMOVEACCOUNT:
+ if (gg->isonline()) {
+ if (MessageBox(
+ nullptr,
+ TranslateT("You should disconnect before making any permanent changes with your account.\nDo you want to disconnect now?"),
+ gg->m_tszUserName,
+ MB_OKCANCEL | MB_ICONEXCLAMATION) == IDCANCEL)
+ break;
+ else
+ gg->disconnect();
+ }
+ case IDC_CHPASS:
+ case IDC_CHEMAIL:
+ {
+ // Readup data
+ GGUSERUTILDLGDATA dat;
+ int ret;
+ char pass[128], email[128];
+ GetDlgItemTextA(m_hwnd, IDC_UIN, pass, _countof(pass));
+ dat.uin = atoi(pass);
+ GetDlgItemTextA(m_hwnd, IDC_PASSWORD, pass, _countof(pass));
+ GetDlgItemTextA(m_hwnd, IDC_EMAIL, email, _countof(email));
+ dat.pass = pass;
+ dat.email = email;
+ dat.gg = gg;
+ if (LOWORD(wParam) == IDC_CREATEACCOUNT) {
+ dat.mode = GG_USERUTIL_CREATE;
+ ret = DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_CREATEACCOUNT), m_hwnd, gg_userutildlgproc, (LPARAM)&dat);
+ }
+ else if (LOWORD(wParam) == IDC_CHPASS) {
+ dat.mode = GG_USERUTIL_PASS;
+ ret = DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_CHPASS), m_hwnd, gg_userutildlgproc, (LPARAM)&dat);
+ }
+ else if (LOWORD(wParam) == IDC_CHEMAIL) {
+ dat.mode = GG_USERUTIL_EMAIL;
+ ret = DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_CHEMAIL), m_hwnd, gg_userutildlgproc, (LPARAM)&dat);
+ }
+ else {
+ dat.mode = GG_USERUTIL_REMOVE;
+ ret = DialogBoxParam(g_plugin.getInst(), MAKEINTRESOURCE(IDD_REMOVEACCOUNT), m_hwnd, gg_userutildlgproc, (LPARAM)&dat);
+ }
+
+ if (ret == IDOK) {
+ DBVARIANT dbv;
+ uint32_t num;
+ // Show reload required window
+ ShowWindow(GetDlgItem(m_hwnd, IDC_RELOADREQD), SW_SHOW);
+
+ // Update uin
+ if (num = gg->getDword(GG_KEY_UIN, 0))
+ SetDlgItemTextA(m_hwnd, IDC_UIN, ditoa(num));
+ else
+ SetDlgItemTextA(m_hwnd, IDC_UIN, "");
+
+ // Update password
+ if (!gg->getString(GG_KEY_PASSWORD, &dbv)) {
+ SetDlgItemTextA(m_hwnd, IDC_PASSWORD, dbv.pszVal);
+ db_free(&dbv);
+ }
+ else SetDlgItemTextA(m_hwnd, IDC_PASSWORD, "");
+
+ // Update e-mail
+ if (!gg->getString(GG_KEY_EMAIL, &dbv)) {
+ SetDlgItemTextA(m_hwnd, IDC_EMAIL, dbv.pszVal);
+ db_free(&dbv);
+ }
+ else SetDlgItemTextA(m_hwnd, IDC_EMAIL, "");
+
+ // Update links
+ gg_optsdlgcheck(m_hwnd);
+
+ // Remove details
+ if (LOWORD(wParam) != IDC_CHPASS && LOWORD(wParam) != IDC_CHEMAIL) {
+ gg->delSetting(GG_KEY_NICK);
+ gg->delSetting(GG_KEY_PD_NICKNAME);
+ gg->delSetting(GG_KEY_PD_CITY);
+ gg->delSetting(GG_KEY_PD_FIRSTNAME);
+ gg->delSetting(GG_KEY_PD_LASTNAME);
+ gg->delSetting(GG_KEY_PD_FAMILYNAME);
+ gg->delSetting(GG_KEY_PD_FAMILYCITY);
+ gg->delSetting(GG_KEY_PD_AGE);
+ gg->delSetting(GG_KEY_PD_BIRTHYEAR);
+ gg->delSetting(GG_KEY_PD_GANDER);
+ }
+ }
+ }
+ break;
+ }
+ SendMessage(GetParent(m_hwnd), PSM_CHANGED, 0, 0);
+ break;
+
+ case WM_NOTIFY:
+ switch (((LPNMHDR)lParam)->code) {
+ case PSN_APPLY:
+ int status_flags = GG_STATUS_FLAG_UNKNOWN;
+ char str[128];
+
+ // Write Gadu-Gadu number & password
+ GetDlgItemTextA(m_hwnd, IDC_UIN, str, _countof(str));
+ uin_t uin = atoi(str);
+ GetDlgItemTextA(m_hwnd, IDC_PASSWORD, str, _countof(str));
+ gg->checknewuser(uin, str);
+ gg->setDword(GG_KEY_UIN, uin);
+ gg->setString(GG_KEY_PASSWORD, str);
+
+ // Write Gadu-Gadu email
+ GetDlgItemTextA(m_hwnd, IDC_EMAIL, str, _countof(str));
+ gg->setString(GG_KEY_EMAIL, str);
+
+ // Write checkboxes
+ gg->setByte(GG_KEY_FRIENDSONLY, (uint8_t)IsDlgButtonChecked(m_hwnd, IDC_FRIENDSONLY));
+ gg->setByte(GG_KEY_SHOWINVISIBLE, (uint8_t)IsDlgButtonChecked(m_hwnd, IDC_SHOWINVISIBLE));
+ gg->setByte(GG_KEY_LEAVESTATUSMSG, (uint8_t)IsDlgButtonChecked(m_hwnd, IDC_LEAVESTATUSMSG));
+ if (gg->gc_enabled)
+ gg->setByte(GG_KEY_IGNORECONF, (uint8_t)IsDlgButtonChecked(m_hwnd, IDC_IGNORECONF));
+ gg->setByte(GG_KEY_IMGRECEIVE, (uint8_t)IsDlgButtonChecked(m_hwnd, IDC_IMGRECEIVE));
+ gg->setByte(GG_KEY_SHOWLINKS, (uint8_t)IsDlgButtonChecked(m_hwnd, IDC_SHOWLINKS));
+ if (IsDlgButtonChecked(m_hwnd, IDC_SHOWLINKS))
+ status_flags |= GG_STATUS_FLAG_SPAM;
+ gg->gg_EnterCriticalSection(&gg->sess_mutex, "gg_genoptsdlgproc", 34, "sess_mutex", 1);
+ gg_change_status_flags(gg->m_sess, status_flags);
+ gg->gg_LeaveCriticalSection(&gg->sess_mutex, "gg_genoptsdlgproc", 34, 1, "sess_mutex", 1);
+ gg->setByte(GG_KEY_ENABLEAVATARS, (uint8_t)IsDlgButtonChecked(m_hwnd, IDC_ENABLEAVATARS));
+
+ gg->setByte(GG_KEY_IMGMETHOD, (uint8_t)SendDlgItemMessage(m_hwnd, IDC_IMGMETHOD, CB_GETCURSEL, 0, 0));
+
+ // Write leave status
+ switch (SendDlgItemMessage(m_hwnd, IDC_LEAVESTATUS, CB_GETCURSEL, 0, 0)) {
+ case 1:
+ gg->setWord(GG_KEY_LEAVESTATUS, ID_STATUS_ONLINE);
+ break;
+ case 2:
+ gg->setWord(GG_KEY_LEAVESTATUS, ID_STATUS_AWAY);
+ break;
+ case 3:
+ gg->setWord(GG_KEY_LEAVESTATUS, ID_STATUS_DND);
+ break;
+ case 4:
+ gg->setWord(GG_KEY_LEAVESTATUS, ID_STATUS_FREECHAT);
+ break;
+ case 5:
+ gg->setWord(GG_KEY_LEAVESTATUS, ID_STATUS_INVISIBLE);
+ break;
+ default:
+ gg->setWord(GG_KEY_LEAVESTATUS, GG_KEYDEF_LEAVESTATUS);
+ }
+ }
+ break;
+ }
+ return FALSE;
}
-bool GaduOptionsDlgConference::OnApply()
+////////////////////////////////////////////////////////////////////////////////////////////
+// Proc: General options dialog
+
+class GaduOptionsDlgConference : public GaduDlgBase
{
- m_proto->setWord(GG_KEY_GC_POLICY_TOTAL, cmbPolicyForAllChatParticipants.GetCurData());
- m_proto->setWord(GG_KEY_GC_POLICY_UNKNOWN, cmbPolicyForUnknownChatParticipants.GetCurData());
- m_proto->setWord(GG_KEY_GC_POLICY_DEFAULT, cmbDefaultChatPolicy.GetCurData());
- return true;
-}
+ CCtrlCombo cmbPolicyForAllChatParticipants;
+ CCtrlSpin edtNumberOfAllChatParticipants;
+
+ CCtrlCombo cmbPolicyForUnknownChatParticipants;
+ CCtrlSpin edtNumberOfUnknownChatParticipants;
+
+ CCtrlCombo cmbDefaultChatPolicy;
+
+public:
+ GaduOptionsDlgConference(GaduProto *proto) :
+ GaduDlgBase(proto, IDD_OPT_GG_CONFERENCE),
+ cmbPolicyForAllChatParticipants(this, IDC_GC_POLICY_TOTAL),
+ edtNumberOfAllChatParticipants(this, IDC_GC_COUNT_TOTAL_SPIN, 250),
+ cmbPolicyForUnknownChatParticipants(this, IDC_GC_POLICY_UNKNOWN),
+ edtNumberOfUnknownChatParticipants(this, IDC_GC_COUNT_UNKNOWN_SPIN, 250),
+ cmbDefaultChatPolicy(this, IDC_GC_POLICY_DEFAULT)
+ {
+ CreateLink(cmbPolicyForAllChatParticipants, GG_KEY_GC_POLICY_TOTAL, DBVT_WORD, GG_KEYDEF_GC_POLICY_TOTAL);
+ CreateLink(edtNumberOfAllChatParticipants, GG_KEY_GC_COUNT_TOTAL, DBVT_WORD, GG_KEYDEF_GC_COUNT_TOTAL);
+
+ CreateLink(cmbPolicyForUnknownChatParticipants, GG_KEY_GC_POLICY_UNKNOWN, DBVT_WORD, GG_KEYDEF_GC_POLICY_UNKNOWN);
+ CreateLink(edtNumberOfUnknownChatParticipants, GG_KEY_GC_COUNT_UNKNOWN, DBVT_WORD, GG_KEYDEF_GC_COUNT_UNKNOWN);
+
+ CreateLink(cmbDefaultChatPolicy, GG_KEY_GC_POLICY_DEFAULT, DBVT_WORD, GG_KEYDEF_GC_POLICY_DEFAULT);
+ }
+
+ bool OnInitDialog() override
+ {
+ cmbPolicyForAllChatParticipants.AddString(TranslateT("Allow"), 0L);
+ cmbPolicyForAllChatParticipants.AddString(TranslateT("Ask"), 1L);
+ cmbPolicyForAllChatParticipants.AddString(TranslateT("Ignore"), 2L);
+ int listIndex = m_proto->getWord(GG_KEY_GC_POLICY_TOTAL, GG_KEYDEF_GC_POLICY_TOTAL);
+ cmbPolicyForAllChatParticipants.SetCurSel(listIndex);
+
+ cmbPolicyForUnknownChatParticipants.AddString(TranslateT("Allow"), 0L);
+ cmbPolicyForUnknownChatParticipants.AddString(TranslateT("Ask"), 1L);
+ cmbPolicyForUnknownChatParticipants.AddString(TranslateT("Ignore"), 2L);
+ listIndex = m_proto->getWord(GG_KEY_GC_POLICY_UNKNOWN, GG_KEYDEF_GC_POLICY_UNKNOWN);
+ cmbPolicyForUnknownChatParticipants.SetCurSel(listIndex);
+
+ cmbDefaultChatPolicy.AddString(TranslateT("Allow"), 0L);
+ cmbDefaultChatPolicy.AddString(TranslateT("Ask"), 1L);
+ cmbDefaultChatPolicy.AddString(TranslateT("Ignore"), 2L);
+ listIndex = m_proto->getWord(GG_KEY_GC_POLICY_DEFAULT, GG_KEYDEF_GC_POLICY_DEFAULT);
+ cmbDefaultChatPolicy.SetCurSel(listIndex);
+ return true;
+ }
+
+ bool OnApply() override
+ {
+ m_proto->setWord(GG_KEY_GC_POLICY_TOTAL, cmbPolicyForAllChatParticipants.GetCurData());
+ m_proto->setWord(GG_KEY_GC_POLICY_UNKNOWN, cmbPolicyForUnknownChatParticipants.GetCurData());
+ m_proto->setWord(GG_KEY_GC_POLICY_DEFAULT, cmbDefaultChatPolicy.GetCurData());
+ return true;
+ }
+};
/////////////////////////////////////////////////////////////////////////////////////////
-GaduOptionsDlgAdvanced::GaduOptionsDlgAdvanced(GaduProto *proto) :
- GaduDlgBase(proto, IDD_OPT_GG_ADVANCED),
- chkAutoReconnect(this, IDC_ARECONNECT),
- chkKeepConnectionAlive(this, IDC_KEEPALIVE),
- chkMsgAcknowledge(this, IDC_MSGACK),
- chkShowConnectionErrors(this, IDC_SHOWCERRORS),
- chkSslConnection(this, IDC_SSLCONN),
- chkManualHosts(this, IDC_MANUALHOST),
- edtServerHosts(this, IDC_HOST),
- txtServerHostsLabel(this, IDC_HOST_LIST_L),
- chkDirectConnections(this, IDC_DIRECTCONNS),
- edtDirectPort(this, IDC_DIRECTPORT),
- txtDirectPortLabel(this, IDC_DIRECTPORT_L),
- chkForwarding(this, IDC_FORWARDING),
- edtForwardHost(this, IDC_FORWARDHOST),
- txtForwardHostLabel(this, IDC_FORWARDHOST_L),
- edtForwardPort(this, IDC_FORWARDPORT),
- txtForwardPortLabel(this, IDC_FORWARDPORT_L),
- txtReconnectRequired(this, IDC_RELOADREQD)
+class GaduOptionsDlgAdvanced : public GaduDlgBase
{
- CreateLink(chkAutoReconnect, proto->m_gaduOptions.autoRecconect);
- CreateLink(chkKeepConnectionAlive, proto->m_gaduOptions.keepConnectionAlive);
- CreateLink(chkMsgAcknowledge, proto->m_gaduOptions.useMsgDeliveryAcknowledge);
- CreateLink(chkShowConnectionErrors, proto->m_gaduOptions.showConnectionErrors);
- CreateLink(chkSslConnection, proto->m_gaduOptions.useSslConnection);
-
- CreateLink(chkManualHosts, proto->m_gaduOptions.useManualHosts);
- CreateLink(edtServerHosts, proto->m_gaduOptions.serverHosts);
-
- CreateLink(chkDirectConnections, proto->m_gaduOptions.useDirectConnections);
- CreateLink(edtDirectPort, proto->m_gaduOptions.directConnectionPort);
-
- CreateLink(chkForwarding, proto->m_gaduOptions.useForwarding);
- CreateLink(edtForwardHost, proto->m_gaduOptions.forwardHost);
- CreateLink(edtForwardPort, proto->m_gaduOptions.forwardPort);
-
- chkManualHosts.OnChange = Callback(this, &GaduOptionsDlgAdvanced::onCheck_ManualHosts);
- chkDirectConnections.OnChange = Callback(this, &GaduOptionsDlgAdvanced::onCheck_DirectConnections);
- edtDirectPort.OnChange = Callback(this, &GaduOptionsDlgAdvanced::showRecconectRequired);
- chkForwarding.OnChange = Callback(this, &GaduOptionsDlgAdvanced::onCheck_Forwarding);
- edtForwardHost.OnChange = Callback(this, &GaduOptionsDlgAdvanced::showRecconectRequired);
- edtForwardPort.OnChange = Callback(this, &GaduOptionsDlgAdvanced::showRecconectRequired);
-}
+ CCtrlCheck chkAutoReconnect;
+ CCtrlCheck chkKeepConnectionAlive;
+ CCtrlCheck chkMsgAcknowledge;
+ CCtrlCheck chkShowConnectionErrors;
+ CCtrlCheck chkSslConnection;
-bool GaduOptionsDlgAdvanced::OnInitDialog()
-{
- chkKeepConnectionAlive.Disable();
- chkSslConnection.Disable();
-
- chkManualHosts.Disable();
- bool useManualHosts = chkManualHosts.GetState() && chkManualHosts.Enabled();
- edtServerHosts.Enable(useManualHosts);
- txtServerHostsLabel.Enable(useManualHosts);
-
- bool useDirectConnection = chkDirectConnections.GetState();
- edtDirectPort.Enable(useDirectConnection);
- txtDirectPortLabel.Enable(useDirectConnection);
- chkForwarding.Enable(useDirectConnection);
-
- bool useForwarding = useDirectConnection && chkForwarding.GetState();
- edtForwardHost.Enable(useForwarding);
- txtForwardHostLabel.Enable(useForwarding);
- edtForwardPort.Enable(useForwarding);
- txtForwardPortLabel.Enable(useForwarding);
-
- txtReconnectRequired.Hide();
- return true;
-}
+ CCtrlCheck chkManualHosts;
+ CCtrlEdit edtServerHosts;
+ CCtrlBase txtServerHostsLabel;
-void GaduOptionsDlgAdvanced::onCheck_ManualHosts(CCtrlCheck *)
-{
- bool useManualHosts = chkManualHosts.GetState();
- edtServerHosts.Enable(useManualHosts);
- txtServerHostsLabel.Enable(useManualHosts);
+ CCtrlCheck chkDirectConnections;
+ CCtrlEdit edtDirectPort;
+ CCtrlBase txtDirectPortLabel;
- showRecconectRequired();
-}
+ CCtrlCheck chkForwarding;
+ CCtrlEdit edtForwardHost;
+ CCtrlBase txtForwardHostLabel;
+ CCtrlEdit edtForwardPort;
+ CCtrlBase txtForwardPortLabel;
-void GaduOptionsDlgAdvanced::onCheck_DirectConnections(CCtrlCheck *)
-{
- bool useDirectConnection = chkDirectConnections.GetState();
- edtDirectPort.Enable(useDirectConnection);
- txtDirectPortLabel.Enable(useDirectConnection);
- chkForwarding.Enable(useDirectConnection);
-
- bool useForwarding = useDirectConnection && chkForwarding.GetState();
- edtForwardHost.Enable(useForwarding);
- txtForwardHostLabel.Enable(useForwarding);
- edtForwardPort.Enable(useForwarding);
- txtForwardPortLabel.Enable(useForwarding);
-
- showRecconectRequired();
-}
+ CCtrlBase txtReconnectRequired;
-void GaduOptionsDlgAdvanced::onCheck_Forwarding(CCtrlCheck *)
-{
- bool useForwarding = chkForwarding.GetState();
- edtForwardHost.Enable(useForwarding);
- txtForwardHostLabel.Enable(useForwarding);
- edtForwardPort.Enable(useForwarding);
- txtForwardPortLabel.Enable(useForwarding);
+public:
+ GaduOptionsDlgAdvanced(GaduProto *proto) :
+ GaduDlgBase(proto, IDD_OPT_GG_ADVANCED),
+ chkAutoReconnect(this, IDC_ARECONNECT),
+ chkKeepConnectionAlive(this, IDC_KEEPALIVE),
+ chkMsgAcknowledge(this, IDC_MSGACK),
+ chkShowConnectionErrors(this, IDC_SHOWCERRORS),
+ chkSslConnection(this, IDC_SSLCONN),
+ chkManualHosts(this, IDC_MANUALHOST),
+ edtServerHosts(this, IDC_HOST),
+ txtServerHostsLabel(this, IDC_HOST_LIST_L),
+ chkDirectConnections(this, IDC_DIRECTCONNS),
+ edtDirectPort(this, IDC_DIRECTPORT),
+ txtDirectPortLabel(this, IDC_DIRECTPORT_L),
+ chkForwarding(this, IDC_FORWARDING),
+ edtForwardHost(this, IDC_FORWARDHOST),
+ txtForwardHostLabel(this, IDC_FORWARDHOST_L),
+ edtForwardPort(this, IDC_FORWARDPORT),
+ txtForwardPortLabel(this, IDC_FORWARDPORT_L),
+ txtReconnectRequired(this, IDC_RELOADREQD)
+ {
+ CreateLink(chkAutoReconnect, proto->m_autoRecconect);
+ CreateLink(chkKeepConnectionAlive, proto->m_keepConnectionAlive);
+ CreateLink(chkMsgAcknowledge, proto->m_useMsgDeliveryAcknowledge);
+ CreateLink(chkShowConnectionErrors, proto->m_showConnectionErrors);
+ CreateLink(chkSslConnection, proto->m_useSslConnection);
- showRecconectRequired();
-}
+ CreateLink(chkManualHosts, proto->m_useManualHosts);
+ CreateLink(edtServerHosts, proto->m_serverHosts);
+
+ CreateLink(chkDirectConnections, proto->m_useDirectConnections);
+ CreateLink(edtDirectPort, proto->m_directConnectionPort);
+
+ CreateLink(chkForwarding, proto->m_useForwarding);
+ CreateLink(edtForwardHost, proto->m_forwardHost);
+ CreateLink(edtForwardPort, proto->m_forwardPort);
+
+ chkManualHosts.OnChange = Callback(this, &GaduOptionsDlgAdvanced::onCheck_ManualHosts);
+ chkDirectConnections.OnChange = Callback(this, &GaduOptionsDlgAdvanced::onCheck_DirectConnections);
+ edtDirectPort.OnChange = Callback(this, &GaduOptionsDlgAdvanced::showRecconectRequired);
+ chkForwarding.OnChange = Callback(this, &GaduOptionsDlgAdvanced::onCheck_Forwarding);
+ edtForwardHost.OnChange = Callback(this, &GaduOptionsDlgAdvanced::showRecconectRequired);
+ edtForwardPort.OnChange = Callback(this, &GaduOptionsDlgAdvanced::showRecconectRequired);
+ }
+
+ bool OnInitDialog() override
+ {
+ chkKeepConnectionAlive.Disable();
+ chkSslConnection.Disable();
+
+ chkManualHosts.Disable();
+ bool useManualHosts = chkManualHosts.GetState() && chkManualHosts.Enabled();
+ edtServerHosts.Enable(useManualHosts);
+ txtServerHostsLabel.Enable(useManualHosts);
+
+ bool useDirectConnection = chkDirectConnections.GetState();
+ edtDirectPort.Enable(useDirectConnection);
+ txtDirectPortLabel.Enable(useDirectConnection);
+ chkForwarding.Enable(useDirectConnection);
+
+ bool useForwarding = useDirectConnection && chkForwarding.GetState();
+ edtForwardHost.Enable(useForwarding);
+ txtForwardHostLabel.Enable(useForwarding);
+ edtForwardPort.Enable(useForwarding);
+ txtForwardPortLabel.Enable(useForwarding);
-void GaduOptionsDlgAdvanced::showRecconectRequired(CCtrlBase*)
+ txtReconnectRequired.Hide();
+ return true;
+ }
+
+ bool OnApply() override
+ {
+ if (!mir_wstrlen(ptrW(edtServerHosts.GetText()))) {
+ edtServerHosts.SetText(GG_KEYDEF_SERVERHOSTS);
+ m_proto->m_serverHosts = GG_KEYDEF_SERVERHOSTS;
+ }
+ return true;
+ }
+
+ void onCheck_ManualHosts(CCtrlCheck *)
+ {
+ bool useManualHosts = chkManualHosts.GetState();
+ edtServerHosts.Enable(useManualHosts);
+ txtServerHostsLabel.Enable(useManualHosts);
+
+ showRecconectRequired();
+ }
+
+ void onCheck_DirectConnections(CCtrlCheck *)
+ {
+ bool useDirectConnection = chkDirectConnections.GetState();
+ edtDirectPort.Enable(useDirectConnection);
+ txtDirectPortLabel.Enable(useDirectConnection);
+ chkForwarding.Enable(useDirectConnection);
+
+ bool useForwarding = useDirectConnection && chkForwarding.GetState();
+ edtForwardHost.Enable(useForwarding);
+ txtForwardHostLabel.Enable(useForwarding);
+ edtForwardPort.Enable(useForwarding);
+ txtForwardPortLabel.Enable(useForwarding);
+
+ showRecconectRequired();
+ }
+
+ void onCheck_Forwarding(CCtrlCheck *)
+ {
+ bool useForwarding = chkForwarding.GetState();
+ edtForwardHost.Enable(useForwarding);
+ txtForwardHostLabel.Enable(useForwarding);
+ edtForwardPort.Enable(useForwarding);
+ txtForwardPortLabel.Enable(useForwarding);
+
+ showRecconectRequired();
+ }
+
+ void showRecconectRequired(CCtrlBase* = nullptr)
+ {
+ txtReconnectRequired.Show();
+ }
+};
+
+////////////////////////////////////////////////////////////////////////////////
+// Options Page : Init
+
+int GaduProto::options_init(WPARAM wParam, LPARAM)
{
- txtReconnectRequired.Show();
+ OPTIONSDIALOGPAGE odp = {};
+ odp.flags = ODPF_UNICODE;
+ odp.position = 1003000;
+ odp.szGroup.w = LPGENW("Network");
+ odp.szTitle.w = m_tszUserName;
+ odp.dwInitParam = (LPARAM)this;
+ odp.flags = ODPF_UNICODE | ODPF_BOLDGROUPS | ODPF_DONTTRANSLATE;
+
+ odp.szTab.w = LPGENW("General");
+ odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_GG_GENERAL);
+ odp.pfnDlgProc = gg_genoptsdlgproc;
+ g_plugin.addOptions(wParam, &odp);
+
+ odp.pszTemplate = nullptr;
+
+ odp.szTab.w = LPGENW("Conference");
+ odp.position = 1;
+ odp.pDialog = new GaduOptionsDlgConference(this);
+ g_plugin.addOptions(wParam, &odp);
+
+ odp.szTab.w = LPGENW("Advanced");
+ odp.position = 2;
+ odp.pDialog = new GaduOptionsDlgAdvanced(this);
+ g_plugin.addOptions(wParam, &odp);
+
+ return 0;
}
diff --git a/protocols/Gadu-Gadu/src/options.h b/protocols/Gadu-Gadu/src/options.h
deleted file mode 100644
index 8061b8731a..0000000000
--- a/protocols/Gadu-Gadu/src/options.h
+++ /dev/null
@@ -1,81 +0,0 @@
-#pragma once
-
-#include "gg.h"
-
-struct GaduOptions
-{
- CMOption<uint8_t> autoRecconect;
- CMOption<uint8_t> keepConnectionAlive;
- CMOption<uint8_t> showConnectionErrors;
- CMOption<uint8_t> useDirectConnections;
- CMOption<uint8_t> useForwarding;
- CMOption<uint8_t> useManualHosts;
- CMOption<uint8_t> useMsgDeliveryAcknowledge;
- CMOption<uint8_t> useSslConnection;
-
- CMOption<uint16_t> directConnectionPort;
- CMOption<uint16_t> forwardPort;
-
- CMOption<wchar_t*> forwardHost;
- CMOption<wchar_t*> serverHosts;
-
- GaduOptions(PROTO_INTERFACE *proto);
-};
-
-using GaduDlgBase = CProtoDlgBase<GaduProto>;
-
-class GaduOptionsDlgConference : public GaduDlgBase
-{
-private:
- CCtrlCombo cmbPolicyForAllChatParticipants;
- CCtrlSpin edtNumberOfAllChatParticipants;
-
- CCtrlCombo cmbPolicyForUnknownChatParticipants;
- CCtrlSpin edtNumberOfUnknownChatParticipants;
-
- CCtrlCombo cmbDefaultChatPolicy;
-
-public:
- GaduOptionsDlgConference(GaduProto *proto);
-
- bool OnInitDialog() override;
- bool OnApply() override;
-};
-
-class GaduOptionsDlgAdvanced : public GaduDlgBase
-{
-private:
- CCtrlCheck chkAutoReconnect;
- CCtrlCheck chkKeepConnectionAlive;
- CCtrlCheck chkMsgAcknowledge;
- CCtrlCheck chkShowConnectionErrors;
- CCtrlCheck chkSslConnection;
-
- CCtrlCheck chkManualHosts;
- CCtrlEdit edtServerHosts;
- CCtrlBase txtServerHostsLabel;
-
- CCtrlCheck chkDirectConnections;
- CCtrlEdit edtDirectPort;
- CCtrlBase txtDirectPortLabel;
-
- CCtrlCheck chkForwarding;
- CCtrlEdit edtForwardHost;
- CCtrlBase txtForwardHostLabel;
- CCtrlEdit edtForwardPort;
- CCtrlBase txtForwardPortLabel;
-
- CCtrlBase txtReconnectRequired;
-
-public:
- GaduOptionsDlgAdvanced(GaduProto *proto);
-
- bool OnInitDialog() override;
-
-private:
- void onCheck_ManualHosts(CCtrlCheck*);
- void onCheck_DirectConnections(CCtrlCheck*);
- void onCheck_Forwarding(CCtrlCheck*);
-
- void showRecconectRequired(CCtrlBase* = nullptr);
-};
diff --git a/protocols/Gadu-Gadu/src/userutils.cpp b/protocols/Gadu-Gadu/src/userutils.cpp
index 8b51ba24b1..1b2a2d7569 100644
--- a/protocols/Gadu-Gadu/src/userutils.cpp
+++ b/protocols/Gadu-Gadu/src/userutils.cpp
@@ -204,7 +204,7 @@ void *gg_dochemail(GaduProto *gg, uin_t uin, char *password, char *email, char *
////////////////////////////////////////////////////////////////////////////////
// User Util Dlg Page : Data
-//
+
INT_PTR CALLBACK gg_userutildlgproc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
{
GGUSERUTILDLGDATA *dat = (GGUSERUTILDLGDATA *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);