summaryrefslogtreecommitdiff
path: root/plugins/SimpleStatusMsg
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2013-03-04 07:23:42 +0000
committerGeorge Hazan <george.hazan@gmail.com>2013-03-04 07:23:42 +0000
commit66cb770a982a2502456d10d73838df2b7239fd89 (patch)
treefc419dde94a9be3ebe8f2266ff46feb90d2bcbec /plugins/SimpleStatusMsg
parentbc256df33a57e585367edffe33d3e58d53f82ce8 (diff)
new subclassing functions applied to all plugins
git-svn-id: http://svn.miranda-ng.org/main/trunk@3880 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/SimpleStatusMsg')
-rw-r--r--plugins/SimpleStatusMsg/src/msgbox.cpp94
-rw-r--r--plugins/SimpleStatusMsg/src/options.cpp1998
2 files changed, 1034 insertions, 1058 deletions
diff --git a/plugins/SimpleStatusMsg/src/msgbox.cpp b/plugins/SimpleStatusMsg/src/msgbox.cpp
index c03ec64576..15f7bfb487 100644
--- a/plugins/SimpleStatusMsg/src/msgbox.cpp
+++ b/plugins/SimpleStatusMsg/src/msgbox.cpp
@@ -547,18 +547,15 @@ VOID APIENTRY HandlePopupMenu(HWND hwnd, POINT pt, HWND edit_control)
DestroyMenu(hmenu);
}
-static WNDPROC MainDlgProc;
-
static LRESULT CALLBACK EditBoxSubProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- switch (uMsg)
- {
- case WM_CONTEXTMENU:
+ switch (uMsg) {
+ case WM_CONTEXTMENU:
{
POINT pt = {(LONG)LOWORD(lParam), (LONG)HIWORD(lParam)};
RECT rc;
GetClientRect(hwndDlg, &rc);
-
+
if (pt.x == -1 && pt.y == -1)
{
GetCursorPos(&pt);
@@ -573,47 +570,47 @@ static LRESULT CALLBACK EditBoxSubProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L
if (PtInRect(&rc, pt))
HandlePopupMenu(hwndDlg, pt, GetDlgItem(GetParent(hwndDlg), IDC_EDIT1));
-
+
return 0;
}
- case WM_CHAR:
- if (wParam=='\n' && GetKeyState(VK_CONTROL) & 0x8000)
- {
- PostMessage(GetParent(hwndDlg), WM_COMMAND, IDC_OK, 0);
- return 0;
- }
- if (wParam == 1 && GetKeyState(VK_CONTROL) & 0x8000) // Ctrl + A
- {
- SendMessage(hwndDlg, EM_SETSEL, 0, -1);
- return 0;
- }
- if (wParam == 23 && GetKeyState(VK_CONTROL) & 0x8000) // Ctrl + W
- {
- SendMessage(GetParent(hwndDlg), WM_COMMAND, IDC_CANCEL, 0);
- return 0;
- }
- if (wParam == 127 && GetKeyState(VK_CONTROL) & 0x8000) // Ctrl + Backspace
- {
- DWORD start, end;
- TCHAR *text;
- int textLen;
- SendMessage(hwndDlg, EM_GETSEL, (WPARAM)&end, (LPARAM)(PDWORD)NULL);
- SendMessage(hwndDlg, WM_KEYDOWN, VK_LEFT, 0);
- SendMessage(hwndDlg, EM_GETSEL, (WPARAM)&start, (LPARAM)(PDWORD)NULL);
- textLen = GetWindowTextLength(hwndDlg);
- text = (TCHAR *)mir_alloc(sizeof(TCHAR) * (textLen + 1));
- GetWindowText(hwndDlg, text, textLen + 1);
- MoveMemory(text + start, text + end, sizeof(TCHAR) * (textLen + 1 - end));
- SetWindowText(hwndDlg, text);
- mir_free(text);
- SendMessage(hwndDlg, EM_SETSEL, start, start);
- SendMessage(GetParent(hwndDlg), WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(hwndDlg), EN_CHANGE), (LPARAM)hwndDlg);
- return 0;
- }
- break;
+ case WM_CHAR:
+ if (wParam=='\n' && GetKeyState(VK_CONTROL) & 0x8000)
+ {
+ PostMessage(GetParent(hwndDlg), WM_COMMAND, IDC_OK, 0);
+ return 0;
+ }
+ if (wParam == 1 && GetKeyState(VK_CONTROL) & 0x8000) // Ctrl + A
+ {
+ SendMessage(hwndDlg, EM_SETSEL, 0, -1);
+ return 0;
+ }
+ if (wParam == 23 && GetKeyState(VK_CONTROL) & 0x8000) // Ctrl + W
+ {
+ SendMessage(GetParent(hwndDlg), WM_COMMAND, IDC_CANCEL, 0);
+ return 0;
+ }
+ if (wParam == 127 && GetKeyState(VK_CONTROL) & 0x8000) // Ctrl + Backspace
+ {
+ DWORD start, end;
+ TCHAR *text;
+ int textLen;
+ SendMessage(hwndDlg, EM_GETSEL, (WPARAM)&end, (LPARAM)(PDWORD)NULL);
+ SendMessage(hwndDlg, WM_KEYDOWN, VK_LEFT, 0);
+ SendMessage(hwndDlg, EM_GETSEL, (WPARAM)&start, (LPARAM)(PDWORD)NULL);
+ textLen = GetWindowTextLength(hwndDlg);
+ text = (TCHAR *)mir_alloc(sizeof(TCHAR) * (textLen + 1));
+ GetWindowText(hwndDlg, text, textLen + 1);
+ MoveMemory(text + start, text + end, sizeof(TCHAR) * (textLen + 1 - end));
+ SetWindowText(hwndDlg, text);
+ mir_free(text);
+ SendMessage(hwndDlg, EM_SETSEL, start, start);
+ SendMessage(GetParent(hwndDlg), WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(hwndDlg), EN_CHANGE), (LPARAM)hwndDlg);
+ return 0;
+ }
+ break;
- case WM_LBUTTONDBLCLK:
+ case WM_LBUTTONDBLCLK:
{
MsgEditCtrl* mec = (MsgEditCtrl*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
if (mec != NULL)
@@ -625,7 +622,7 @@ static LRESULT CALLBACK EditBoxSubProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L
break;
}
- case WM_LBUTTONDOWN:
+ case WM_LBUTTONDOWN:
{
MsgEditCtrl* mec = (MsgEditCtrl*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
if (mec != NULL && UINT(clock() - mec->ctLastDblClk) < mec->uClocksPerDblClk)
@@ -636,14 +633,14 @@ static LRESULT CALLBACK EditBoxSubProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L
break;
}
- case WM_SETFOCUS:
+ case WM_SETFOCUS:
{
MsgEditCtrl* mec = (MsgEditCtrl*)mir_calloc(sizeof(MsgEditCtrl));
SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)mec);
break;
}
- case WM_KILLFOCUS:
+ case WM_KILLFOCUS:
{
MsgEditCtrl* mec = (MsgEditCtrl*)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
mir_free(mec);
@@ -653,7 +650,7 @@ static LRESULT CALLBACK EditBoxSubProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L
}
}
- return CallWindowProc(MainDlgProc, hwndDlg, uMsg, wParam, lParam);
+ return mir_callNextSubclass(hwndDlg, EditBoxSubProc, uMsg, wParam, lParam);
}
int AddToPredefined(HWND hwndDlg, struct MsgBoxData *data)
@@ -1168,7 +1165,7 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA
mir_free(init_data);
- MainDlgProc = (WNDPROC)SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_EDIT1), GWLP_WNDPROC, (LONG_PTR)EditBoxSubProc);
+ mir_subclassWindow( GetDlgItem(hwndDlg, IDC_EDIT1), EditBoxSubProc);
if (!init_data->m_bOnEvent && IsWindowEnabled(GetDlgItem(hwndDlg, IDC_EDIT1)))
{
SetFocus(GetDlgItem(hwndDlg, IDC_EDIT1));
@@ -1787,7 +1784,6 @@ INT_PTR CALLBACK AwayMsgBoxDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA
Skin_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_BIG, 0));
Skin_ReleaseIcon((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, 0));
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_EDIT1), GWLP_WNDPROC, (LONG_PTR)MainDlgProc);
if (msgbox_data)
mir_free(msgbox_data);
hwndSAMsgDialog = NULL;
diff --git a/plugins/SimpleStatusMsg/src/options.cpp b/plugins/SimpleStatusMsg/src/options.cpp
index 26b2c22349..76928064f3 100644
--- a/plugins/SimpleStatusMsg/src/options.cpp
+++ b/plugins/SimpleStatusMsg/src/options.cpp
@@ -24,8 +24,6 @@ extern UINT_PTR g_uUpdateMsgTimer;
extern VOID CALLBACK UpdateMsgTimerProc(HWND, UINT, UINT_PTR, DWORD);
extern VOID APIENTRY HandlePopupMenu(HWND hwnd, POINT pt, HWND edit_control);
-static WNDPROC OldDlgProc;
-
static void RebuildStatusMenu(void)
{
CLIST_INTERFACE* pcli = (CLIST_INTERFACE*)CallService(MS_CLIST_RETRIEVE_INTERFACE, 0, 0);
@@ -35,14 +33,13 @@ static void RebuildStatusMenu(void)
static LRESULT CALLBACK OptEditBoxSubProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- switch (uMsg)
- {
- case WM_CONTEXTMENU:
+ switch (uMsg) {
+ case WM_CONTEXTMENU:
{
POINT pt = {(LONG)LOWORD(lParam), (LONG)HIWORD(lParam)};
RECT rc;
GetClientRect(hwndDlg, &rc);
-
+
if (pt.x == -1 && pt.y == -1)
{
GetCursorPos(&pt);
@@ -57,38 +54,38 @@ static LRESULT CALLBACK OptEditBoxSubProc(HWND hwndDlg, UINT uMsg, WPARAM wParam
if (PtInRect(&rc, pt))
HandlePopupMenu(hwndDlg, pt, GetDlgItem(GetParent(hwndDlg), IDC_OPTEDIT1));
-
+
return 0;
}
- case WM_CHAR:
- if (wParam == 1 && GetKeyState(VK_CONTROL) & 0x8000) // Ctrl + A
- {
- SendMessage(hwndDlg, EM_SETSEL, 0, -1);
- return 0;
- }
- if (wParam == 127 && GetKeyState(VK_CONTROL) & 0x8000) // Ctrl + Backspace
- {
- DWORD start, end;
- TCHAR *text;
- int textLen;
- SendMessage(hwndDlg, EM_GETSEL, (WPARAM)&end, (LPARAM)(PDWORD)NULL);
- SendMessage(hwndDlg, WM_KEYDOWN, VK_LEFT, 0);
- SendMessage(hwndDlg, EM_GETSEL, (WPARAM)&start, (LPARAM)(PDWORD)NULL);
- textLen = GetWindowTextLength(hwndDlg);
- text = (TCHAR *)mir_alloc(sizeof(TCHAR) * (textLen + 1));
- GetWindowText(hwndDlg, text, textLen + 1);
- MoveMemory(text + start, text + end, sizeof(TCHAR) * (textLen + 1 - end));
- SetWindowText(hwndDlg, text);
- mir_free(text);
- SendMessage(hwndDlg, EM_SETSEL, start, start);
- SendMessage(GetParent(hwndDlg), WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(hwndDlg), EN_CHANGE), (LPARAM)hwndDlg);
- return 0;
- }
- break;
+ case WM_CHAR:
+ if (wParam == 1 && GetKeyState(VK_CONTROL) & 0x8000) // Ctrl + A
+ {
+ SendMessage(hwndDlg, EM_SETSEL, 0, -1);
+ return 0;
+ }
+ if (wParam == 127 && GetKeyState(VK_CONTROL) & 0x8000) // Ctrl + Backspace
+ {
+ DWORD start, end;
+ TCHAR *text;
+ int textLen;
+ SendMessage(hwndDlg, EM_GETSEL, (WPARAM)&end, (LPARAM)(PDWORD)NULL);
+ SendMessage(hwndDlg, WM_KEYDOWN, VK_LEFT, 0);
+ SendMessage(hwndDlg, EM_GETSEL, (WPARAM)&start, (LPARAM)(PDWORD)NULL);
+ textLen = GetWindowTextLength(hwndDlg);
+ text = (TCHAR *)mir_alloc(sizeof(TCHAR) * (textLen + 1));
+ GetWindowText(hwndDlg, text, textLen + 1);
+ MoveMemory(text + start, text + end, sizeof(TCHAR) * (textLen + 1 - end));
+ SetWindowText(hwndDlg, text);
+ mir_free(text);
+ SendMessage(hwndDlg, EM_SETSEL, start, start);
+ SendMessage(GetParent(hwndDlg), WM_COMMAND, MAKEWPARAM(GetDlgCtrlID(hwndDlg), EN_CHANGE), (LPARAM)hwndDlg);
+ return 0;
+ }
+ break;
}
- return CallWindowProc(OldDlgProc, hwndDlg, uMsg, wParam, lParam);
+ return mir_callNextSubclass(hwndDlg, OptEditBoxSubProc, uMsg, wParam, lParam);
}
struct SingleProtoMsg
@@ -115,9 +112,8 @@ static INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L
{
struct OptDlgData *data = (struct OptDlgData *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- switch (uMsg)
- {
- case WM_INITDIALOG:
+ switch (uMsg) {
+ case WM_INITDIALOG:
{
int val, i, index;
DBVARIANT dbv;
@@ -193,7 +189,7 @@ static INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L
data->proto_ok = TRUE;
index = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_ADDSTRING, 0, (LPARAM)TranslateT("Global status change"));
-// SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_SETITEMDATA, index, 0);
+ // SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_SETITEMDATA, index, 0);
if (index != CB_ERR && index != CB_ERRSPACE)
{
data->proto_msg[0].msg = NULL;
@@ -215,7 +211,7 @@ static INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L
}
index = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_ADDSTRING, 0, (LPARAM)accounts->pa[i]->tszAccountName);
-// SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_SETITEMDATA, index, (LPARAM)i + 1);
+ // SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_SETITEMDATA, index, (LPARAM)i + 1);
if (index != CB_ERR && index != CB_ERRSPACE)
{
mir_snprintf(setting, SIZEOF(setting), "Proto%sDefault", accounts->pa[i]->szModuleName);
@@ -239,7 +235,7 @@ static INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L
if (accounts->statusMsgCount == 1)
{
-// ShowWindow(GetDlgItem(hwndDlg, IDC_BOPTPROTO), SW_HIDE);
+ // ShowWindow(GetDlgItem(hwndDlg, IDC_BOPTPROTO), SW_HIDE);
EnableWindow(GetDlgItem(hwndDlg, IDC_BOPTPROTO), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), FALSE);
SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_SETCURSEL, 1, 0);
@@ -278,856 +274,847 @@ static INT_PTR CALLBACK DlgOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, L
}
ShowWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), ServiceExists(MS_VARS_FORMATSTRING));
- OldDlgProc = (WNDPROC)SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_OPTEDIT1), GWLP_WNDPROC, (LONG_PTR)OptEditBoxSubProc);
-
+ mir_subclassWindow( GetDlgItem(hwndDlg, IDC_OPTEDIT1), OptEditBoxSubProc);
return TRUE;
}
- case WM_COMMAND:
- if ( ( (HIWORD(wParam) == BN_CLICKED) || /*(HIWORD(wParam) == EN_KILLFOCUS) ||*/ (HIWORD(wParam) == EN_CHANGE)
- || ( (HIWORD(wParam) == CBN_SELCHANGE) && (LOWORD(wParam) != IDC_CBOPTPROTO) && (LOWORD(wParam) != IDC_CBOPTSTATUS))
- ) && (HWND)lParam == GetFocus())
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- switch (LOWORD(wParam))
+ case WM_COMMAND:
+ if ( ( (HIWORD(wParam) == BN_CLICKED) || /*(HIWORD(wParam) == EN_KILLFOCUS) ||*/ (HIWORD(wParam) == EN_CHANGE)
+ || ( (HIWORD(wParam) == CBN_SELCHANGE) && (LOWORD(wParam) != IDC_CBOPTPROTO) && (LOWORD(wParam) != IDC_CBOPTSTATUS))
+ ) && (HWND)lParam == GetFocus())
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ switch (LOWORD(wParam)) {
+ case IDC_EMAXLENGTH:
+ switch (HIWORD(wParam)) {
+ case EN_KILLFOCUS:
+ {
+ BOOL translated;
+ int val, i;
+
+ val = GetDlgItemInt(hwndDlg, IDC_EMAXLENGTH, &translated, FALSE);
+ if (translated && val > 1024)
+ SetDlgItemInt(hwndDlg, IDC_EMAXLENGTH, 1024, FALSE);
+ if (translated && val < 1)
+ SetDlgItemInt(hwndDlg, IDC_EMAXLENGTH, 1, FALSE);
+ val = GetDlgItemInt(hwndDlg, IDC_EMAXLENGTH, &translated, FALSE);
+
+ i = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_GETITEMDATA, (WPARAM)SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_GETCURSEL, 0, 0), 0);
+ data->proto_msg[i].max_length = val;
+ break;
+ }
+ }
+ break;
+
+ case IDC_CBOPTPROTO:
+ switch (HIWORD(wParam))
{
- case IDC_EMAXLENGTH:
- switch (HIWORD(wParam))
+ case CBN_SELCHANGE:
+ case CBN_SELENDOK:
+ {
+ int i, j, l, k, status_modes = 0, newindex = 0;
+
+ i = SendMessage((HWND)lParam, CB_GETITEMDATA, (WPARAM)SendMessage((HWND)lParam, CB_GETCURSEL, 0, 0), 0);
+
+ if (i == 0)
{
- case EN_KILLFOCUS:
- {
- BOOL translated;
- int val, i;
-
- val = GetDlgItemInt(hwndDlg, IDC_EMAXLENGTH, &translated, FALSE);
- if (translated && val > 1024)
- SetDlgItemInt(hwndDlg, IDC_EMAXLENGTH, 1024, FALSE);
- if (translated && val < 1)
- SetDlgItemInt(hwndDlg, IDC_EMAXLENGTH, 1, FALSE);
- val = GetDlgItemInt(hwndDlg, IDC_EMAXLENGTH, &translated, FALSE);
-
- i = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_GETITEMDATA, (WPARAM)SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_GETCURSEL, 0, 0), 0);
- data->proto_msg[i].max_length = val;
- break;
- }
+ EnableWindow(GetDlgItem(hwndDlg, IDC_MAXLENGTH), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_EMAXLENGTH), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_SMAXLENGTH), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTPROTO3), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTPROTO4), FALSE);
+ SetDlgItemInt(hwndDlg, IDC_EMAXLENGTH, 1024, FALSE);
+
+ if (data->proto_msg[i].flags & PROTO_POPUPDLG)
+ CheckRadioButton(hwndDlg, IDC_ROPTPROTO1, IDC_ROPTPROTO4, IDC_ROPTPROTO1);
+ else if (data->proto_msg[i].flags & PROTO_NOCHANGE)
+ CheckRadioButton(hwndDlg, IDC_ROPTPROTO1, IDC_ROPTPROTO4, IDC_ROPTPROTO2);
+ }
+ else
+ {
+ EnableWindow(GetDlgItem(hwndDlg, IDC_MAXLENGTH), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_EMAXLENGTH), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_SMAXLENGTH), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTPROTO3), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTPROTO4), TRUE);
+ SetDlgItemInt(hwndDlg, IDC_EMAXLENGTH, data->proto_msg[i].max_length, FALSE);
+
+ if (data->proto_msg[i].flags & PROTO_POPUPDLG)
+ CheckRadioButton(hwndDlg, IDC_ROPTPROTO1, IDC_ROPTPROTO4, IDC_ROPTPROTO1);
+ else if (data->proto_msg[i].flags & PROTO_NOCHANGE)
+ CheckRadioButton(hwndDlg, IDC_ROPTPROTO1, IDC_ROPTPROTO4, IDC_ROPTPROTO2);
+ else if (data->proto_msg[i].flags & PROTO_THIS_MSG)
+ CheckRadioButton(hwndDlg, IDC_ROPTPROTO1, IDC_ROPTPROTO4, IDC_ROPTPROTO3);
+ else if (data->proto_msg[i].flags & PROTO_NO_MSG)
+ CheckRadioButton(hwndDlg, IDC_ROPTPROTO1, IDC_ROPTPROTO4, IDC_ROPTPROTO4);
}
- break;
- case IDC_CBOPTPROTO:
- switch (HIWORD(wParam))
+ if (data->proto_msg[i].flags & PROTO_NO_MSG || data->proto_msg[i].flags & PROTO_THIS_MSG
+ || data->proto_msg[i].flags & PROTO_NOCHANGE)
{
- case CBN_SELCHANGE:
- case CBN_SELENDOK:
- {
- int i, j, l, k, status_modes = 0, newindex = 0;
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_BOPTSTATUS), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_COPTMSG1), FALSE);
- i = SendMessage((HWND)lParam, CB_GETITEMDATA, (WPARAM)SendMessage((HWND)lParam, CB_GETCURSEL, 0, 0), 0);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG1), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG2), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG3), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG5), FALSE);
- if (i == 0)
- {
- EnableWindow(GetDlgItem(hwndDlg, IDC_MAXLENGTH), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_EMAXLENGTH), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_SMAXLENGTH), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTPROTO3), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTPROTO4), FALSE);
- SetDlgItemInt(hwndDlg, IDC_EMAXLENGTH, 1024, FALSE);
-
- if (data->proto_msg[i].flags & PROTO_POPUPDLG)
- CheckRadioButton(hwndDlg, IDC_ROPTPROTO1, IDC_ROPTPROTO4, IDC_ROPTPROTO1);
- else if (data->proto_msg[i].flags & PROTO_NOCHANGE)
- CheckRadioButton(hwndDlg, IDC_ROPTPROTO1, IDC_ROPTPROTO4, IDC_ROPTPROTO2);
- }
- else
- {
- EnableWindow(GetDlgItem(hwndDlg, IDC_MAXLENGTH), TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_EMAXLENGTH), TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_SMAXLENGTH), TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTPROTO3), TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTPROTO4), TRUE);
- SetDlgItemInt(hwndDlg, IDC_EMAXLENGTH, data->proto_msg[i].max_length, FALSE);
-
- if (data->proto_msg[i].flags & PROTO_POPUPDLG)
- CheckRadioButton(hwndDlg, IDC_ROPTPROTO1, IDC_ROPTPROTO4, IDC_ROPTPROTO1);
- else if (data->proto_msg[i].flags & PROTO_NOCHANGE)
- CheckRadioButton(hwndDlg, IDC_ROPTPROTO1, IDC_ROPTPROTO4, IDC_ROPTPROTO2);
- else if (data->proto_msg[i].flags & PROTO_THIS_MSG)
- CheckRadioButton(hwndDlg, IDC_ROPTPROTO1, IDC_ROPTPROTO4, IDC_ROPTPROTO3);
- else if (data->proto_msg[i].flags & PROTO_NO_MSG)
- CheckRadioButton(hwndDlg, IDC_ROPTPROTO1, IDC_ROPTPROTO4, IDC_ROPTPROTO4);
- }
+ if (data->proto_msg[i].flags & PROTO_NO_MSG || data->proto_msg[i].flags & PROTO_NOCHANGE)
+ {
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG4), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
+ }
+ else
+ {
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG4), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), TRUE);
+ }
- if (data->proto_msg[i].flags & PROTO_NO_MSG || data->proto_msg[i].flags & PROTO_THIS_MSG
- || data->proto_msg[i].flags & PROTO_NOCHANGE)
- {
- EnableWindow(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_BOPTSTATUS), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_COPTMSG1), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_COPTMSG2), FALSE);
+ }
+ else
+ {
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_BOPTSTATUS), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_COPTMSG1), TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG1), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG2), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG3), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG5), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG1), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG2), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG3), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG4), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG5), TRUE);
- if (data->proto_msg[i].flags & PROTO_NO_MSG || data->proto_msg[i].flags & PROTO_NOCHANGE)
- {
- EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG4), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
- }
- else
- {
- EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG4), TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), TRUE);
- }
+ EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_COPTMSG2), FALSE);
- }
- else
- {
- EnableWindow(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_BOPTSTATUS), TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_COPTMSG1), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_COPTMSG2), TRUE);
+ }
- EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG1), TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG2), TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG3), TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG4), TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG5), TRUE);
+ if (i)
+ {
+ k = i - 1;
+ status_modes = CallProtoService(accounts->pa[k]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0);
+ }
+ else
+ status_modes = accounts->statusMsgFlags;
- EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
+ j = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_GETITEMDATA, (WPARAM)SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_GETCURSEL, 0, 0), 0);
+ SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_RESETCONTENT, 0, 0);
- EnableWindow(GetDlgItem(hwndDlg, IDC_COPTMSG2), TRUE);
- }
+ for (l=ID_STATUS_ONLINE; l<=ID_STATUS_OUTTOLUNCH; l++)
+ {
+ int index;
+ if (status_modes & Proto_Status2Flag(l))
+ {
+ index = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_INSERTSTRING, -1, (LPARAM)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, l, GSMDF_TCHAR));
- if (i)
+ if (index != CB_ERR && index != CB_ERRSPACE)
{
- k = i - 1;
- status_modes = CallProtoService(accounts->pa[k]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0);
+ SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_SETITEMDATA, (WPARAM)index, (LPARAM)l - ID_STATUS_ONLINE);
+ if (j == l-ID_STATUS_ONLINE)
+ newindex=index;
}
- else
- status_modes = accounts->statusMsgFlags;
-
- j = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_GETITEMDATA, (WPARAM)SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_GETCURSEL, 0, 0), 0);
- SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_RESETCONTENT, 0, 0);
+ }
+ }
- for (l=ID_STATUS_ONLINE; l<=ID_STATUS_OUTTOLUNCH; l++)
- {
- int index;
- if (status_modes & Proto_Status2Flag(l))
- {
- index = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_INSERTSTRING, -1, (LPARAM)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, l, GSMDF_TCHAR));
+ if (!newindex)
+ {
+ SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_SETCURSEL, 0, 0);
+ j = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_GETITEMDATA, (WPARAM)SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_GETCURSEL, 0, 0), 0);
+ }
+ else
+ SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_SETCURSEL, (WPARAM)newindex, 0);
- if (index != CB_ERR && index != CB_ERRSPACE)
- {
- SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_SETITEMDATA, (WPARAM)index, (LPARAM)l - ID_STATUS_ONLINE);
- if (j == l-ID_STATUS_ONLINE)
- newindex=index;
- }
- }
- }
+ if (data->status_msg[i].flags[j] & STATUS_SHOW_DLG)
+ CheckDlgButton(hwndDlg, IDC_COPTMSG1, BST_CHECKED);
+ else
+ CheckDlgButton(hwndDlg, IDC_COPTMSG1, BST_UNCHECKED);
- if (!newindex)
- {
- SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_SETCURSEL, 0, 0);
- j = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_GETITEMDATA, (WPARAM)SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_GETCURSEL, 0, 0), 0);
- }
- else
- SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_SETCURSEL, (WPARAM)newindex, 0);
+ if (data->proto_msg[i].flags & PROTO_THIS_MSG)
+ {
+ CheckRadioButton(hwndDlg, IDC_ROPTMSG1, IDC_ROPTMSG5, IDC_ROPTMSG4);
+ if (data->proto_msg[i].msg)
+ SetDlgItemText(hwndDlg, IDC_OPTEDIT1, data->proto_msg[i].msg);
+ else
+ SetDlgItemText(hwndDlg, IDC_OPTEDIT1, _T(""));
+ }
+ else
+ {
+ if (data->status_msg[i].flags[j] & STATUS_EMPTY_MSG)
+ {
+ SetDlgItemText(hwndDlg, IDC_OPTEDIT1, _T(""));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
+ CheckRadioButton(hwndDlg, IDC_ROPTMSG1, IDC_ROPTMSG5, IDC_ROPTMSG1);
+ }
+ else if (data->status_msg[i].flags[j] & STATUS_DEFAULT_MSG)
+ {
+ SetDlgItemText(hwndDlg, IDC_OPTEDIT1, GetDefaultMessage(j+ID_STATUS_ONLINE));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
+ CheckRadioButton(hwndDlg, IDC_ROPTMSG1, IDC_ROPTMSG5, IDC_ROPTMSG2);
+ }
+ else if (data->status_msg[i].flags[j] & STATUS_LAST_MSG)
+ {
+ char setting[80];
+ DBVARIANT dbv, dbv2;
- if (data->status_msg[i].flags[j] & STATUS_SHOW_DLG)
- CheckDlgButton(hwndDlg, IDC_COPTMSG1, BST_CHECKED);
+ if (i)
+ mir_snprintf(setting, SIZEOF(setting), "Last%sMsg", accounts->pa[k]->szModuleName);
else
- CheckDlgButton(hwndDlg, IDC_COPTMSG1, BST_UNCHECKED);
+ mir_snprintf(setting, SIZEOF(setting), "LastMsg");
- if (data->proto_msg[i].flags & PROTO_THIS_MSG)
- {
- CheckRadioButton(hwndDlg, IDC_ROPTMSG1, IDC_ROPTMSG5, IDC_ROPTMSG4);
- if (data->proto_msg[i].msg)
- SetDlgItemText(hwndDlg, IDC_OPTEDIT1, data->proto_msg[i].msg);
- else
- SetDlgItemText(hwndDlg, IDC_OPTEDIT1, _T(""));
- }
- else
+ SetDlgItemText(hwndDlg, IDC_OPTEDIT1, _T(""));
+ if (!DBGetContactSetting(NULL, "SimpleStatusMsg", setting, &dbv))
{
- if (data->status_msg[i].flags[j] & STATUS_EMPTY_MSG)
+ if (dbv.pszVal)
{
- SetDlgItemText(hwndDlg, IDC_OPTEDIT1, _T(""));
- EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
- CheckRadioButton(hwndDlg, IDC_ROPTMSG1, IDC_ROPTMSG5, IDC_ROPTMSG1);
- }
- else if (data->status_msg[i].flags[j] & STATUS_DEFAULT_MSG)
- {
- SetDlgItemText(hwndDlg, IDC_OPTEDIT1, GetDefaultMessage(j+ID_STATUS_ONLINE));
- EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
- CheckRadioButton(hwndDlg, IDC_ROPTMSG1, IDC_ROPTMSG5, IDC_ROPTMSG2);
- }
- else if (data->status_msg[i].flags[j] & STATUS_LAST_MSG)
- {
- char setting[80];
- DBVARIANT dbv, dbv2;
-
- if (i)
- mir_snprintf(setting, SIZEOF(setting), "Last%sMsg", accounts->pa[k]->szModuleName);
- else
- mir_snprintf(setting, SIZEOF(setting), "LastMsg");
-
- SetDlgItemText(hwndDlg, IDC_OPTEDIT1, _T(""));
- if (!DBGetContactSetting(NULL, "SimpleStatusMsg", setting, &dbv))
- {
- if (dbv.pszVal)
- {
- if (!DBGetContactSettingTString(NULL, "SimpleStatusMsg", dbv.pszVal, &dbv2) && strlen(dbv.pszVal))
- {
- if ((dbv2.ptszVal) && (lstrlen(dbv2.ptszVal)))
- SetDlgItemText(hwndDlg, IDC_OPTEDIT1, dbv2.ptszVal);
-
- DBFreeVariant(&dbv2);
- }
- }
- DBFreeVariant(&dbv);
- }
- EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
- CheckRadioButton(hwndDlg, IDC_ROPTMSG1, IDC_ROPTMSG5, IDC_ROPTMSG3);
- }
- else if (data->status_msg[i].flags[j] & STATUS_THIS_MSG)
- {
- if (data->proto_msg[i].flags & PROTO_NO_MSG || data->proto_msg[i].flags & PROTO_NOCHANGE)
+ if (!DBGetContactSettingTString(NULL, "SimpleStatusMsg", dbv.pszVal, &dbv2) && strlen(dbv.pszVal))
{
- EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
- }
- else
- {
- EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), TRUE);
- }
- CheckRadioButton(hwndDlg, IDC_ROPTMSG1, IDC_ROPTMSG5, IDC_ROPTMSG4);
- SetDlgItemText(hwndDlg, IDC_OPTEDIT1, data->status_msg[i].msg[j]);
- }
- else if (data->status_msg[i].flags[j] & STATUS_LAST_STATUS_MSG)
- {
- char setting[80];
- DBVARIANT dbv;
-
- if (i)
- mir_snprintf(setting, SIZEOF(setting), "%sMsg", accounts->pa[k]->szModuleName);
- else
- mir_snprintf(setting, SIZEOF(setting), "Msg");
+ if ((dbv2.ptszVal) && (lstrlen(dbv2.ptszVal)))
+ SetDlgItemText(hwndDlg, IDC_OPTEDIT1, dbv2.ptszVal);
- if (!DBGetContactSettingTString(NULL, "SRAway", StatusModeToDbSetting(j + ID_STATUS_ONLINE, setting), &dbv))
- {
- SetDlgItemText(hwndDlg, IDC_OPTEDIT1, dbv.ptszVal);
- DBFreeVariant(&dbv);
+ DBFreeVariant(&dbv2);
}
- else
- SetDlgItemText(hwndDlg, IDC_OPTEDIT1, _T(""));
-
- EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
- CheckRadioButton(hwndDlg, IDC_ROPTMSG1, IDC_ROPTMSG5, IDC_ROPTMSG5);
}
+ DBFreeVariant(&dbv);
}
- break;
+ EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
+ CheckRadioButton(hwndDlg, IDC_ROPTMSG1, IDC_ROPTMSG5, IDC_ROPTMSG3);
}
- }
- break;
-
- case IDC_ROPTPROTO1:
- case IDC_ROPTPROTO2:
- case IDC_ROPTPROTO3:
- case IDC_ROPTPROTO4:
- switch (HIWORD(wParam))
- {
- case BN_CLICKED:
+ else if (data->status_msg[i].flags[j] & STATUS_THIS_MSG)
{
- int i, j;
-
- i = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_GETITEMDATA, (WPARAM)SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_GETCURSEL, 0, 0), 0);
- j = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_GETITEMDATA, (WPARAM)SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_GETCURSEL, 0, 0), 0);
-
- data->proto_msg[i].flags = 0;
-
- if ((LOWORD(wParam) == IDC_ROPTPROTO2) || (LOWORD(wParam) == IDC_ROPTPROTO4))
+ if (data->proto_msg[i].flags & PROTO_NO_MSG || data->proto_msg[i].flags & PROTO_NOCHANGE)
{
- data->proto_msg[i].flags |= (LOWORD(wParam) == IDC_ROPTPROTO4) ? PROTO_NO_MSG : PROTO_NOCHANGE;
- EnableWindow(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_BOPTSTATUS), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_COPTMSG1), FALSE);
-
- EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG1), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG2), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG3), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG4), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG5), FALSE);
-
- EnableWindow(GetDlgItem(hwndDlg, IDC_COPTMSG2), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
}
- else if (LOWORD(wParam) == IDC_ROPTPROTO3)
+ else
{
- data->proto_msg[i].flags |= PROTO_THIS_MSG;
EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), TRUE);
EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), TRUE);
- if (data->proto_msg[i].msg)
- SetDlgItemText(hwndDlg, IDC_OPTEDIT1, data->proto_msg[i].msg);
- else
- SetDlgItemText(hwndDlg, IDC_OPTEDIT1, _T(""));
- EnableWindow(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_BOPTSTATUS), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_COPTMSG1), FALSE);
-
- EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG1), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG2), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG3), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG4), TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG5), FALSE);
- CheckRadioButton(hwndDlg, IDC_ROPTMSG1, IDC_ROPTMSG5, IDC_ROPTMSG4);
-
- EnableWindow(GetDlgItem(hwndDlg, IDC_COPTMSG2), FALSE);
- }
- else if (LOWORD(wParam) == IDC_ROPTPROTO1)
- {
- data->proto_msg[i].flags |= PROTO_POPUPDLG;
- EnableWindow(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_BOPTSTATUS), TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_COPTMSG1), TRUE);
-
- EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG1), TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG2), TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG3), TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG4), TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG5), TRUE);
-
- EnableWindow(GetDlgItem(hwndDlg, IDC_COPTMSG2), TRUE);
}
+ CheckRadioButton(hwndDlg, IDC_ROPTMSG1, IDC_ROPTMSG5, IDC_ROPTMSG4);
+ SetDlgItemText(hwndDlg, IDC_OPTEDIT1, data->status_msg[i].msg[j]);
+ }
+ else if (data->status_msg[i].flags[j] & STATUS_LAST_STATUS_MSG)
+ {
+ char setting[80];
+ DBVARIANT dbv;
- if (LOWORD(wParam) != IDC_ROPTPROTO3)
+ if (i)
+ mir_snprintf(setting, SIZEOF(setting), "%sMsg", accounts->pa[k]->szModuleName);
+ else
+ mir_snprintf(setting, SIZEOF(setting), "Msg");
+
+ if (!DBGetContactSettingTString(NULL, "SRAway", StatusModeToDbSetting(j + ID_STATUS_ONLINE, setting), &dbv))
{
- if (data->status_msg[i].flags[j] & STATUS_EMPTY_MSG)
- {
- SetDlgItemText(hwndDlg, IDC_OPTEDIT1, _T(""));
- EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
- CheckRadioButton(hwndDlg, IDC_ROPTMSG1, IDC_ROPTMSG5, IDC_ROPTMSG1);
- }
- else if (data->status_msg[i].flags[j] & STATUS_DEFAULT_MSG)
- {
- SetDlgItemText(hwndDlg, IDC_OPTEDIT1, GetDefaultMessage(j+ID_STATUS_ONLINE));
- EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
- CheckRadioButton(hwndDlg, IDC_ROPTMSG1, IDC_ROPTMSG5, IDC_ROPTMSG2);
- }
- else if (data->status_msg[i].flags[j] & STATUS_LAST_MSG)
- {
- char setting[80];
- DBVARIANT dbv, dbv2;
+ SetDlgItemText(hwndDlg, IDC_OPTEDIT1, dbv.ptszVal);
+ DBFreeVariant(&dbv);
+ }
+ else
+ SetDlgItemText(hwndDlg, IDC_OPTEDIT1, _T(""));
- if (i)
- mir_snprintf(setting, SIZEOF(setting), "Last%sMsg", accounts->pa[i-1]->szModuleName);
- else
- mir_snprintf(setting, SIZEOF(setting), "LastMsg");
+ EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
+ CheckRadioButton(hwndDlg, IDC_ROPTMSG1, IDC_ROPTMSG5, IDC_ROPTMSG5);
+ }
+ }
+ break;
+ }
+ }
+ break;
- SetDlgItemText(hwndDlg, IDC_OPTEDIT1, _T(""));
- if (!DBGetContactSetting(NULL, "SimpleStatusMsg", setting, &dbv))
- {
- if (dbv.pszVal)
- {
- if (!DBGetContactSettingTString(NULL, "SimpleStatusMsg", dbv.pszVal, &dbv2) && strlen(dbv.pszVal))
- {
- if (dbv2.ptszVal && lstrlen(dbv2.ptszVal))
- SetDlgItemText(hwndDlg, IDC_OPTEDIT1, dbv2.ptszVal);
- DBFreeVariant(&dbv2);
- }
- }
- DBFreeVariant(&dbv);
- }
- EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
- CheckRadioButton(hwndDlg, IDC_ROPTMSG1, IDC_ROPTMSG5, IDC_ROPTMSG3);
- }
- else if (data->status_msg[i].flags[j] & STATUS_THIS_MSG)
- {
- if ((LOWORD(wParam) == IDC_ROPTPROTO2) || (LOWORD(wParam) == IDC_ROPTPROTO4))
- {
- EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
- }
- else
- {
- EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), TRUE);
- }
- CheckRadioButton(hwndDlg, IDC_ROPTMSG1, IDC_ROPTMSG5, IDC_ROPTMSG4);
- SetDlgItemText(hwndDlg, IDC_OPTEDIT1, data->status_msg[i].msg[j]);
- }
- else if (data->status_msg[i].flags[j] & STATUS_LAST_STATUS_MSG)
- {
- char setting[80];
- DBVARIANT dbv;
+ case IDC_ROPTPROTO1:
+ case IDC_ROPTPROTO2:
+ case IDC_ROPTPROTO3:
+ case IDC_ROPTPROTO4:
+ switch (HIWORD(wParam)) {
+ case BN_CLICKED:
+ {
+ int i, j;
- if (i)
- mir_snprintf(setting, SIZEOF(setting), "%sMsg", accounts->pa[i-1]->szModuleName);
- else
- mir_snprintf(setting, SIZEOF(setting), "Msg");
+ i = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_GETITEMDATA, (WPARAM)SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_GETCURSEL, 0, 0), 0);
+ j = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_GETITEMDATA, (WPARAM)SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_GETCURSEL, 0, 0), 0);
- if (!DBGetContactSettingTString(NULL, "SRAway", StatusModeToDbSetting(j + ID_STATUS_ONLINE, setting), &dbv))
- {
- SetDlgItemText(hwndDlg, IDC_OPTEDIT1, dbv.ptszVal);
- DBFreeVariant(&dbv);
- }
- else
- SetDlgItemText(hwndDlg, IDC_OPTEDIT1, _T(""));
+ data->proto_msg[i].flags = 0;
- EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
- CheckRadioButton(hwndDlg, IDC_ROPTMSG1, IDC_ROPTMSG5, IDC_ROPTMSG5);
- }
- }
- break;
- }
+ if ((LOWORD(wParam) == IDC_ROPTPROTO2) || (LOWORD(wParam) == IDC_ROPTPROTO4))
+ {
+ data->proto_msg[i].flags |= (LOWORD(wParam) == IDC_ROPTPROTO4) ? PROTO_NO_MSG : PROTO_NOCHANGE;
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_BOPTSTATUS), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_COPTMSG1), FALSE);
+
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG1), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG2), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG3), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG4), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG5), FALSE);
+
+ EnableWindow(GetDlgItem(hwndDlg, IDC_COPTMSG2), FALSE);
+ }
+ else if (LOWORD(wParam) == IDC_ROPTPROTO3)
+ {
+ data->proto_msg[i].flags |= PROTO_THIS_MSG;
+ EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), TRUE);
+ if (data->proto_msg[i].msg)
+ SetDlgItemText(hwndDlg, IDC_OPTEDIT1, data->proto_msg[i].msg);
+ else
+ SetDlgItemText(hwndDlg, IDC_OPTEDIT1, _T(""));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_BOPTSTATUS), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_COPTMSG1), FALSE);
+
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG1), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG2), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG3), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG4), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG5), FALSE);
+ CheckRadioButton(hwndDlg, IDC_ROPTMSG1, IDC_ROPTMSG5, IDC_ROPTMSG4);
+
+ EnableWindow(GetDlgItem(hwndDlg, IDC_COPTMSG2), FALSE);
+ }
+ else if (LOWORD(wParam) == IDC_ROPTPROTO1)
+ {
+ data->proto_msg[i].flags |= PROTO_POPUPDLG;
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_BOPTSTATUS), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_COPTMSG1), TRUE);
+
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG1), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG2), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG3), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG4), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_ROPTMSG5), TRUE);
+
+ EnableWindow(GetDlgItem(hwndDlg, IDC_COPTMSG2), TRUE);
}
- break;
- case IDC_CBOPTSTATUS:
- switch (HIWORD(wParam))
+ if (LOWORD(wParam) != IDC_ROPTPROTO3)
{
- case CBN_SELCHANGE:
- case CBN_SELENDOK:
+ if (data->status_msg[i].flags[j] & STATUS_EMPTY_MSG)
{
- int i, j;
-
- i = SendMessage((HWND)lParam, CB_GETITEMDATA, (WPARAM)SendMessage((HWND)lParam, CB_GETCURSEL, 0, 0), 0);
- j = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_GETITEMDATA, (WPARAM)SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_GETCURSEL, 0, 0), 0);
+ SetDlgItemText(hwndDlg, IDC_OPTEDIT1, _T(""));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
+ CheckRadioButton(hwndDlg, IDC_ROPTMSG1, IDC_ROPTMSG5, IDC_ROPTMSG1);
+ }
+ else if (data->status_msg[i].flags[j] & STATUS_DEFAULT_MSG)
+ {
+ SetDlgItemText(hwndDlg, IDC_OPTEDIT1, GetDefaultMessage(j+ID_STATUS_ONLINE));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
+ CheckRadioButton(hwndDlg, IDC_ROPTMSG1, IDC_ROPTMSG5, IDC_ROPTMSG2);
+ }
+ else if (data->status_msg[i].flags[j] & STATUS_LAST_MSG)
+ {
+ char setting[80];
+ DBVARIANT dbv, dbv2;
- if (data->status_msg[j].flags[i] & STATUS_SHOW_DLG)
- CheckDlgButton(hwndDlg, IDC_COPTMSG1, BST_CHECKED);
+ if (i)
+ mir_snprintf(setting, SIZEOF(setting), "Last%sMsg", accounts->pa[i-1]->szModuleName);
else
- CheckDlgButton(hwndDlg, IDC_COPTMSG1, BST_UNCHECKED);
+ mir_snprintf(setting, SIZEOF(setting), "LastMsg");
- if (data->status_msg[j].flags[i] & STATUS_EMPTY_MSG)
- {
- SetDlgItemText(hwndDlg, IDC_OPTEDIT1, _T(""));
- EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
- CheckRadioButton(hwndDlg, IDC_ROPTMSG1, IDC_ROPTMSG5, IDC_ROPTMSG1);
- }
- else if (data->status_msg[j].flags[i] & STATUS_DEFAULT_MSG)
- {
- SetDlgItemText(hwndDlg, IDC_OPTEDIT1, GetDefaultMessage(i+ID_STATUS_ONLINE));
- EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
- CheckRadioButton(hwndDlg, IDC_ROPTMSG1, IDC_ROPTMSG5, IDC_ROPTMSG2);
- }
- else if (data->status_msg[j].flags[i] & STATUS_LAST_MSG)
+ SetDlgItemText(hwndDlg, IDC_OPTEDIT1, _T(""));
+ if (!DBGetContactSetting(NULL, "SimpleStatusMsg", setting, &dbv))
{
- char setting[80];
- DBVARIANT dbv,dbv2;
-
- if (j)
- mir_snprintf(setting, SIZEOF(setting), "Last%sMsg", accounts->pa[j-1]->szModuleName);
- else
- mir_snprintf(setting, SIZEOF(setting), "LastMsg");
-
- SetDlgItemText(hwndDlg, IDC_OPTEDIT1, _T(""));
- if (!DBGetContactSetting(NULL, "SimpleStatusMsg", setting, &dbv))
+ if (dbv.pszVal)
{
- if (dbv.pszVal)
+ if (!DBGetContactSettingTString(NULL, "SimpleStatusMsg", dbv.pszVal, &dbv2) && strlen(dbv.pszVal))
{
- if (!DBGetContactSettingTString(NULL, "SimpleStatusMsg", dbv.pszVal, &dbv2) && strlen(dbv.pszVal))
- {
- if (dbv2.ptszVal && lstrlen(dbv2.ptszVal))
- SetDlgItemText(hwndDlg, IDC_OPTEDIT1, dbv2.ptszVal);
- DBFreeVariant(&dbv2);
- }
+ if (dbv2.ptszVal && lstrlen(dbv2.ptszVal))
+ SetDlgItemText(hwndDlg, IDC_OPTEDIT1, dbv2.ptszVal);
+ DBFreeVariant(&dbv2);
}
- DBFreeVariant(&dbv);
}
+ DBFreeVariant(&dbv);
+ }
+ EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
+ CheckRadioButton(hwndDlg, IDC_ROPTMSG1, IDC_ROPTMSG5, IDC_ROPTMSG3);
+ }
+ else if (data->status_msg[i].flags[j] & STATUS_THIS_MSG)
+ {
+ if ((LOWORD(wParam) == IDC_ROPTPROTO2) || (LOWORD(wParam) == IDC_ROPTPROTO4))
+ {
EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
- CheckRadioButton(hwndDlg, IDC_ROPTMSG1, IDC_ROPTMSG5, IDC_ROPTMSG3);
}
- else if (data->status_msg[j].flags[i] & STATUS_THIS_MSG)
+ else
{
EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), TRUE);
EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), TRUE);
- CheckRadioButton(hwndDlg, IDC_ROPTMSG1, IDC_ROPTMSG5, IDC_ROPTMSG4);
- SetDlgItemText(hwndDlg, IDC_OPTEDIT1, data->status_msg[j].msg[i]);
}
- else if (data->status_msg[j].flags[i] & STATUS_LAST_STATUS_MSG)
- {
- char setting[80];
- DBVARIANT dbv;
-
- if (j)
- mir_snprintf(setting, SIZEOF(setting), "%sMsg", accounts->pa[j-1]->szModuleName);
- else
- mir_snprintf(setting, SIZEOF(setting), "Msg");
-
- if (!DBGetContactSettingTString(NULL, "SRAway", StatusModeToDbSetting(i + ID_STATUS_ONLINE, setting), &dbv))
- {
- SetDlgItemText(hwndDlg, IDC_OPTEDIT1, dbv.ptszVal);
- DBFreeVariant(&dbv);
- }
- else
- SetDlgItemText(hwndDlg, IDC_OPTEDIT1, _T(""));
-
- EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
- CheckRadioButton(hwndDlg, IDC_ROPTMSG1, IDC_ROPTMSG5, IDC_ROPTMSG5);
- }
- break;
+ CheckRadioButton(hwndDlg, IDC_ROPTMSG1, IDC_ROPTMSG5, IDC_ROPTMSG4);
+ SetDlgItemText(hwndDlg, IDC_OPTEDIT1, data->status_msg[i].msg[j]);
}
- }
- break;
-
- case IDC_COPTMSG1:
- switch (HIWORD(wParam))
- {
- case BN_CLICKED:
+ else if (data->status_msg[i].flags[j] & STATUS_LAST_STATUS_MSG)
{
- int i, j;
+ char setting[80];
+ DBVARIANT dbv;
+
+ if (i)
+ mir_snprintf(setting, SIZEOF(setting), "%sMsg", accounts->pa[i-1]->szModuleName);
+ else
+ mir_snprintf(setting, SIZEOF(setting), "Msg");
- i = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_GETITEMDATA, (WPARAM)SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_GETCURSEL, 0, 0), 0);
- j = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_GETITEMDATA, (WPARAM)SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_GETCURSEL, 0, 0), 0);
- if (IsDlgButtonChecked(hwndDlg, IDC_COPTMSG1) == BST_CHECKED)
- data->status_msg[j].flags[i] |= STATUS_SHOW_DLG;
+ if (!DBGetContactSettingTString(NULL, "SRAway", StatusModeToDbSetting(j + ID_STATUS_ONLINE, setting), &dbv))
+ {
+ SetDlgItemText(hwndDlg, IDC_OPTEDIT1, dbv.ptszVal);
+ DBFreeVariant(&dbv);
+ }
else
- data->status_msg[j].flags[i] &= ~STATUS_SHOW_DLG;
- break;
+ SetDlgItemText(hwndDlg, IDC_OPTEDIT1, _T(""));
+
+ EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
+ CheckRadioButton(hwndDlg, IDC_ROPTMSG1, IDC_ROPTMSG5, IDC_ROPTMSG5);
}
}
break;
+ }
+ }
+ break;
- case IDC_ROPTMSG1:
- case IDC_ROPTMSG2:
- case IDC_ROPTMSG3:
- case IDC_ROPTMSG4:
- case IDC_ROPTMSG5:
- switch (HIWORD(wParam))
- {
- case BN_CLICKED:
- {
- int i, j;
+ case IDC_CBOPTSTATUS:
+ switch (HIWORD(wParam)) {
+ case CBN_SELCHANGE:
+ case CBN_SELENDOK:
+ {
+ int i, j;
- i = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_GETITEMDATA, (WPARAM)SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_GETCURSEL, 0, 0), 0);
- j = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_GETITEMDATA, (WPARAM)SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_GETCURSEL, 0, 0), 0);
+ i = SendMessage((HWND)lParam, CB_GETITEMDATA, (WPARAM)SendMessage((HWND)lParam, CB_GETCURSEL, 0, 0), 0);
+ j = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_GETITEMDATA, (WPARAM)SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_GETCURSEL, 0, 0), 0);
- if (LOWORD(wParam) == IDC_ROPTMSG4 && data->proto_msg[j].flags & PROTO_THIS_MSG)
- break;
+ if (data->status_msg[j].flags[i] & STATUS_SHOW_DLG)
+ CheckDlgButton(hwndDlg, IDC_COPTMSG1, BST_CHECKED);
+ else
+ CheckDlgButton(hwndDlg, IDC_COPTMSG1, BST_UNCHECKED);
- data->status_msg[j].flags[i] = 0;
+ if (data->status_msg[j].flags[i] & STATUS_EMPTY_MSG)
+ {
+ SetDlgItemText(hwndDlg, IDC_OPTEDIT1, _T(""));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
+ CheckRadioButton(hwndDlg, IDC_ROPTMSG1, IDC_ROPTMSG5, IDC_ROPTMSG1);
+ }
+ else if (data->status_msg[j].flags[i] & STATUS_DEFAULT_MSG)
+ {
+ SetDlgItemText(hwndDlg, IDC_OPTEDIT1, GetDefaultMessage(i+ID_STATUS_ONLINE));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
+ CheckRadioButton(hwndDlg, IDC_ROPTMSG1, IDC_ROPTMSG5, IDC_ROPTMSG2);
+ }
+ else if (data->status_msg[j].flags[i] & STATUS_LAST_MSG)
+ {
+ char setting[80];
+ DBVARIANT dbv,dbv2;
- if (IsDlgButtonChecked(hwndDlg, IDC_COPTMSG1) == BST_CHECKED)
- data->status_msg[j].flags[i] |= STATUS_SHOW_DLG;
+ if (j)
+ mir_snprintf(setting, SIZEOF(setting), "Last%sMsg", accounts->pa[j-1]->szModuleName);
+ else
+ mir_snprintf(setting, SIZEOF(setting), "LastMsg");
- if (LOWORD(wParam) == IDC_ROPTMSG1)
- {
- SetDlgItemText(hwndDlg, IDC_OPTEDIT1, _T(""));
- EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
- data->status_msg[j].flags[i] |= STATUS_EMPTY_MSG;
- }
- else if (LOWORD(wParam) == IDC_ROPTMSG2)
- {
- SetDlgItemText(hwndDlg, IDC_OPTEDIT1, GetDefaultMessage(i+ID_STATUS_ONLINE));
- EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
- data->status_msg[j].flags[i] |= STATUS_DEFAULT_MSG;
- }
- else if (LOWORD(wParam) == IDC_ROPTMSG3)
+ SetDlgItemText(hwndDlg, IDC_OPTEDIT1, _T(""));
+ if (!DBGetContactSetting(NULL, "SimpleStatusMsg", setting, &dbv))
+ {
+ if (dbv.pszVal)
{
- char setting[80];
- DBVARIANT dbv, dbv2;
-
- if (j)
- mir_snprintf(setting, SIZEOF(setting), "Last%sMsg", accounts->pa[j-1]->szModuleName);
- else
- mir_snprintf(setting, SIZEOF(setting), "LastMsg");
-
- SetDlgItemText(hwndDlg, IDC_OPTEDIT1, _T(""));
- if (!DBGetContactSetting(NULL, "SimpleStatusMsg", setting, &dbv))
+ if (!DBGetContactSettingTString(NULL, "SimpleStatusMsg", dbv.pszVal, &dbv2) && strlen(dbv.pszVal))
{
- if (dbv.pszVal)
- {
- if (!DBGetContactSettingTString(NULL, "SimpleStatusMsg", dbv.pszVal, &dbv2) && strlen(dbv.pszVal))
- {
- if (dbv2.ptszVal && lstrlen(dbv2.ptszVal))
- SetDlgItemText(hwndDlg, IDC_OPTEDIT1, dbv2.ptszVal);
- DBFreeVariant(&dbv2);
- }
- }
- DBFreeVariant(&dbv);
+ if (dbv2.ptszVal && lstrlen(dbv2.ptszVal))
+ SetDlgItemText(hwndDlg, IDC_OPTEDIT1, dbv2.ptszVal);
+ DBFreeVariant(&dbv2);
}
- EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
- data->status_msg[j].flags[i] |= STATUS_LAST_MSG;
}
- else if (LOWORD(wParam) == IDC_ROPTMSG4)
- {
- data->status_msg[j].flags[i] |= STATUS_THIS_MSG;
- EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), TRUE);
- SetDlgItemText(hwndDlg, IDC_OPTEDIT1, data->status_msg[j].msg[i]);
- }
- else if (LOWORD(wParam) == IDC_ROPTMSG5)
- {
- char setting[80];
- DBVARIANT dbv;
-
- if (j)
- mir_snprintf(setting, SIZEOF(setting), "%sMsg", accounts->pa[j-1]->szModuleName);
- else
- mir_snprintf(setting, SIZEOF(setting), "Msg");
+ DBFreeVariant(&dbv);
+ }
+ EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
+ CheckRadioButton(hwndDlg, IDC_ROPTMSG1, IDC_ROPTMSG5, IDC_ROPTMSG3);
+ }
+ else if (data->status_msg[j].flags[i] & STATUS_THIS_MSG)
+ {
+ EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), TRUE);
+ CheckRadioButton(hwndDlg, IDC_ROPTMSG1, IDC_ROPTMSG5, IDC_ROPTMSG4);
+ SetDlgItemText(hwndDlg, IDC_OPTEDIT1, data->status_msg[j].msg[i]);
+ }
+ else if (data->status_msg[j].flags[i] & STATUS_LAST_STATUS_MSG)
+ {
+ char setting[80];
+ DBVARIANT dbv;
- if (!DBGetContactSettingTString(NULL, "SRAway", StatusModeToDbSetting(i+ID_STATUS_ONLINE, setting), &dbv))
- {
- SetDlgItemText(hwndDlg, IDC_OPTEDIT1, dbv.ptszVal);
- DBFreeVariant(&dbv);
- }
- else
- SetDlgItemText(hwndDlg, IDC_OPTEDIT1, _T(""));
+ if (j)
+ mir_snprintf(setting, SIZEOF(setting), "%sMsg", accounts->pa[j-1]->szModuleName);
+ else
+ mir_snprintf(setting, SIZEOF(setting), "Msg");
- EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
- data->status_msg[j].flags[i] |= STATUS_LAST_STATUS_MSG;
- }
- break;
+ if (!DBGetContactSettingTString(NULL, "SRAway", StatusModeToDbSetting(i + ID_STATUS_ONLINE, setting), &dbv))
+ {
+ SetDlgItemText(hwndDlg, IDC_OPTEDIT1, dbv.ptszVal);
+ DBFreeVariant(&dbv);
}
+ else
+ SetDlgItemText(hwndDlg, IDC_OPTEDIT1, _T(""));
+
+ EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
+ CheckRadioButton(hwndDlg, IDC_ROPTMSG1, IDC_ROPTMSG5, IDC_ROPTMSG5);
}
break;
+ }
+ }
+ break;
- case IDC_OPTEDIT1:
+ case IDC_COPTMSG1:
+ switch (HIWORD(wParam)) {
+ case BN_CLICKED:
{
- int i = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_GETITEMDATA, (WPARAM)SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_GETCURSEL, 0, 0), 0);
- int j = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_GETITEMDATA, (WPARAM)SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_GETCURSEL, 0, 0), 0);
+ int i, j;
- if (HIWORD(wParam) == EN_KILLFOCUS)
+ i = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_GETITEMDATA, (WPARAM)SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_GETCURSEL, 0, 0), 0);
+ j = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_GETITEMDATA, (WPARAM)SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_GETCURSEL, 0, 0), 0);
+ if (IsDlgButtonChecked(hwndDlg, IDC_COPTMSG1) == BST_CHECKED)
+ data->status_msg[j].flags[i] |= STATUS_SHOW_DLG;
+ else
+ data->status_msg[j].flags[i] &= ~STATUS_SHOW_DLG;
+ break;
+ }
+ }
+ break;
+
+ case IDC_ROPTMSG1:
+ case IDC_ROPTMSG2:
+ case IDC_ROPTMSG3:
+ case IDC_ROPTMSG4:
+ case IDC_ROPTMSG5:
+ switch (HIWORD(wParam)) {
+ case BN_CLICKED:
+ {
+ int i, j;
+
+ i = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_GETITEMDATA, (WPARAM)SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_GETCURSEL, 0, 0), 0);
+ j = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_GETITEMDATA, (WPARAM)SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_GETCURSEL, 0, 0), 0);
+
+ if (LOWORD(wParam) == IDC_ROPTMSG4 && data->proto_msg[j].flags & PROTO_THIS_MSG)
+ break;
+
+ data->status_msg[j].flags[i] = 0;
+
+ if (IsDlgButtonChecked(hwndDlg, IDC_COPTMSG1) == BST_CHECKED)
+ data->status_msg[j].flags[i] |= STATUS_SHOW_DLG;
+
+ if (LOWORD(wParam) == IDC_ROPTMSG1)
+ {
+ SetDlgItemText(hwndDlg, IDC_OPTEDIT1, _T(""));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
+ data->status_msg[j].flags[i] |= STATUS_EMPTY_MSG;
+ }
+ else if (LOWORD(wParam) == IDC_ROPTMSG2)
{
- TCHAR msg[1024];
+ SetDlgItemText(hwndDlg, IDC_OPTEDIT1, GetDefaultMessage(i+ID_STATUS_ONLINE));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
+ data->status_msg[j].flags[i] |= STATUS_DEFAULT_MSG;
+ }
+ else if (LOWORD(wParam) == IDC_ROPTMSG3)
+ {
+ char setting[80];
+ DBVARIANT dbv, dbv2;
- if (data->proto_msg[j].flags & PROTO_THIS_MSG)
+ if (j)
+ mir_snprintf(setting, SIZEOF(setting), "Last%sMsg", accounts->pa[j-1]->szModuleName);
+ else
+ mir_snprintf(setting, SIZEOF(setting), "LastMsg");
+
+ SetDlgItemText(hwndDlg, IDC_OPTEDIT1, _T(""));
+ if (!DBGetContactSetting(NULL, "SimpleStatusMsg", setting, &dbv))
{
- int len = GetDlgItemText(hwndDlg, IDC_OPTEDIT1, msg, SIZEOF(msg));
- if (len > 0)
- {
- if (data->proto_msg[j].msg == NULL)
- data->proto_msg[j].msg = mir_tstrdup(msg);
- else
- {
- mir_free(data->proto_msg[j].msg);
- data->proto_msg[j].msg = mir_tstrdup(msg);
- }
- }
- else
+ if (dbv.pszVal)
{
- if (data->proto_msg[j].msg != NULL)
+ if (!DBGetContactSettingTString(NULL, "SimpleStatusMsg", dbv.pszVal, &dbv2) && strlen(dbv.pszVal))
{
- mir_free(data->proto_msg[j].msg);
- data->proto_msg[j].msg = NULL;
+ if (dbv2.ptszVal && lstrlen(dbv2.ptszVal))
+ SetDlgItemText(hwndDlg, IDC_OPTEDIT1, dbv2.ptszVal);
+ DBFreeVariant(&dbv2);
}
}
+ DBFreeVariant(&dbv);
}
+ EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
+ data->status_msg[j].flags[i] |= STATUS_LAST_MSG;
+ }
+ else if (LOWORD(wParam) == IDC_ROPTMSG4)
+ {
+ data->status_msg[j].flags[i] |= STATUS_THIS_MSG;
+ EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), TRUE);
+ SetDlgItemText(hwndDlg, IDC_OPTEDIT1, data->status_msg[j].msg[i]);
+ }
+ else if (LOWORD(wParam) == IDC_ROPTMSG5)
+ {
+ char setting[80];
+ DBVARIANT dbv;
+
+ if (j)
+ mir_snprintf(setting, SIZEOF(setting), "%sMsg", accounts->pa[j-1]->szModuleName);
else
+ mir_snprintf(setting, SIZEOF(setting), "Msg");
+
+ if (!DBGetContactSettingTString(NULL, "SRAway", StatusModeToDbSetting(i+ID_STATUS_ONLINE, setting), &dbv))
{
- GetDlgItemText(hwndDlg, IDC_OPTEDIT1, msg, SIZEOF(msg));
- lstrcpy(data->status_msg[j].msg[i], msg);
+ SetDlgItemText(hwndDlg, IDC_OPTEDIT1, dbv.ptszVal);
+ DBFreeVariant(&dbv);
}
+ else
+ SetDlgItemText(hwndDlg, IDC_OPTEDIT1, _T(""));
+
+ EnableWindow(GetDlgItem(hwndDlg, IDC_OPTEDIT1), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_VARSHELP), FALSE);
+ data->status_msg[j].flags[i] |= STATUS_LAST_STATUS_MSG;
}
break;
}
+ }
+ break;
- case IDC_VARSHELP:
- variables_showhelp(hwndDlg, IDC_OPTEDIT1, VHF_FULLDLG|VHF_SETLASTSUBJECT, NULL, NULL);
- break;
+ case IDC_OPTEDIT1:
+ {
+ int i = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_GETITEMDATA, (WPARAM)SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_GETCURSEL, 0, 0), 0);
+ int j = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_GETITEMDATA, (WPARAM)SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_GETCURSEL, 0, 0), 0);
- case IDC_BOPTPROTO:
+ if (HIWORD(wParam) == EN_KILLFOCUS)
{
- int i, j, k;
- j = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_GETITEMDATA, (WPARAM)SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_GETCURSEL, 0, 0), 0);
+ TCHAR msg[1024];
- if (j)
+ if (data->proto_msg[j].flags & PROTO_THIS_MSG)
{
- for (i = ID_STATUS_ONLINE; i <= ID_STATUS_OUTTOLUNCH; i++)
+ int len = GetDlgItemText(hwndDlg, IDC_OPTEDIT1, msg, SIZEOF(msg));
+ if (len > 0)
+ {
+ if (data->proto_msg[j].msg == NULL)
+ data->proto_msg[j].msg = mir_tstrdup(msg);
+ else
+ {
+ mir_free(data->proto_msg[j].msg);
+ data->proto_msg[j].msg = mir_tstrdup(msg);
+ }
+ }
+ else
{
- if (accounts->statusMsgFlags & Proto_Status2Flag(i))
+ if (data->proto_msg[j].msg != NULL)
{
- data->status_msg[0].flags[i-ID_STATUS_ONLINE] = data->status_msg[j].flags[i-ID_STATUS_ONLINE];
- if (data->status_msg[j].flags[i-ID_STATUS_ONLINE] & STATUS_THIS_MSG)
- lstrcpy(data->status_msg[0].msg[i-ID_STATUS_ONLINE], data->status_msg[j].msg[i-ID_STATUS_ONLINE]);
+ mir_free(data->proto_msg[j].msg);
+ data->proto_msg[j].msg = NULL;
}
}
}
-
- for (k = 0; k < accounts->count; k++)
+ else
{
- if (!IsAccountEnabled(accounts->pa[k]) || !CallProtoService(accounts->pa[k]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0) || !(CallProtoService(accounts->pa[k]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND))
- continue;
+ GetDlgItemText(hwndDlg, IDC_OPTEDIT1, msg, SIZEOF(msg));
+ lstrcpy(data->status_msg[j].msg[i], msg);
+ }
+ }
+ break;
+ }
+
+ case IDC_VARSHELP:
+ variables_showhelp(hwndDlg, IDC_OPTEDIT1, VHF_FULLDLG|VHF_SETLASTSUBJECT, NULL, NULL);
+ break;
+
+ case IDC_BOPTPROTO:
+ {
+ int i, j, k;
+ j = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_GETITEMDATA, (WPARAM)SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_GETCURSEL, 0, 0), 0);
- if (k != j - 1)
+ if (j)
+ {
+ for (i = ID_STATUS_ONLINE; i <= ID_STATUS_OUTTOLUNCH; i++)
+ {
+ if (accounts->statusMsgFlags & Proto_Status2Flag(i))
{
- data->proto_msg[k+1].flags = data->proto_msg[j].flags;
- if (j)
- data->proto_msg[k+1].max_length = data->proto_msg[j].max_length;
+ data->status_msg[0].flags[i-ID_STATUS_ONLINE] = data->status_msg[j].flags[i-ID_STATUS_ONLINE];
+ if (data->status_msg[j].flags[i-ID_STATUS_ONLINE] & STATUS_THIS_MSG)
+ lstrcpy(data->status_msg[0].msg[i-ID_STATUS_ONLINE], data->status_msg[j].msg[i-ID_STATUS_ONLINE]);
+ }
+ }
+ }
- if (data->proto_msg[j].flags & PROTO_THIS_MSG)
- {
- int len = lstrlen(data->proto_msg[j].msg);
- if (len > 0)
- {
- if (data->proto_msg[k+1].msg == NULL)
- data->proto_msg[k+1].msg = mir_tstrdup(data->proto_msg[j].msg);
- else
- {
- mir_free(data->proto_msg[k+1].msg);
- data->proto_msg[k+1].msg = mir_tstrdup(data->proto_msg[j].msg);
- }
- }
+ for (k = 0; k < accounts->count; k++)
+ {
+ if (!IsAccountEnabled(accounts->pa[k]) || !CallProtoService(accounts->pa[k]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0) || !(CallProtoService(accounts->pa[k]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND))
+ continue;
+
+ if (k != j - 1)
+ {
+ data->proto_msg[k+1].flags = data->proto_msg[j].flags;
+ if (j)
+ data->proto_msg[k+1].max_length = data->proto_msg[j].max_length;
+
+ if (data->proto_msg[j].flags & PROTO_THIS_MSG)
+ {
+ int len = lstrlen(data->proto_msg[j].msg);
+ if (len > 0)
+ {
+ if (data->proto_msg[k+1].msg == NULL)
+ data->proto_msg[k+1].msg = mir_tstrdup(data->proto_msg[j].msg);
else
{
- if (data->proto_msg[k+1].msg != NULL)
- {
- mir_free(data->proto_msg[k+1].msg);
- data->proto_msg[k+1].msg = NULL;
- }
+ mir_free(data->proto_msg[k+1].msg);
+ data->proto_msg[k+1].msg = mir_tstrdup(data->proto_msg[j].msg);
}
}
- else if (data->proto_msg[j].flags & PROTO_POPUPDLG)
+ else
{
- for (i = ID_STATUS_ONLINE; i <= ID_STATUS_OUTTOLUNCH; i++)
+ if (data->proto_msg[k+1].msg != NULL)
{
- if (CallProtoService(accounts->pa[k]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0) & Proto_Status2Flag(i))
- {
- data->status_msg[k + 1].flags[i - ID_STATUS_ONLINE] = data->status_msg[j].flags[i - ID_STATUS_ONLINE];
- if (data->status_msg[j].flags[i - ID_STATUS_ONLINE] & STATUS_THIS_MSG)
- lstrcpy(data->status_msg[k + 1].msg[i - ID_STATUS_ONLINE], data->status_msg[j].msg[i - ID_STATUS_ONLINE]);
- }
+ mir_free(data->proto_msg[k+1].msg);
+ data->proto_msg[k+1].msg = NULL;
+ }
+ }
+ }
+ else if (data->proto_msg[j].flags & PROTO_POPUPDLG)
+ {
+ for (i = ID_STATUS_ONLINE; i <= ID_STATUS_OUTTOLUNCH; i++)
+ {
+ if (CallProtoService(accounts->pa[k]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0) & Proto_Status2Flag(i))
+ {
+ data->status_msg[k + 1].flags[i - ID_STATUS_ONLINE] = data->status_msg[j].flags[i - ID_STATUS_ONLINE];
+ if (data->status_msg[j].flags[i - ID_STATUS_ONLINE] & STATUS_THIS_MSG)
+ lstrcpy(data->status_msg[k + 1].msg[i - ID_STATUS_ONLINE], data->status_msg[j].msg[i - ID_STATUS_ONLINE]);
}
}
}
}
- break;
- } // case IDC_BOPTPROTO
+ }
+ break;
+ } // case IDC_BOPTPROTO
- case IDC_BOPTSTATUS:
- {
- int status_modes, i, j, k;
+ case IDC_BOPTSTATUS:
+ {
+ int status_modes, i, j, k;
- i = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_GETITEMDATA, (WPARAM)SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_GETCURSEL, 0, 0), 0);
- j = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_GETITEMDATA, (WPARAM)SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_GETCURSEL, 0, 0), 0);
+ i = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_GETITEMDATA, (WPARAM)SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTSTATUS), CB_GETCURSEL, 0, 0), 0);
+ j = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_GETITEMDATA, (WPARAM)SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTPROTO), CB_GETCURSEL, 0, 0), 0);
- if (j)
- status_modes = CallProtoService(accounts->pa[j-1]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0);
- else
- status_modes = accounts->statusMsgFlags;
+ if (j)
+ status_modes = CallProtoService(accounts->pa[j-1]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0);
+ else
+ status_modes = accounts->statusMsgFlags;
- for (k = ID_STATUS_ONLINE; k <= ID_STATUS_OUTTOLUNCH; k++)
+ for (k = ID_STATUS_ONLINE; k <= ID_STATUS_OUTTOLUNCH; k++)
+ {
+ if (k - ID_STATUS_ONLINE != i && status_modes & Proto_Status2Flag(k))
{
- if (k - ID_STATUS_ONLINE != i && status_modes & Proto_Status2Flag(k))
- {
- data->status_msg[j].flags[k - ID_STATUS_ONLINE] = data->status_msg[j].flags[i];
- if (data->status_msg[j].flags[i] & STATUS_THIS_MSG)
- lstrcpy(data->status_msg[j].msg[k - ID_STATUS_ONLINE], data->status_msg[j].msg[i]);
- }
+ data->status_msg[j].flags[k - ID_STATUS_ONLINE] = data->status_msg[j].flags[i];
+ if (data->status_msg[j].flags[i] & STATUS_THIS_MSG)
+ lstrcpy(data->status_msg[j].msg[k - ID_STATUS_ONLINE], data->status_msg[j].msg[i]);
}
- break;
- } //case IDC_BOPTSTATUS
- }
- break;
+ }
+ break;
+ } //case IDC_BOPTSTATUS
+ }
+ break;
- case WM_NOTIFY:
- if (((LPNMHDR)lParam)->idFrom == 0 && ((LPNMHDR)lParam)->code == PSN_APPLY)
- {
- char szSetting[80];
- int i;
+ case WM_NOTIFY:
+ if (((LPNMHDR)lParam)->idFrom == 0 && ((LPNMHDR)lParam)->code == PSN_APPLY)
+ {
+ char szSetting[80];
+ int i;
- for (i = ID_STATUS_ONLINE; i <= ID_STATUS_OUTTOLUNCH; i++)
+ for (i = ID_STATUS_ONLINE; i <= ID_STATUS_OUTTOLUNCH; i++)
+ {
+ if (accounts->statusMsgFlags & Proto_Status2Flag(i))
{
- if (accounts->statusMsgFlags & Proto_Status2Flag(i))
- {
- DBWriteContactSettingTString(NULL, "SRAway", StatusModeToDbSetting(i, "Default"), data->status_msg[0].msg[i - ID_STATUS_ONLINE]);
- DBWriteContactSettingByte(NULL, "SimpleStatusMsg", StatusModeToDbSetting(i, "Flags"), (BYTE)data->status_msg[0].flags[i - ID_STATUS_ONLINE]);
+ DBWriteContactSettingTString(NULL, "SRAway", StatusModeToDbSetting(i, "Default"), data->status_msg[0].msg[i - ID_STATUS_ONLINE]);
+ DBWriteContactSettingByte(NULL, "SimpleStatusMsg", StatusModeToDbSetting(i, "Flags"), (BYTE)data->status_msg[0].flags[i - ID_STATUS_ONLINE]);
- for (int j = 0; j < accounts->count; j++)
- {
- if (!IsAccountEnabled(accounts->pa[j]))
- continue;
+ for (int j = 0; j < accounts->count; j++)
+ {
+ if (!IsAccountEnabled(accounts->pa[j]))
+ continue;
- if (!(CallProtoService(accounts->pa[j]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND))
- continue;
+ if (!(CallProtoService(accounts->pa[j]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND))
+ continue;
- if (CallProtoService(accounts->pa[j]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0) & Proto_Status2Flag(i))
- {
- mir_snprintf(szSetting, SIZEOF(szSetting), "%sDefault", accounts->pa[j]->szModuleName);
- DBWriteContactSettingTString(NULL, "SRAway", StatusModeToDbSetting(i, szSetting), data->status_msg[j + 1].msg[i - ID_STATUS_ONLINE]);
+ if (CallProtoService(accounts->pa[j]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0) & Proto_Status2Flag(i))
+ {
+ mir_snprintf(szSetting, SIZEOF(szSetting), "%sDefault", accounts->pa[j]->szModuleName);
+ DBWriteContactSettingTString(NULL, "SRAway", StatusModeToDbSetting(i, szSetting), data->status_msg[j + 1].msg[i - ID_STATUS_ONLINE]);
- mir_snprintf(szSetting, SIZEOF(szSetting), "%sFlags", accounts->pa[j]->szModuleName);
- DBWriteContactSettingByte(NULL, "SimpleStatusMsg", StatusModeToDbSetting(i, szSetting), (BYTE)data->status_msg[j + 1].flags[i - ID_STATUS_ONLINE]);
- }
+ mir_snprintf(szSetting, SIZEOF(szSetting), "%sFlags", accounts->pa[j]->szModuleName);
+ DBWriteContactSettingByte(NULL, "SimpleStatusMsg", StatusModeToDbSetting(i, szSetting), (BYTE)data->status_msg[j + 1].flags[i - ID_STATUS_ONLINE]);
}
}
}
+ }
- DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "PutDefInList", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_COPTMSG2) == BST_CHECKED));
+ DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "PutDefInList", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_COPTMSG2) == BST_CHECKED));
- if (data->proto_ok)
- {
- DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "ProtoFlags", (BYTE)data->proto_msg[0].flags);
+ if (data->proto_ok)
+ {
+ DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "ProtoFlags", (BYTE)data->proto_msg[0].flags);
- for (i = 0; i < accounts->count; i++)
- {
- if (!IsAccountEnabled(accounts->pa[i]))
- continue;
+ for (i = 0; i < accounts->count; i++)
+ {
+ if (!IsAccountEnabled(accounts->pa[i]))
+ continue;
- if (!CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0))
- continue;
+ if (!CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0))
+ continue;
- if (!(CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND))
- continue;
+ if (!(CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND))
+ continue;
- mir_snprintf(szSetting, SIZEOF(szSetting), "Proto%sDefault", accounts->pa[i]->szModuleName);
- if (data->proto_msg[i+1].msg && (data->proto_msg[i+1].flags & PROTO_THIS_MSG))
- DBWriteContactSettingTString(NULL, "SimpleStatusMsg", szSetting, data->proto_msg[i+1].msg);
-// else
-// DBDeleteContactSetting(NULL, "SimpleStatusMsg", szSetting);
+ mir_snprintf(szSetting, SIZEOF(szSetting), "Proto%sDefault", accounts->pa[i]->szModuleName);
+ if (data->proto_msg[i+1].msg && (data->proto_msg[i+1].flags & PROTO_THIS_MSG))
+ DBWriteContactSettingTString(NULL, "SimpleStatusMsg", szSetting, data->proto_msg[i+1].msg);
+ // else
+ // DBDeleteContactSetting(NULL, "SimpleStatusMsg", szSetting);
- mir_snprintf(szSetting, SIZEOF(szSetting), "Proto%sMaxLen", accounts->pa[i]->szModuleName);
- DBWriteContactSettingWord(NULL, "SimpleStatusMsg", szSetting, (WORD)data->proto_msg[i+1].max_length);
+ mir_snprintf(szSetting, SIZEOF(szSetting), "Proto%sMaxLen", accounts->pa[i]->szModuleName);
+ DBWriteContactSettingWord(NULL, "SimpleStatusMsg", szSetting, (WORD)data->proto_msg[i+1].max_length);
- mir_snprintf(szSetting, SIZEOF(szSetting), "Proto%sFlags", accounts->pa[i]->szModuleName);
- DBWriteContactSettingByte(NULL, "SimpleStatusMsg", szSetting, (BYTE)data->proto_msg[i+1].flags);
- }
+ mir_snprintf(szSetting, SIZEOF(szSetting), "Proto%sFlags", accounts->pa[i]->szModuleName);
+ DBWriteContactSettingByte(NULL, "SimpleStatusMsg", szSetting, (BYTE)data->proto_msg[i+1].flags);
}
- RebuildStatusMenu();
- return TRUE;
}
- break;
+ RebuildStatusMenu();
+ return TRUE;
+ }
+ break;
- case WM_DESTROY:
- SetWindowLongPtr(GetDlgItem(hwndDlg, IDC_OPTEDIT1), GWLP_WNDPROC, (LONG_PTR)OldDlgProc);
- if (data->proto_ok)
+ case WM_DESTROY:
+ if (data->proto_ok)
+ {
+ for (int i = 0; i < accounts->count + 1; ++i)
{
- for (int i = 0; i < accounts->count + 1; ++i)
- {
- if (data->proto_msg[i].msg) // they want to be free, do they?
- mir_free(data->proto_msg[i].msg);
- }
- mir_free(data->proto_msg);
+ if (data->proto_msg[i].msg) // they want to be free, do they?
+ mir_free(data->proto_msg[i].msg);
}
- mir_free(data->status_msg);
- mir_free(data);
- break;
+ mir_free(data->proto_msg);
+ }
+ mir_free(data->status_msg);
+ mir_free(data);
+ break;
}
return FALSE;
}
static INT_PTR CALLBACK DlgVariablesOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- switch (uMsg)
- {
- case WM_INITDIALOG:
+ switch (uMsg) {
+ case WM_INITDIALOG:
{
TranslateDialogDefault(hwndDlg);
@@ -1155,7 +1142,7 @@ static INT_PTR CALLBACK DlgVariablesOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM
return TRUE;
}
- case WM_USER + 2:
+ case WM_USER + 2:
{
BOOL bChecked = IsDlgButtonChecked(hwndDlg, IDC_CUPDATEMSG) == BST_CHECKED;
EnableWindow(GetDlgItem(hwndDlg, IDC_ESECUPDTMSG), bChecked);
@@ -1166,59 +1153,59 @@ static INT_PTR CALLBACK DlgVariablesOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM
break;
}
- case WM_COMMAND:
- switch (LOWORD(wParam))
+ case WM_COMMAND:
+ switch (LOWORD(wParam))
+ {
+ case IDC_ESECUPDTMSG:
{
- case IDC_ESECUPDTMSG:
- {
- if ((HWND)lParam != GetFocus() || HIWORD(wParam) != EN_CHANGE) return 0;
- int val = GetDlgItemInt(hwndDlg, IDC_ESECUPDTMSG, NULL, FALSE);
- if (val == 0 && GetWindowTextLength(GetDlgItem(hwndDlg, IDC_ESECUPDTMSG)))
- SendDlgItemMessage(hwndDlg, IDC_SSECUPDTMSG, UDM_SETPOS, 0, MAKELONG((short)1, 0));
- break;
- }
+ if ((HWND)lParam != GetFocus() || HIWORD(wParam) != EN_CHANGE) return 0;
+ int val = GetDlgItemInt(hwndDlg, IDC_ESECUPDTMSG, NULL, FALSE);
+ if (val == 0 && GetWindowTextLength(GetDlgItem(hwndDlg, IDC_ESECUPDTMSG)))
+ SendDlgItemMessage(hwndDlg, IDC_SSECUPDTMSG, UDM_SETPOS, 0, MAKELONG((short)1, 0));
+ break;
+ }
- case IDC_CUPDATEMSG:
- SendMessage(hwndDlg, WM_USER + 2, 0, 0);
- break;
+ case IDC_CUPDATEMSG:
+ SendMessage(hwndDlg, WM_USER + 2, 0, 0);
+ break;
- case IDC_CVARIABLES:
- EnableWindow(GetDlgItem(hwndDlg, IDC_CDATEPARSING), IsDlgButtonChecked(hwndDlg, IDC_CVARIABLES) == BST_CHECKED);
- break;
- }
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ case IDC_CVARIABLES:
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CDATEPARSING), IsDlgButtonChecked(hwndDlg, IDC_CVARIABLES) == BST_CHECKED);
break;
+ }
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
- case WM_NOTIFY:
- if (((LPNMHDR)lParam)->idFrom == 0 && ((LPNMHDR)lParam)->code == PSN_APPLY)
- {
- if (g_uUpdateMsgTimer)
- KillTimer(NULL, g_uUpdateMsgTimer);
+ case WM_NOTIFY:
+ if (((LPNMHDR)lParam)->idFrom == 0 && ((LPNMHDR)lParam)->code == PSN_APPLY)
+ {
+ if (g_uUpdateMsgTimer)
+ KillTimer(NULL, g_uUpdateMsgTimer);
- int val = SendDlgItemMessage(hwndDlg, IDC_SSECUPDTMSG, UDM_GETPOS, 0, 0);
- DBWriteContactSettingWord(NULL, "SimpleStatusMsg", "UpdateMsgInt", (WORD)val);
+ int val = SendDlgItemMessage(hwndDlg, IDC_SSECUPDTMSG, UDM_GETPOS, 0, 0);
+ DBWriteContactSettingWord(NULL, "SimpleStatusMsg", "UpdateMsgInt", (WORD)val);
- if (IsDlgButtonChecked(hwndDlg, IDC_CUPDATEMSG) == BST_CHECKED && val)
- {
- DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "UpdateMsgOn", (BYTE)1);
- g_uUpdateMsgTimer = SetTimer(NULL, 0, val * 1000, (TIMERPROC)UpdateMsgTimerProc);
- }
- else
- {
- DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "UpdateMsgOn", (BYTE)0);
- }
+ if (IsDlgButtonChecked(hwndDlg, IDC_CUPDATEMSG) == BST_CHECKED && val)
+ {
+ DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "UpdateMsgOn", (BYTE)1);
+ g_uUpdateMsgTimer = SetTimer(NULL, 0, val * 1000, (TIMERPROC)UpdateMsgTimerProc);
+ }
+ else
+ {
+ DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "UpdateMsgOn", (BYTE)0);
+ }
- DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "NoUpdateOnIdle", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CNOIDLE) == BST_CHECKED));
- DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "NoUpdateOnICQReq", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CNOICQREQ) == BST_CHECKED));
- DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "AmpLeaveTitle", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CLEAVEWINAMP) == BST_CHECKED));
- if (ServiceExists(MS_VARS_FORMATSTRING))
- {
- DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "EnableVariables", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CVARIABLES) == BST_CHECKED));
- DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "ExclDateToken", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CDATEPARSING) == BST_CHECKED));
- }
- return TRUE;
+ DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "NoUpdateOnIdle", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CNOIDLE) == BST_CHECKED));
+ DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "NoUpdateOnICQReq", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CNOICQREQ) == BST_CHECKED));
+ DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "AmpLeaveTitle", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CLEAVEWINAMP) == BST_CHECKED));
+ if (ServiceExists(MS_VARS_FORMATSTRING))
+ {
+ DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "EnableVariables", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CVARIABLES) == BST_CHECKED));
+ DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "ExclDateToken", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CDATEPARSING) == BST_CHECKED));
}
- break;
+ return TRUE;
+ }
+ break;
}
return FALSE;
}
@@ -1247,9 +1234,8 @@ static BOOL IsHistoryMsgsFound(HWND hwndDlg, int histMax)
static INT_PTR CALLBACK DlgAdvancedOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- switch (uMsg)
- {
- case WM_INITDIALOG:
+ switch (uMsg) {
+ case WM_INITDIALOG:
{
int settingValue;
@@ -1326,7 +1312,7 @@ static INT_PTR CALLBACK DlgAdvancedOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM w
return TRUE;
}
- case WM_USER + 2:
+ case WM_USER + 2:
{
BOOL bChecked = IsDlgButtonChecked(hwndDlg, IDC_CCLOSEWND) == BST_CHECKED;
EnableWindow(GetDlgItem(hwndDlg, IDC_ETIMEOUT), bChecked);
@@ -1334,133 +1320,133 @@ static INT_PTR CALLBACK DlgAdvancedOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM w
break;
}
- case WM_COMMAND:
- switch (LOWORD(wParam))
+ case WM_COMMAND:
+ switch (LOWORD(wParam))
+ {
+ case IDC_CSTATUSLIST:
{
- case IDC_CSTATUSLIST:
- {
- BOOL bChecked = IsDlgButtonChecked(hwndDlg, IDC_CSTATUSLIST) == BST_CHECKED;
- EnableWindow(GetDlgItem(hwndDlg, IDC_CPROFILES), bChecked && ServiceExists(MS_SS_GETPROFILECOUNT));
- EnableWindow(GetDlgItem(hwndDlg, IDC_CICONS1), bChecked);
- break;
- }
+ BOOL bChecked = IsDlgButtonChecked(hwndDlg, IDC_CSTATUSLIST) == BST_CHECKED;
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CPROFILES), bChecked && ServiceExists(MS_SS_GETPROFILECOUNT));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CICONS1), bChecked);
+ break;
+ }
- case IDC_CBOPTBUTTONS:
- if ((HWND)lParam != GetFocus() || HIWORD(wParam) != CBN_SELCHANGE) return 0;
- break;
+ case IDC_CBOPTBUTTONS:
+ if ((HWND)lParam != GetFocus() || HIWORD(wParam) != CBN_SELCHANGE) return 0;
+ break;
- case IDC_EMAXHIST:
- {
- if ((HWND)lParam != GetFocus() || HIWORD(wParam) != EN_CHANGE) return 0;
- int val = GetDlgItemInt(hwndDlg, IDC_EMAXHIST, NULL, FALSE);
- if (val > 25)
- SendDlgItemMessage(hwndDlg, IDC_SMAXHIST, UDM_SETPOS, 0, MAKELONG((short)25, 0));
- EnableWindow(GetDlgItem(hwndDlg, IDC_CICONS2), val != 0);
- break;
- }
+ case IDC_EMAXHIST:
+ {
+ if ((HWND)lParam != GetFocus() || HIWORD(wParam) != EN_CHANGE) return 0;
+ int val = GetDlgItemInt(hwndDlg, IDC_EMAXHIST, NULL, FALSE);
+ if (val > 25)
+ SendDlgItemMessage(hwndDlg, IDC_SMAXHIST, UDM_SETPOS, 0, MAKELONG((short)25, 0));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_CICONS2), val != 0);
+ break;
+ }
- case IDC_CCLOSEWND:
- SendMessage(hwndDlg, WM_USER + 2, 0, 0);
- break;
+ case IDC_CCLOSEWND:
+ SendMessage(hwndDlg, WM_USER + 2, 0, 0);
+ break;
- case IDC_ETIMEOUT:
+ case IDC_ETIMEOUT:
+ {
+ if ((HWND)lParam != GetFocus() || HIWORD(wParam) != EN_CHANGE) return 0;
+ int val = GetDlgItemInt(hwndDlg, IDC_ETIMEOUT, NULL, FALSE);
+ if (val == 0 && GetWindowTextLength(GetDlgItem(hwndDlg, IDC_ETIMEOUT)))
+ SendDlgItemMessage(hwndDlg, IDC_STIMEOUT, UDM_SETPOS, 0, MAKELONG((short)1, 0));
+ else if (val > 60)
+ SendDlgItemMessage(hwndDlg, IDC_STIMEOUT, UDM_SETPOS, 0, MAKELONG((short)60, 0));
+ break;
+ }
+
+ case IDC_BOPTHIST:
+ if (MessageBox(NULL, TranslateT("Are you sure you want to clear status message history?"), TranslateT("Confirm clearing history"), MB_ICONQUESTION | MB_YESNO) == IDYES)
+ {
+ int i, max_hist_msgs;
+ char text[8], setting[80];
+
+ if (hwndSAMsgDialog) DestroyWindow(hwndSAMsgDialog);
+
+ max_hist_msgs = DBGetContactSettingByte(NULL, "SimpleStatusMsg", "MaxHist", 10);
+ for (i = 1; i <= max_hist_msgs; i++)
{
- if ((HWND)lParam != GetFocus() || HIWORD(wParam) != EN_CHANGE) return 0;
- int val = GetDlgItemInt(hwndDlg, IDC_ETIMEOUT, NULL, FALSE);
- if (val == 0 && GetWindowTextLength(GetDlgItem(hwndDlg, IDC_ETIMEOUT)))
- SendDlgItemMessage(hwndDlg, IDC_STIMEOUT, UDM_SETPOS, 0, MAKELONG((short)1, 0));
- else if (val > 60)
- SendDlgItemMessage(hwndDlg, IDC_STIMEOUT, UDM_SETPOS, 0, MAKELONG((short)60, 0));
- break;
+ mir_snprintf(text, SIZEOF(text), "SMsg%d", i);
+ DBWriteContactSettingTString(NULL, "SimpleStatusMsg", text, _T(""));
}
+ DBWriteContactSettingString(NULL, "SimpleStatusMsg", "LastMsg", "");
+ for (i = 0; i < accounts->count; i++)
+ {
+ if (!IsAccountEnabled(accounts->pa[i]))
+ continue;
- case IDC_BOPTHIST:
- if (MessageBox(NULL, TranslateT("Are you sure you want to clear status message history?"), TranslateT("Confirm clearing history"), MB_ICONQUESTION | MB_YESNO) == IDYES)
- {
- int i, max_hist_msgs;
- char text[8], setting[80];
+ if (!CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0))
+ continue;
- if (hwndSAMsgDialog) DestroyWindow(hwndSAMsgDialog);
+ if (!(CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND))
+ continue;
- max_hist_msgs = DBGetContactSettingByte(NULL, "SimpleStatusMsg", "MaxHist", 10);
- for (i = 1; i <= max_hist_msgs; i++)
- {
- mir_snprintf(text, SIZEOF(text), "SMsg%d", i);
- DBWriteContactSettingTString(NULL, "SimpleStatusMsg", text, _T(""));
- }
- DBWriteContactSettingString(NULL, "SimpleStatusMsg", "LastMsg", "");
- for (i = 0; i < accounts->count; i++)
- {
- if (!IsAccountEnabled(accounts->pa[i]))
- continue;
+ mir_snprintf(setting, SIZEOF(setting), "Last%sMsg", accounts->pa[i]->szModuleName);
+ DBWriteContactSettingString(NULL, "SimpleStatusMsg", setting, "");
+ }
+ DBWriteContactSettingWord(NULL, "SimpleStatusMsg", "LMMsg", (WORD)max_hist_msgs);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_BOPTHIST), FALSE);
+ }
+ return 0;
- if (!CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0))
- continue;
+ case IDC_BOPTDEF:
+ if (MessageBox(NULL, TranslateT("Are you sure you want to clear predefined status messages?"), TranslateT("Confirm clearing predefined"), MB_ICONQUESTION | MB_YESNO) == IDYES)
+ {
+ char szSetting[16];
+ int nDefMSgCount;
- if (!(CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND))
- continue;
+ if (hwndSAMsgDialog) DestroyWindow(hwndSAMsgDialog);
- mir_snprintf(setting, SIZEOF(setting), "Last%sMsg", accounts->pa[i]->szModuleName);
- DBWriteContactSettingString(NULL, "SimpleStatusMsg", setting, "");
- }
- DBWriteContactSettingWord(NULL, "SimpleStatusMsg", "LMMsg", (WORD)max_hist_msgs);
- EnableWindow(GetDlgItem(hwndDlg, IDC_BOPTHIST), FALSE);
- }
- return 0;
+ nDefMSgCount = DBGetContactSettingWord(NULL, "SimpleStatusMsg", "DefMsgCount", 0);
+ for (int i = 1; i <= nDefMSgCount; i++)
+ {
+ mir_snprintf(szSetting, SIZEOF(szSetting), "DefMsg%d", i);
+ DBDeleteContactSetting(NULL, "SimpleStatusMsg", szSetting);
+ }
+ DBWriteContactSettingWord(NULL, "SimpleStatusMsg", "DefMsgCount", 0);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_BOPTDEF), FALSE);
+ }
+ return 0;
+ }
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ break;
- case IDC_BOPTDEF:
- if (MessageBox(NULL, TranslateT("Are you sure you want to clear predefined status messages?"), TranslateT("Confirm clearing predefined"), MB_ICONQUESTION | MB_YESNO) == IDYES)
- {
- char szSetting[16];
- int nDefMSgCount;
+ case WM_NOTIFY:
+ if (((LPNMHDR)lParam)->idFrom == 0 && ((LPNMHDR)lParam)->code == PSN_APPLY)
+ {
+ // Layout
+ int flags = 0, curSel;
- if (hwndSAMsgDialog) DestroyWindow(hwndSAMsgDialog);
+ if (IsDlgButtonChecked(hwndDlg, IDC_CSTATUSLIST) == BST_CHECKED) flags |= DLG_SHOW_STATUS;
+ if (IsDlgButtonChecked(hwndDlg, IDC_CICONS1) == BST_CHECKED) flags |= DLG_SHOW_STATUS_ICONS;
+ if (IsDlgButtonChecked(hwndDlg, IDC_CICONS2) == BST_CHECKED) flags |= DLG_SHOW_LIST_ICONS;
+ if (IsDlgButtonChecked(hwndDlg, IDC_CPROFILES) == BST_CHECKED) flags |= DLG_SHOW_STATUS_PROFILES;
- nDefMSgCount = DBGetContactSettingWord(NULL, "SimpleStatusMsg", "DefMsgCount", 0);
- for (int i = 1; i <= nDefMSgCount; i++)
- {
- mir_snprintf(szSetting, SIZEOF(szSetting), "DefMsg%d", i);
- DBDeleteContactSetting(NULL, "SimpleStatusMsg", szSetting);
- }
- DBWriteContactSettingWord(NULL, "SimpleStatusMsg", "DefMsgCount", 0);
- EnableWindow(GetDlgItem(hwndDlg, IDC_BOPTDEF), FALSE);
- }
- return 0;
- }
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- break;
+ curSel = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTBUTTONS), CB_GETCURSEL, 0, 0);
+ if (curSel != CB_ERR)
+ flags |= SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTBUTTONS), CB_GETITEMDATA, (WPARAM)curSel, 0);
- case WM_NOTIFY:
- if (((LPNMHDR)lParam)->idFrom == 0 && ((LPNMHDR)lParam)->code == PSN_APPLY)
- {
- // Layout
- int flags = 0, curSel;
-
- if (IsDlgButtonChecked(hwndDlg, IDC_CSTATUSLIST) == BST_CHECKED) flags |= DLG_SHOW_STATUS;
- if (IsDlgButtonChecked(hwndDlg, IDC_CICONS1) == BST_CHECKED) flags |= DLG_SHOW_STATUS_ICONS;
- if (IsDlgButtonChecked(hwndDlg, IDC_CICONS2) == BST_CHECKED) flags |= DLG_SHOW_LIST_ICONS;
- if (IsDlgButtonChecked(hwndDlg, IDC_CPROFILES) == BST_CHECKED) flags |= DLG_SHOW_STATUS_PROFILES;
-
- curSel = SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTBUTTONS), CB_GETCURSEL, 0, 0);
- if (curSel != CB_ERR)
- flags |= SendMessage(GetDlgItem(hwndDlg, IDC_CBOPTBUTTONS), CB_GETITEMDATA, (WPARAM)curSel, 0);
-
- DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "DlgFlags", (BYTE)flags);
-
- // Misc.
- DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "MaxHist", (BYTE)GetDlgItemInt(hwndDlg, IDC_EMAXHIST, NULL, FALSE));
- DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "AutoClose", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CCLOSEWND) == BST_CHECKED));
- DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "DlgTime", (BYTE)GetDlgItemInt(hwndDlg, IDC_ETIMEOUT, NULL, FALSE));
- DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "WinCentered", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CRPOSWND) != BST_CHECKED));
- DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "RemoveCR", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CREMOVECR) == BST_CHECKED));
- DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "ShowCopy", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CSHOWCOPY) == BST_CHECKED));
- DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "ShowGoToURL", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CSHOWGURL) == BST_CHECKED));
- DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "ShowStatusMenuItem", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CSHOWSMSG) == BST_CHECKED));
- RebuildStatusMenu();
+ DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "DlgFlags", (BYTE)flags);
- return TRUE;
- }
- break;
+ // Misc.
+ DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "MaxHist", (BYTE)GetDlgItemInt(hwndDlg, IDC_EMAXHIST, NULL, FALSE));
+ DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "AutoClose", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CCLOSEWND) == BST_CHECKED));
+ DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "DlgTime", (BYTE)GetDlgItemInt(hwndDlg, IDC_ETIMEOUT, NULL, FALSE));
+ DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "WinCentered", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CRPOSWND) != BST_CHECKED));
+ DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "RemoveCR", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CREMOVECR) == BST_CHECKED));
+ DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "ShowCopy", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CSHOWCOPY) == BST_CHECKED));
+ DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "ShowGoToURL", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CSHOWGURL) == BST_CHECKED));
+ DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "ShowStatusMenuItem", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_CSHOWSMSG) == BST_CHECKED));
+ RebuildStatusMenu();
+
+ return TRUE;
+ }
+ break;
}
return FALSE;
}
@@ -1476,9 +1462,8 @@ static INT_PTR CALLBACK DlgStatusOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wPa
{
struct StatusOptDlgData *data = (struct StatusOptDlgData *)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- switch (uMsg)
- {
- case WM_INITDIALOG:
+ switch (uMsg) {
+ case WM_INITDIALOG:
{
int index, i;
@@ -1550,159 +1535,154 @@ static INT_PTR CALLBACK DlgStatusOptionsProc(HWND hwndDlg, UINT uMsg, WPARAM wPa
return TRUE;
}
- case WM_COMMAND:
- if ( ( (HIWORD(wParam) == BN_CLICKED) || /*(HIWORD(wParam) == EN_KILLFOCUS) ||*/ (HIWORD(wParam) == EN_CHANGE)
- || ( (HIWORD(wParam) == LBN_SELCHANGE) && (LOWORD(wParam) != IDC_LISTPROTO))
- ) && (HWND)lParam == GetFocus())
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- switch (LOWORD(wParam))
- {
- case IDC_ESETSTATUS:
- switch (HIWORD(wParam))
- {
- case EN_KILLFOCUS:
- {
- BOOL translated;
- int val = GetDlgItemInt(hwndDlg, IDC_ESETSTATUS, &translated, FALSE);
- if (translated && val > 9000)
- SetDlgItemInt(hwndDlg, IDC_ESETSTATUS, 9000, FALSE);
- if (translated && val < 0)
- SetDlgItemInt(hwndDlg, IDC_ESETSTATUS, 0, FALSE);
- val = GetDlgItemInt(hwndDlg, IDC_ESETSTATUS, &translated, FALSE);
-
- if (IsDlgButtonChecked(hwndDlg, IDC_SPECSET) == BST_CHECKED || (accounts->statusCount == 1 && accounts->statusMsgCount == 1))
- {
- int i = SendMessage(GetDlgItem(hwndDlg, IDC_LISTPROTO), LB_GETITEMDATA, (WPARAM)SendMessage(GetDlgItem(hwndDlg, IDC_LISTPROTO), LB_GETCURSEL, 0, 0), 0);
- data->setdelay[i] = val;
- }
- else
- data->setglobaldelay = val;
- break;
- }
- }
- break;
-
- case IDC_SPECSET:
- switch (HIWORD(wParam))
+ case WM_COMMAND:
+ if ( ( (HIWORD(wParam) == BN_CLICKED) || /*(HIWORD(wParam) == EN_KILLFOCUS) ||*/ (HIWORD(wParam) == EN_CHANGE)
+ || ( (HIWORD(wParam) == LBN_SELCHANGE) && (LOWORD(wParam) != IDC_LISTPROTO))
+ ) && (HWND)lParam == GetFocus())
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ switch (LOWORD(wParam)) {
+ case IDC_ESETSTATUS:
+ switch (HIWORD(wParam)) {
+ case EN_KILLFOCUS:
+ {
+ BOOL translated;
+ int val = GetDlgItemInt(hwndDlg, IDC_ESETSTATUS, &translated, FALSE);
+ if (translated && val > 9000)
+ SetDlgItemInt(hwndDlg, IDC_ESETSTATUS, 9000, FALSE);
+ if (translated && val < 0)
+ SetDlgItemInt(hwndDlg, IDC_ESETSTATUS, 0, FALSE);
+ val = GetDlgItemInt(hwndDlg, IDC_ESETSTATUS, &translated, FALSE);
+
+ if (IsDlgButtonChecked(hwndDlg, IDC_SPECSET) == BST_CHECKED || (accounts->statusCount == 1 && accounts->statusMsgCount == 1))
{
- case BN_CLICKED:
- if (SendMessage((HWND)lParam, BM_GETCHECK, 0, 0) == BST_CHECKED || (accounts->statusCount == 1 && accounts->statusMsgCount == 1))
- {
- int i = SendMessage(GetDlgItem(hwndDlg, IDC_LISTPROTO), LB_GETITEMDATA, (WPARAM)SendMessage(GetDlgItem(hwndDlg, IDC_LISTPROTO), LB_GETCURSEL, 0, 0), 0);
- SetDlgItemInt(hwndDlg, IDC_ESETSTATUS, data->setdelay[i], FALSE);
- }
- else
- SetDlgItemInt(hwndDlg, IDC_ESETSTATUS, data->setglobaldelay, FALSE);
- break;
+ int i = SendMessage(GetDlgItem(hwndDlg, IDC_LISTPROTO), LB_GETITEMDATA, (WPARAM)SendMessage(GetDlgItem(hwndDlg, IDC_LISTPROTO), LB_GETCURSEL, 0, 0), 0);
+ data->setdelay[i] = val;
}
+ else
+ data->setglobaldelay = val;
break;
+ }
+ }
+ break;
- case IDC_POPUPDLG:
- switch (HIWORD(wParam))
- {
- case BN_CLICKED:
- if (accounts->statusCount == 1 && accounts->statusMsgCount == 1)
- break;
+ case IDC_SPECSET:
+ switch (HIWORD(wParam))
+ {
+ case BN_CLICKED:
+ if (SendMessage((HWND)lParam, BM_GETCHECK, 0, 0) == BST_CHECKED || (accounts->statusCount == 1 && accounts->statusMsgCount == 1))
+ {
+ int i = SendMessage(GetDlgItem(hwndDlg, IDC_LISTPROTO), LB_GETITEMDATA, (WPARAM)SendMessage(GetDlgItem(hwndDlg, IDC_LISTPROTO), LB_GETCURSEL, 0, 0), 0);
+ SetDlgItemInt(hwndDlg, IDC_ESETSTATUS, data->setdelay[i], FALSE);
+ }
+ else
+ SetDlgItemInt(hwndDlg, IDC_ESETSTATUS, data->setglobaldelay, FALSE);
+ break;
+ }
+ break;
- if (SendMessage((HWND)lParam, BM_GETCHECK, 0, 0) == BST_CHECKED)
- {
- if (IsDlgButtonChecked(hwndDlg, IDC_SPECSET) == BST_CHECKED)
- {
- CheckDlgButton(hwndDlg, IDC_SPECSET, BST_UNCHECKED);
- SetDlgItemInt(hwndDlg, IDC_ESETSTATUS, data->setglobaldelay, FALSE);
- }
- EnableWindow(GetDlgItem(hwndDlg, IDC_SPECSET), FALSE);
- }
- else
- EnableWindow(GetDlgItem(hwndDlg, IDC_SPECSET), TRUE);
- break;
- }
+ case IDC_POPUPDLG:
+ switch (HIWORD(wParam)) {
+ case BN_CLICKED:
+ if (accounts->statusCount == 1 && accounts->statusMsgCount == 1)
break;
- case IDC_LISTPROTO:
- switch (HIWORD(wParam))
+ if (SendMessage((HWND)lParam, BM_GETCHECK, 0, 0) == BST_CHECKED)
+ {
+ if (IsDlgButtonChecked(hwndDlg, IDC_SPECSET) == BST_CHECKED)
{
- case LBN_SELCHANGE:
- {
- int status_modes, i, l, index, newindex = 0;
+ CheckDlgButton(hwndDlg, IDC_SPECSET, BST_UNCHECKED);
+ SetDlgItemInt(hwndDlg, IDC_ESETSTATUS, data->setglobaldelay, FALSE);
+ }
+ EnableWindow(GetDlgItem(hwndDlg, IDC_SPECSET), FALSE);
+ }
+ else
+ EnableWindow(GetDlgItem(hwndDlg, IDC_SPECSET), TRUE);
+ break;
+ }
+ break;
- i = SendMessage((HWND)lParam, LB_GETITEMDATA, (WPARAM)SendMessage((HWND)lParam, LB_GETCURSEL, 0, 0), 0);
- status_modes = CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0) & ~CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_5, 0);
+ case IDC_LISTPROTO:
+ switch (HIWORD(wParam)) {
+ case LBN_SELCHANGE:
+ {
+ int status_modes, i, l, index, newindex = 0;
- SendMessage(GetDlgItem(hwndDlg, IDC_LISTSTATUS), LB_RESETCONTENT, 0, 0);
- for (l = ID_STATUS_OFFLINE; l <= ID_STATUS_OUTTOLUNCH; l++)
- {
- if (status_modes & Proto_Status2Flag(l) || l == ID_STATUS_OFFLINE)
- {
- index = SendMessage(GetDlgItem(hwndDlg, IDC_LISTSTATUS), LB_INSERTSTRING, -1, (LPARAM)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, l, GSMDF_TCHAR));
- if (index != LB_ERR && index != LB_ERRSPACE)
- {
- SendMessage(GetDlgItem(hwndDlg, IDC_LISTSTATUS), LB_SETITEMDATA, (WPARAM)index, (LPARAM)l - ID_STATUS_OFFLINE);
- if (data->status[i] == l)
- newindex = index;
- }
- }
- }
+ i = SendMessage((HWND)lParam, LB_GETITEMDATA, (WPARAM)SendMessage((HWND)lParam, LB_GETCURSEL, 0, 0), 0);
+ status_modes = CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0) & ~CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_5, 0);
- index = SendMessage(GetDlgItem(hwndDlg, IDC_LISTSTATUS), LB_INSERTSTRING, -1, (LPARAM)TranslateT("<Last status>"));
+ SendMessage(GetDlgItem(hwndDlg, IDC_LISTSTATUS), LB_RESETCONTENT, 0, 0);
+ for (l = ID_STATUS_OFFLINE; l <= ID_STATUS_OUTTOLUNCH; l++)
+ {
+ if (status_modes & Proto_Status2Flag(l) || l == ID_STATUS_OFFLINE)
+ {
+ index = SendMessage(GetDlgItem(hwndDlg, IDC_LISTSTATUS), LB_INSERTSTRING, -1, (LPARAM)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, l, GSMDF_TCHAR));
if (index != LB_ERR && index != LB_ERRSPACE)
{
- SendMessage(GetDlgItem(hwndDlg, IDC_LISTSTATUS), LB_SETITEMDATA, (WPARAM)index, (LPARAM)ID_STATUS_CURRENT-ID_STATUS_OFFLINE);
- if (data->status[i] == ID_STATUS_CURRENT)
+ SendMessage(GetDlgItem(hwndDlg, IDC_LISTSTATUS), LB_SETITEMDATA, (WPARAM)index, (LPARAM)l - ID_STATUS_OFFLINE);
+ if (data->status[i] == l)
newindex = index;
}
-
- SendMessage(GetDlgItem(hwndDlg, IDC_LISTSTATUS), LB_SETCURSEL, (WPARAM)newindex, 0);
-
- if (IsDlgButtonChecked(hwndDlg, IDC_SPECSET) == BST_CHECKED || (accounts->statusCount == 1 && accounts->statusMsgCount == 1))
- SetDlgItemInt(hwndDlg, IDC_ESETSTATUS, data->setdelay[i], FALSE);
- break;
}
}
- break;
- case IDC_LISTSTATUS:
- switch (HIWORD(wParam))
+ index = SendMessage(GetDlgItem(hwndDlg, IDC_LISTSTATUS), LB_INSERTSTRING, -1, (LPARAM)TranslateT("<Last status>"));
+ if (index != LB_ERR && index != LB_ERRSPACE)
{
- case LBN_SELCHANGE:
- {
- int i = SendMessage((HWND)lParam, LB_GETITEMDATA, (WPARAM)SendMessage((HWND)lParam, LB_GETCURSEL, 0, 0), 0);
- int j = SendMessage(GetDlgItem(hwndDlg, IDC_LISTPROTO), LB_GETITEMDATA, (WPARAM)SendMessage(GetDlgItem(hwndDlg, IDC_LISTPROTO), LB_GETCURSEL, 0, 0), 0);
- data->status[j] = i + ID_STATUS_OFFLINE;
- break;
- }
+ SendMessage(GetDlgItem(hwndDlg, IDC_LISTSTATUS), LB_SETITEMDATA, (WPARAM)index, (LPARAM)ID_STATUS_CURRENT-ID_STATUS_OFFLINE);
+ if (data->status[i] == ID_STATUS_CURRENT)
+ newindex = index;
}
+
+ SendMessage(GetDlgItem(hwndDlg, IDC_LISTSTATUS), LB_SETCURSEL, (WPARAM)newindex, 0);
+
+ if (IsDlgButtonChecked(hwndDlg, IDC_SPECSET) == BST_CHECKED || (accounts->statusCount == 1 && accounts->statusMsgCount == 1))
+ SetDlgItemInt(hwndDlg, IDC_ESETSTATUS, data->setdelay[i], FALSE);
break;
+ }
}
break;
- case WM_NOTIFY:
- if (((LPNMHDR)lParam)->idFrom == 0 && ((LPNMHDR)lParam)->code == PSN_APPLY)
- {
- char szSetting[80];
- for (int i = 0; i < accounts->count; i++)
+ case IDC_LISTSTATUS:
+ switch (HIWORD(wParam)) {
+ case LBN_SELCHANGE:
{
- if (!IsAccountEnabled(accounts->pa[i]) || !(CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0)&~CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_5, 0)))
- continue;
-
- mir_snprintf(szSetting, SIZEOF(szSetting), "Startup%sStatus", accounts->pa[i]->szModuleName);
- DBWriteContactSettingWord(NULL, "SimpleStatusMsg", szSetting, (WORD)data->status[i]);
-
- mir_snprintf(szSetting, SIZEOF(szSetting), "Set%sStatusDelay", accounts->pa[i]->szModuleName);
- DBWriteContactSettingWord(NULL, "SimpleStatusMsg", szSetting, (WORD)data->setdelay[i]);
+ int i = SendMessage((HWND)lParam, LB_GETITEMDATA, (WPARAM)SendMessage((HWND)lParam, LB_GETCURSEL, 0, 0), 0);
+ int j = SendMessage(GetDlgItem(hwndDlg, IDC_LISTPROTO), LB_GETITEMDATA, (WPARAM)SendMessage(GetDlgItem(hwndDlg, IDC_LISTPROTO), LB_GETCURSEL, 0, 0), 0);
+ data->status[j] = i + ID_STATUS_OFFLINE;
+ break;
}
- DBWriteContactSettingWord(NULL, "SimpleStatusMsg", "SetStatusDelay", (WORD)data->setglobaldelay);
- DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "GlobalStatusDelay", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_SPECSET) != BST_CHECKED));
- DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "StartupPopupDlg", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_POPUPDLG) == BST_CHECKED));
- return TRUE;
}
break;
+ }
+ break;
- case WM_DESTROY:
- mir_free(data->status);
- mir_free(data->setdelay);
- mir_free(data);
- break;
+ case WM_NOTIFY:
+ if (((LPNMHDR)lParam)->idFrom == 0 && ((LPNMHDR)lParam)->code == PSN_APPLY)
+ {
+ char szSetting[80];
+ for (int i = 0; i < accounts->count; i++)
+ {
+ if (!IsAccountEnabled(accounts->pa[i]) || !(CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0)&~CallProtoService(accounts->pa[i]->szModuleName, PS_GETCAPS, PFLAGNUM_5, 0)))
+ continue;
+
+ mir_snprintf(szSetting, SIZEOF(szSetting), "Startup%sStatus", accounts->pa[i]->szModuleName);
+ DBWriteContactSettingWord(NULL, "SimpleStatusMsg", szSetting, (WORD)data->status[i]);
+
+ mir_snprintf(szSetting, SIZEOF(szSetting), "Set%sStatusDelay", accounts->pa[i]->szModuleName);
+ DBWriteContactSettingWord(NULL, "SimpleStatusMsg", szSetting, (WORD)data->setdelay[i]);
+ }
+ DBWriteContactSettingWord(NULL, "SimpleStatusMsg", "SetStatusDelay", (WORD)data->setglobaldelay);
+ DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "GlobalStatusDelay", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_SPECSET) != BST_CHECKED));
+ DBWriteContactSettingByte(NULL, "SimpleStatusMsg", "StartupPopupDlg", (BYTE)(IsDlgButtonChecked(hwndDlg, IDC_POPUPDLG) == BST_CHECKED));
+ return TRUE;
+ }
+ break;
+
+ case WM_DESTROY:
+ mir_free(data->status);
+ mir_free(data->setdelay);
+ mir_free(data);
+ break;
}
return FALSE;
}