summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/StatusManager/StatusManager.vcxproj12
-rw-r--r--plugins/StatusManager/src/AdvancedAutoAway/aaa_msgoptions.cpp188
-rw-r--r--plugins/StatusManager/src/aaa_options.cpp (renamed from plugins/StatusManager/src/AdvancedAutoAway/aaa_options.cpp)212
-rw-r--r--plugins/StatusManager/src/advancedautoaway.cpp (renamed from plugins/StatusManager/src/AdvancedAutoAway/advancedautoaway.cpp)8
-rw-r--r--plugins/StatusManager/src/advancedautoaway.h (renamed from plugins/StatusManager/src/AdvancedAutoAway/advancedautoaway.h)2
-rw-r--r--plugins/StatusManager/src/commonstatus.cpp14
-rw-r--r--plugins/StatusManager/src/commonstatus.h16
-rw-r--r--plugins/StatusManager/src/confirmdialog.cpp13
-rw-r--r--plugins/StatusManager/src/keepstatus.cpp (renamed from plugins/StatusManager/src/KeepStatus/keepstatus.cpp)2
-rw-r--r--plugins/StatusManager/src/keepstatus.h (renamed from plugins/StatusManager/src/KeepStatus/keepstatus.h)0
-rw-r--r--plugins/StatusManager/src/ks_options.cpp (renamed from plugins/StatusManager/src/KeepStatus/ks_options.cpp)2
-rw-r--r--plugins/StatusManager/src/ss_options.cpp (renamed from plugins/StatusManager/src/StartupStatus/ss_options.cpp)10
-rw-r--r--plugins/StatusManager/src/ss_profiles.cpp (renamed from plugins/StatusManager/src/StartupStatus/ss_profiles.cpp)2
-rw-r--r--plugins/StatusManager/src/ss_toolbars.cpp (renamed from plugins/StatusManager/src/StartupStatus/ss_toolbars.cpp)2
-rw-r--r--plugins/StatusManager/src/startupstatus.cpp (renamed from plugins/StatusManager/src/StartupStatus/startupstatus.cpp)2
-rw-r--r--plugins/StatusManager/src/startupstatus.h (renamed from plugins/StatusManager/src/StartupStatus/startupstatus.h)0
-rw-r--r--plugins/StatusManager/src/stdafx.h6
17 files changed, 241 insertions, 250 deletions
diff --git a/plugins/StatusManager/StatusManager.vcxproj b/plugins/StatusManager/StatusManager.vcxproj
index f194247e9c..5cd732cc2c 100644
--- a/plugins/StatusManager/StatusManager.vcxproj
+++ b/plugins/StatusManager/StatusManager.vcxproj
@@ -26,18 +26,6 @@
<Import Project="$(ProjectDir)..\..\build\vc.common\plugin.props" />
</ImportGroup>
<ItemGroup>
- <ClInclude Include="src\KeepStatus\*.h" />
- <ClCompile Include="src\KeepStatus\*.cpp">
- <PrecompiledHeaderFile>..\stdafx.h</PrecompiledHeaderFile>
- </ClCompile>
- <ClInclude Include="src\StartupStatus\*.h" />
- <ClCompile Include="src\StartupStatus\*.cpp">
- <PrecompiledHeaderFile>..\stdafx.h</PrecompiledHeaderFile>
- </ClCompile>
- <ClInclude Include="src\AdvancedAutoAway\*.h" />
- <ClCompile Include="src\AdvancedAutoAway\*.cpp">
- <PrecompiledHeaderFile>..\stdafx.h</PrecompiledHeaderFile>
- </ClCompile>
<ClCompile Include="..\helpers\gen_helpers.cpp">
<PrecompiledHeader>NotUsing</PrecompiledHeader>
</ClCompile>
diff --git a/plugins/StatusManager/src/AdvancedAutoAway/aaa_msgoptions.cpp b/plugins/StatusManager/src/AdvancedAutoAway/aaa_msgoptions.cpp
deleted file mode 100644
index 2f4228af74..0000000000
--- a/plugins/StatusManager/src/AdvancedAutoAway/aaa_msgoptions.cpp
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- AdvancedAutoAway Plugin for Miranda-IM (www.miranda-im.org)
- Copyright 2003-2006 P. Boon
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License
- along with this program; if not, write to the Free Software
- Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-*/
-
-#include "..\stdafx.h"
-
-struct AAMSGSETTING
-{
- short useCustom;
- int status;
- char* msg;
-};
-
-char *StatusModeToDbSetting(int status, const char *suffix);
-
-void DisableDialog(HWND hwndDlg)
-{
- EnableWindow(GetDlgItem(hwndDlg, IDC_STATUS), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_STATUSMSG), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_VARIABLESHELP), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_RADUSECUSTOM), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_RADUSEMIRANDA), FALSE);
-}
-
-INT_PTR CALLBACK DlgProcAutoAwayMsgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
-{
- static AAMSGSETTING** settings;
- static int last, count;
-
- switch (msg) {
- case WM_INITDIALOG:
- TranslateDialogDefault(hwndDlg);
- {
- ShowWindow(GetDlgItem(hwndDlg, IDC_VARIABLESHELP), ServiceExists(MS_VARS_SHOWHELP) ? SW_SHOW : SW_HIDE);
- count = 0;
- last = -1;
-
- PROTOACCOUNT** proto;
- int protoCount = 0;
- Proto_EnumAccounts(&protoCount, &proto);
- if (protoCount <= 0) {
- DisableDialog(hwndDlg);
- break;
- }
-
- DWORD protoModeMsgFlags = 0;
- for (int i = 0; i < protoCount; i++)
- if (CallProtoService(proto[i]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND & ~PF1_INDIVMODEMSG)
- protoModeMsgFlags |= CallProtoService(proto[i]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0);
-
- if (protoModeMsgFlags == 0) {
- DisableDialog(hwndDlg);
- break;
- }
-
- settings = (AAMSGSETTING**)mir_alloc(sizeof(AAMSGSETTING*));
- count = 0;
- for (int i = 0; i < _countof(statusModeList); i++) {
- if (!(protoModeMsgFlags & Proto_Status2Flag(statusModeList[i])))
- continue;
-
- int j = SendDlgItemMessage(hwndDlg, IDC_STATUS, CB_ADDSTRING, 0, (LPARAM)Clist_GetStatusModeDescription(statusModeList[i], 0));
- SendDlgItemMessage(hwndDlg, IDC_STATUS, CB_SETITEMDATA, j, statusModeList[i]);
- settings = (AAMSGSETTING**)mir_realloc(settings, (count + 1) * sizeof(AAMSGSETTING*));
- settings[count] = (AAMSGSETTING*)mir_alloc(sizeof(AAMSGSETTING));
- settings[count]->status = statusModeList[i];
-
- DBVARIANT dbv;
- if (!db_get(0, AAAMODULENAME, StatusModeToDbSetting(statusModeList[i], SETTING_STATUSMSG), &dbv)) {
- settings[count]->msg = (char*)mir_alloc(mir_strlen(dbv.pszVal) + 1);
- mir_strcpy(settings[count]->msg, dbv.pszVal);
- db_free(&dbv);
- }
- else settings[count]->msg = nullptr;
-
- settings[count]->useCustom = db_get_b(0, AAAMODULENAME, StatusModeToDbSetting(statusModeList[i], SETTING_MSGCUSTOM), FALSE);
- count += 1;
- }
- SendDlgItemMessage(hwndDlg, IDC_STATUS, CB_SETCURSEL, 0, 0);
- SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_STATUS, CBN_SELCHANGE), 0);
- }
- break;
-
- case WM_COMMAND:
- if (((HIWORD(wParam) == EN_CHANGE) || (HIWORD(wParam) == BN_CLICKED)) && ((HWND)lParam == GetFocus()))
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
-
- switch (LOWORD(wParam)) {
- case IDC_RADUSEMIRANDA:
- CheckDlgButton(hwndDlg, IDC_RADUSECUSTOM, BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_RADUSEMIRANDA) ? BST_CHECKED : BST_UNCHECKED);
- EnableWindow(GetDlgItem(hwndDlg, IDC_STATUSMSG), IsDlgButtonChecked(hwndDlg, IDC_RADUSECUSTOM));
- EnableWindow(GetDlgItem(hwndDlg, IDC_VARIABLESHELP), IsDlgButtonChecked(hwndDlg, IDC_RADUSECUSTOM));
- settings[SendDlgItemMessage(hwndDlg, IDC_STATUS, CB_GETCURSEL, 0, 0)]->useCustom = IsDlgButtonChecked(hwndDlg, IDC_RADUSECUSTOM);
- break;
-
- case IDC_RADUSECUSTOM:
- CheckDlgButton(hwndDlg, IDC_RADUSEMIRANDA, BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_RADUSECUSTOM) ? BST_CHECKED : BST_UNCHECKED);
- EnableWindow(GetDlgItem(hwndDlg, IDC_STATUSMSG), IsDlgButtonChecked(hwndDlg, IDC_RADUSECUSTOM));
- EnableWindow(GetDlgItem(hwndDlg, IDC_VARIABLESHELP), IsDlgButtonChecked(hwndDlg, IDC_RADUSECUSTOM));
- settings[SendDlgItemMessage(hwndDlg, IDC_STATUS, CB_GETCURSEL, 0, 0)]->useCustom = IsDlgButtonChecked(hwndDlg, IDC_RADUSECUSTOM);
- break;
-
- case IDC_STATUS:
- if (HIWORD(wParam) == CBN_SELCHANGE) {
- int i = SendDlgItemMessage(hwndDlg, IDC_STATUS, CB_GETCURSEL, 0, 0);
- int len = SendDlgItemMessage(hwndDlg, IDC_STATUSMSG, WM_GETTEXTLENGTH, 0, 0);
- if (last != -1) {
- if (settings[last]->msg == nullptr)
- settings[last]->msg = (char*)mir_alloc(len + 1);
- else
- settings[last]->msg = (char*)mir_realloc(settings[last]->msg, len + 1);
- GetDlgItemTextA(hwndDlg, IDC_STATUSMSG, settings[last]->msg, (len + 1));
- }
-
- if (i != -1) {
- if (settings[i]->msg != nullptr)
- SetDlgItemTextA(hwndDlg, IDC_STATUSMSG, settings[i]->msg);
- else {
- ptrW msgw((wchar_t*)CallService(MS_AWAYMSG_GETSTATUSMSGW, settings[i]->status, 0));
- SetDlgItemText(hwndDlg, IDC_STATUSMSG, (msgw != nullptr) ? msgw : L"");
- }
-
- if (settings[i]->useCustom) {
- EnableWindow(GetDlgItem(hwndDlg, IDC_STATUSMSG), TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_VARIABLESHELP), TRUE);
- CheckDlgButton(hwndDlg, IDC_RADUSECUSTOM, BST_CHECKED);
- CheckDlgButton(hwndDlg, IDC_RADUSEMIRANDA, BST_UNCHECKED);
- }
- else {
- EnableWindow(GetDlgItem(hwndDlg, IDC_STATUSMSG), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_VARIABLESHELP), FALSE);
- CheckDlgButton(hwndDlg, IDC_RADUSEMIRANDA, BST_CHECKED);
- CheckDlgButton(hwndDlg, IDC_RADUSECUSTOM, BST_UNCHECKED);
- }
- }
- last = i;
- }
- break;
-
- case IDC_VARIABLESHELP:
- CallService(MS_VARS_SHOWHELP, (WPARAM)GetDlgItem(hwndDlg, IDC_STATUSMSG), 0);
- break;
- }
- break;
-
- case WM_NOTIFY:
- switch (((LPNMHDR)lParam)->code) {
- case PSN_WIZFINISH:
- AAALoadOptions();
- break;
-
- case PSN_APPLY:
- SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_STATUS, CBN_SELCHANGE), 0);
- for (int i = 0; i < count; i++) {
- db_set_b(0, AAAMODULENAME, StatusModeToDbSetting(settings[i]->status, SETTING_MSGCUSTOM), (BYTE)settings[i]->useCustom);
- if ((settings[i]->useCustom) && (settings[i]->msg != nullptr) && (settings[i]->msg[0] != '\0'))
- db_set_s(0, AAAMODULENAME, StatusModeToDbSetting(settings[i]->status, SETTING_STATUSMSG), settings[i]->msg);
- }
- break;
- }
- break;
-
- case WM_DESTROY:
- for (int i = 0; i < count; i++) {
- mir_free(settings[i]->msg);
- mir_free(settings[i]);
- }
- mir_free(settings);
- break;
- }
-
- return FALSE;
-}
diff --git a/plugins/StatusManager/src/AdvancedAutoAway/aaa_options.cpp b/plugins/StatusManager/src/aaa_options.cpp
index 2176847926..a8473936b1 100644
--- a/plugins/StatusManager/src/AdvancedAutoAway/aaa_options.cpp
+++ b/plugins/StatusManager/src/aaa_options.cpp
@@ -17,13 +17,179 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "..\stdafx.h"
+#include "stdafx.h"
int LoadAutoAwaySetting(SMProto &autoAwaySetting, char* protoName);
-INT_PTR CALLBACK DlgProcAutoAwayMsgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam);
+bool g_bAAASettingSame;
-static BOOL bSettingSame = FALSE;
+struct AAMSGSETTING
+{
+ short useCustom;
+ int status;
+ char* msg;
+};
+
+char *StatusModeToDbSetting(int status, const char *suffix);
+
+void DisableDialog(HWND hwndDlg)
+{
+ EnableWindow(GetDlgItem(hwndDlg, IDC_STATUS), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_STATUSMSG), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_VARIABLESHELP), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_RADUSECUSTOM), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_RADUSEMIRANDA), FALSE);
+}
+
+INT_PTR CALLBACK DlgProcAutoAwayMsgOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
+{
+ static AAMSGSETTING** settings;
+ static int last, count;
+
+ switch (msg) {
+ case WM_INITDIALOG:
+ TranslateDialogDefault(hwndDlg);
+ {
+ ShowWindow(GetDlgItem(hwndDlg, IDC_VARIABLESHELP), ServiceExists(MS_VARS_SHOWHELP) ? SW_SHOW : SW_HIDE);
+ count = 0;
+ last = -1;
+
+ PROTOACCOUNT** proto;
+ int protoCount = 0;
+ Proto_EnumAccounts(&protoCount, &proto);
+ if (protoCount <= 0) {
+ DisableDialog(hwndDlg);
+ break;
+ }
+
+ DWORD protoModeMsgFlags = 0;
+ for (int i = 0; i < protoCount; i++)
+ if (CallProtoService(proto[i]->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND & ~PF1_INDIVMODEMSG)
+ protoModeMsgFlags |= CallProtoService(proto[i]->szModuleName, PS_GETCAPS, PFLAGNUM_3, 0);
+
+ if (protoModeMsgFlags == 0) {
+ DisableDialog(hwndDlg);
+ break;
+ }
+
+ settings = (AAMSGSETTING**)mir_alloc(sizeof(AAMSGSETTING*));
+ count = 0;
+ for (auto &it : statusModes) {
+ if (!(protoModeMsgFlags & Proto_Status2Flag(it.iStatus)))
+ continue;
+
+ int j = SendDlgItemMessage(hwndDlg, IDC_STATUS, CB_ADDSTRING, 0, (LPARAM)Clist_GetStatusModeDescription(it.iStatus, 0));
+ SendDlgItemMessage(hwndDlg, IDC_STATUS, CB_SETITEMDATA, j, it.iStatus);
+ settings = (AAMSGSETTING**)mir_realloc(settings, (count + 1) * sizeof(AAMSGSETTING*));
+ settings[count] = (AAMSGSETTING*)mir_alloc(sizeof(AAMSGSETTING));
+ settings[count]->status = it.iStatus;
+
+ DBVARIANT dbv;
+ if (!db_get(0, AAAMODULENAME, StatusModeToDbSetting(it.iStatus, SETTING_STATUSMSG), &dbv)) {
+ settings[count]->msg = (char*)mir_alloc(mir_strlen(dbv.pszVal) + 1);
+ mir_strcpy(settings[count]->msg, dbv.pszVal);
+ db_free(&dbv);
+ }
+ else settings[count]->msg = nullptr;
+
+ settings[count]->useCustom = db_get_b(0, AAAMODULENAME, StatusModeToDbSetting(it.iStatus, SETTING_MSGCUSTOM), FALSE);
+ count += 1;
+ }
+ SendDlgItemMessage(hwndDlg, IDC_STATUS, CB_SETCURSEL, 0, 0);
+ SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_STATUS, CBN_SELCHANGE), 0);
+ }
+ break;
+
+ case WM_COMMAND:
+ if (((HIWORD(wParam) == EN_CHANGE) || (HIWORD(wParam) == BN_CLICKED)) && ((HWND)lParam == GetFocus()))
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+
+ switch (LOWORD(wParam)) {
+ case IDC_RADUSEMIRANDA:
+ CheckDlgButton(hwndDlg, IDC_RADUSECUSTOM, BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_RADUSEMIRANDA) ? BST_CHECKED : BST_UNCHECKED);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_STATUSMSG), IsDlgButtonChecked(hwndDlg, IDC_RADUSECUSTOM));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_VARIABLESHELP), IsDlgButtonChecked(hwndDlg, IDC_RADUSECUSTOM));
+ settings[SendDlgItemMessage(hwndDlg, IDC_STATUS, CB_GETCURSEL, 0, 0)]->useCustom = IsDlgButtonChecked(hwndDlg, IDC_RADUSECUSTOM);
+ break;
+
+ case IDC_RADUSECUSTOM:
+ CheckDlgButton(hwndDlg, IDC_RADUSEMIRANDA, BST_UNCHECKED == IsDlgButtonChecked(hwndDlg, IDC_RADUSECUSTOM) ? BST_CHECKED : BST_UNCHECKED);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_STATUSMSG), IsDlgButtonChecked(hwndDlg, IDC_RADUSECUSTOM));
+ EnableWindow(GetDlgItem(hwndDlg, IDC_VARIABLESHELP), IsDlgButtonChecked(hwndDlg, IDC_RADUSECUSTOM));
+ settings[SendDlgItemMessage(hwndDlg, IDC_STATUS, CB_GETCURSEL, 0, 0)]->useCustom = IsDlgButtonChecked(hwndDlg, IDC_RADUSECUSTOM);
+ break;
+
+ case IDC_STATUS:
+ if (HIWORD(wParam) == CBN_SELCHANGE) {
+ int i = SendDlgItemMessage(hwndDlg, IDC_STATUS, CB_GETCURSEL, 0, 0);
+ int len = SendDlgItemMessage(hwndDlg, IDC_STATUSMSG, WM_GETTEXTLENGTH, 0, 0);
+ if (last != -1) {
+ if (settings[last]->msg == nullptr)
+ settings[last]->msg = (char*)mir_alloc(len + 1);
+ else
+ settings[last]->msg = (char*)mir_realloc(settings[last]->msg, len + 1);
+ GetDlgItemTextA(hwndDlg, IDC_STATUSMSG, settings[last]->msg, (len + 1));
+ }
+
+ if (i != -1) {
+ if (settings[i]->msg != nullptr)
+ SetDlgItemTextA(hwndDlg, IDC_STATUSMSG, settings[i]->msg);
+ else {
+ ptrW msgw((wchar_t*)CallService(MS_AWAYMSG_GETSTATUSMSGW, settings[i]->status, 0));
+ SetDlgItemText(hwndDlg, IDC_STATUSMSG, (msgw != nullptr) ? msgw : L"");
+ }
+
+ if (settings[i]->useCustom) {
+ EnableWindow(GetDlgItem(hwndDlg, IDC_STATUSMSG), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_VARIABLESHELP), TRUE);
+ CheckDlgButton(hwndDlg, IDC_RADUSECUSTOM, BST_CHECKED);
+ CheckDlgButton(hwndDlg, IDC_RADUSEMIRANDA, BST_UNCHECKED);
+ }
+ else {
+ EnableWindow(GetDlgItem(hwndDlg, IDC_STATUSMSG), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_VARIABLESHELP), FALSE);
+ CheckDlgButton(hwndDlg, IDC_RADUSEMIRANDA, BST_CHECKED);
+ CheckDlgButton(hwndDlg, IDC_RADUSECUSTOM, BST_UNCHECKED);
+ }
+ }
+ last = i;
+ }
+ break;
+
+ case IDC_VARIABLESHELP:
+ CallService(MS_VARS_SHOWHELP, (WPARAM)GetDlgItem(hwndDlg, IDC_STATUSMSG), 0);
+ break;
+ }
+ break;
+
+ case WM_NOTIFY:
+ switch (((LPNMHDR)lParam)->code) {
+ case PSN_WIZFINISH:
+ AAALoadOptions();
+ break;
+
+ case PSN_APPLY:
+ SendMessage(hwndDlg, WM_COMMAND, MAKEWPARAM(IDC_STATUS, CBN_SELCHANGE), 0);
+ for (int i = 0; i < count; i++) {
+ db_set_b(0, AAAMODULENAME, StatusModeToDbSetting(settings[i]->status, SETTING_MSGCUSTOM), (BYTE)settings[i]->useCustom);
+ if ((settings[i]->useCustom) && (settings[i]->msg != nullptr) && (settings[i]->msg[0] != '\0'))
+ db_set_s(0, AAAMODULENAME, StatusModeToDbSetting(settings[i]->status, SETTING_STATUSMSG), settings[i]->msg);
+ }
+ break;
+ }
+ break;
+
+ case WM_DESTROY:
+ for (int i = 0; i < count; i++) {
+ mir_free(settings[i]->msg);
+ mir_free(settings[i]);
+ }
+ mir_free(settings);
+ break;
+ }
+
+ return FALSE;
+}
/////////////////////////////////////////////////////////////////////////////////////////
// Dialog service functions
@@ -89,12 +255,12 @@ static void SetDialogItems(HWND hwndDlg, SMProto *setting)
EnableWindow(GetDlgItem(hwndDlg, IDC_SETNASTR), bSetNA && bIsTimed);
EnableWindow(GetDlgItem(hwndDlg, IDC_LV2STATUS), bSetNA && bIsTimed);
- EnableWindow(GetDlgItem(hwndDlg, IDC_PROTOCOL), !bSettingSame);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_PROTOCOL), !g_bAAASettingSame);
}
static SMProto* GetSetting(HWND hwndDlg, SMProto *sameSetting)
{
- if (bSettingSame)
+ if (g_bAAASettingSame)
return sameSetting;
int iItem = SendDlgItemMessage(hwndDlg, IDC_PROTOCOL, CB_GETCURSEL, 0, 0);
@@ -181,19 +347,19 @@ static INT_PTR CALLBACK DlgProcAutoAwayRulesOpts(HWND hwndDlg, UINT msg, WPARAM
ListView_DeleteAllItems(hList);
int flags = 0;
- if (!bSettingSame)
+ if (!g_bAAASettingSame)
flags = CallProtoService(setting->m_szName, PS_GETCAPS, PFLAGNUM_2, 0)&~CallProtoService(setting->m_szName, PS_GETCAPS, (WPARAM)PFLAGNUM_5, 0);
LVITEM lvItem = { 0 };
lvItem.mask = LVIF_TEXT | LVIF_PARAM;
lvItem.iItem = 0;
lvItem.iSubItem = 0;
- for (int i = 0; i < _countof(statusModeList); i++) {
- if ((flags & statusModePf2List[i]) || (statusModePf2List[i] == PF2_OFFLINE) || (bSettingSame)) {
- lvItem.pszText = Clist_GetStatusModeDescription(statusModeList[i], 0);
- lvItem.lParam = (LPARAM)statusModePf2List[i];
+ for (auto &it : statusModes) {
+ if ((flags & it.iFlag) || (it.iFlag == PF2_OFFLINE) || (g_bAAASettingSame)) {
+ lvItem.pszText = Clist_GetStatusModeDescription(it.iStatus, 0);
+ lvItem.lParam = (LPARAM)it.iFlag;
ListView_InsertItem(hList, &lvItem);
- ListView_SetCheckState(hList, lvItem.iItem, setting->statusFlags & statusModePf2List[i] ? TRUE : FALSE);
+ ListView_SetCheckState(hList, lvItem.iItem, setting->statusFlags & it.iFlag ? TRUE : FALSE);
lvItem.iItem++;
}
}
@@ -202,24 +368,24 @@ static INT_PTR CALLBACK DlgProcAutoAwayRulesOpts(HWND hwndDlg, UINT msg, WPARAM
// status dropdown boxes
{
int flags = 0;
- if (!bSettingSame)
+ if (!g_bAAASettingSame)
flags = CallProtoService(setting->m_szName, PS_GETCAPS, PFLAGNUM_2, 0)&~CallProtoService(setting->m_szName, PS_GETCAPS, (WPARAM)PFLAGNUM_5, 0);
// clear box and add new status, loop status and check if compatible with proto
SendDlgItemMessage(hwndDlg, IDC_LV1STATUS, CB_RESETCONTENT, 0, 0);
SendDlgItemMessage(hwndDlg, IDC_LV2STATUS, CB_RESETCONTENT, 0, 0);
- for (int i = 0; i < _countof(statusModeList); i++) {
- if ((flags & statusModePf2List[i]) || statusModePf2List[i] == PF2_OFFLINE || bSettingSame) {
- wchar_t *statusMode = Clist_GetStatusModeDescription(statusModeList[i], 0);
+ for (auto &it : statusModes) {
+ if ((flags & it.iFlag) || it.iFlag == PF2_OFFLINE || g_bAAASettingSame) {
+ wchar_t *statusMode = Clist_GetStatusModeDescription(it.iStatus, 0);
int item = SendDlgItemMessage(hwndDlg, IDC_LV1STATUS, CB_ADDSTRING, 0, (LPARAM)statusMode);
- SendDlgItemMessage(hwndDlg, IDC_LV1STATUS, CB_SETITEMDATA, item, (LPARAM)statusModeList[i]);
+ SendDlgItemMessage(hwndDlg, IDC_LV1STATUS, CB_SETITEMDATA, item, it.iStatus);
item = SendDlgItemMessage(hwndDlg, IDC_LV2STATUS, CB_ADDSTRING, 0, (LPARAM)statusMode);
- SendDlgItemMessage(hwndDlg, IDC_LV2STATUS, CB_SETITEMDATA, item, (LPARAM)statusModeList[i]);
- if (statusModeList[i] == setting->lv1Status) {
+ SendDlgItemMessage(hwndDlg, IDC_LV2STATUS, CB_SETITEMDATA, item, it.iStatus);
+ if (it.iStatus == setting->lv1Status) {
SendDlgItemMessage(hwndDlg, IDC_LV1STATUS, CB_SETCURSEL, (WPARAM)item, 0);
SetDlgItemText(hwndDlg, IDC_SETNASTR, CMStringW(FORMAT, TranslateT("minutes of %s mode"), statusMode));
}
- if (statusModeList[i] == setting->lv2Status)
+ if (it.iStatus == setting->lv2Status)
SendDlgItemMessage(hwndDlg, IDC_LV2STATUS, CB_SETCURSEL, (WPARAM)item, 0);
}
}
@@ -353,7 +519,7 @@ static INT_PTR CALLBACK DlgProcAutoAwayRulesOpts(HWND hwndDlg, UINT msg, WPARAM
break;
case PSN_APPLY:
- if (bSettingSame)
+ if (g_bAAASettingSame)
WriteAutoAwaySetting(*sameSetting, SETTING_ALL);
else {
for (auto &it : optionSettings)
@@ -385,7 +551,7 @@ static INT_PTR CALLBACK DlgProcAutoAwayGeneralOpts(HWND hwndDlg, UINT msg, WPARA
CheckDlgButton(hwndDlg, IDC_MONITORKEYBOARD, db_get_b(0, AAAMODULENAME, SETTING_MONITORKEYBOARD, BST_CHECKED) != 0 ? BST_CHECKED : BST_UNCHECKED);
SetDlgItemInt(hwndDlg, IDC_AWAYCHECKTIMEINSECS, db_get_w(0, AAAMODULENAME, SETTING_AWAYCHECKTIMEINSECS, 5), FALSE);
SetDlgItemInt(hwndDlg, IDC_CONFIRMDELAY, db_get_w(0, AAAMODULENAME, SETTING_CONFIRMDELAY, 5), FALSE);
- CheckDlgButton(hwndDlg, bSettingSame ? IDC_SAMESETTINGS : IDC_PERPROTOCOLSETTINGS, BST_CHECKED);
+ CheckDlgButton(hwndDlg, g_bAAASettingSame ? IDC_SAMESETTINGS : IDC_PERPROTOCOLSETTINGS, BST_CHECKED);
break;
case WM_COMMAND:
@@ -403,7 +569,7 @@ static INT_PTR CALLBACK DlgProcAutoAwayGeneralOpts(HWND hwndDlg, UINT msg, WPARA
case IDC_SAMESETTINGS:
case IDC_PERPROTOCOLSETTINGS:
- bSettingSame = IsDlgButtonChecked(hwndDlg, IDC_SAMESETTINGS);
+ g_bAAASettingSame = IsDlgButtonChecked(hwndDlg, IDC_SAMESETTINGS);
break;
}
break;
@@ -419,7 +585,7 @@ static INT_PTR CALLBACK DlgProcAutoAwayGeneralOpts(HWND hwndDlg, UINT msg, WPARA
db_set_b(0, AAAMODULENAME, SETTING_IGNLOCK, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_IGNLOCK));
db_set_b(0, AAAMODULENAME, SETTING_IGNSYSKEYS, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_IGNSYSKEYS));
db_set_b(0, AAAMODULENAME, SETTING_IGNALTCOMBO, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_IGNALTCOMBO));
- db_set_b(0, AAAMODULENAME, SETTING_SAMESETTINGS, (BYTE)bSettingSame);
+ db_set_b(0, AAAMODULENAME, SETTING_SAMESETTINGS, (BYTE)g_bAAASettingSame);
db_set_w(0, AAAMODULENAME, SETTING_AWAYCHECKTIMEINSECS, (WORD)GetDlgItemInt(hwndDlg, IDC_AWAYCHECKTIMEINSECS, nullptr, FALSE));
db_set_w(0, AAAMODULENAME, SETTING_CONFIRMDELAY, (WORD)GetDlgItemInt(hwndDlg, IDC_CONFIRMDELAY, nullptr, FALSE));
db_set_b(0, AAAMODULENAME, SETTING_MONITORMOUSE, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_MONITORMOUSE));
diff --git a/plugins/StatusManager/src/AdvancedAutoAway/advancedautoaway.cpp b/plugins/StatusManager/src/advancedautoaway.cpp
index 7981175e5f..649f61353f 100644
--- a/plugins/StatusManager/src/AdvancedAutoAway/advancedautoaway.cpp
+++ b/plugins/StatusManager/src/advancedautoaway.cpp
@@ -20,7 +20,7 @@
Some code is copied from Miranda's AutoAway module
*/
-#include "..\stdafx.h"
+#include "stdafx.h"
#ifdef _DEBUG
#define SECS_PER_MINUTE 20 /* speedup */
@@ -93,7 +93,7 @@ void AAALoadOptions()
for (auto &it : protoList) {
char* protoName;
- if ((db_get_b(0, AAAMODULENAME, SETTING_SAMESETTINGS, 0)))
+ if (g_bAAASettingSame)
protoName = SETTING_ALL;
else
protoName = it->m_szName;
@@ -122,7 +122,7 @@ int LoadAutoAwaySetting(SMProto &autoAwaySetting, char* protoName)
autoAwaySetting.statusFlags = db_get_w(0, AAAMODULENAME, setting, StatusModeToProtoFlag(ID_STATUS_ONLINE) | StatusModeToProtoFlag(ID_STATUS_FREECHAT));
int flags;
- if (db_get_b(0, AAAMODULENAME, SETTING_SAMESETTINGS, 0))
+ if (g_bAAASettingSame)
flags = 0xFFFFFF;
else
flags = CallProtoService(protoName, PS_GETCAPS, PFLAGNUM_2, 0)&~CallProtoService(protoName, PS_GETCAPS, (WPARAM)PFLAGNUM_5, 0);
@@ -531,6 +531,8 @@ void AdvancedAutoAwayLoad()
{
AAALangPack = GetPluginLangId(MIID_LAST, 0);
+ g_bAAASettingSame = db_get_b(0, AAAMODULENAME, SETTING_SAMESETTINGS, 0);
+
if (g_bMirandaLoaded)
AAAModuleLoaded(0, 0);
else
diff --git a/plugins/StatusManager/src/AdvancedAutoAway/advancedautoaway.h b/plugins/StatusManager/src/advancedautoaway.h
index e2d6b4ec61..53c8502be0 100644
--- a/plugins/StatusManager/src/AdvancedAutoAway/advancedautoaway.h
+++ b/plugins/StatusManager/src/advancedautoaway.h
@@ -43,4 +43,6 @@ void AdvancedAutoAwayUnload();
int LoadAutoAwaySetting(SMProto&, char *protoName);
void AAALoadOptions();
+extern bool g_bAAASettingSame;
+
#endif
diff --git a/plugins/StatusManager/src/commonstatus.cpp b/plugins/StatusManager/src/commonstatus.cpp
index 371dfeae1a..f95ec3f89c 100644
--- a/plugins/StatusManager/src/commonstatus.cpp
+++ b/plugins/StatusManager/src/commonstatus.cpp
@@ -21,6 +21,20 @@
#include "stdafx.h"
+StatusModeMap statusModes[MAX_STATUS_COUNT] =
+{
+ { ID_STATUS_OFFLINE, PF2_OFFLINE },
+ { ID_STATUS_ONLINE, PF2_ONLINE },
+ { ID_STATUS_AWAY, PF2_SHORTAWAY },
+ { ID_STATUS_NA, PF2_LONGAWAY },
+ { ID_STATUS_OCCUPIED, PF2_LIGHTDND },
+ { ID_STATUS_DND, PF2_HEAVYDND },
+ { ID_STATUS_FREECHAT, PF2_FREECHAT },
+ { ID_STATUS_INVISIBLE, PF2_INVISIBLE },
+ { ID_STATUS_ONTHEPHONE, PF2_ONTHEPHONE },
+ { ID_STATUS_OUTTOLUNCH, PF2_OUTTOLUNCH }
+};
+
// handles for hooks and other Miranda thingies
static HANDLE hCSStatusChangedExEvent;
diff --git a/plugins/StatusManager/src/commonstatus.h b/plugins/StatusManager/src/commonstatus.h
index 217903ff79..2408323478 100644
--- a/plugins/StatusManager/src/commonstatus.h
+++ b/plugins/StatusManager/src/commonstatus.h
@@ -63,9 +63,6 @@
#define MAX_STATUS ID_STATUS_CURRENT
#define MIN_STATUS ID_STATUS_OFFLINE
#define DEF_CLOSE_TIME 5 //secs
-#define PF2_OFFLINE 0x00000200
-static int statusModeList[] = { ID_STATUS_OFFLINE, ID_STATUS_ONLINE, ID_STATUS_AWAY, ID_STATUS_NA, ID_STATUS_OCCUPIED, ID_STATUS_DND, ID_STATUS_FREECHAT, ID_STATUS_INVISIBLE, ID_STATUS_ONTHEPHONE, ID_STATUS_OUTTOLUNCH };
-static int statusModePf2List[] = { PF2_OFFLINE, PF2_ONLINE, PF2_SHORTAWAY, PF2_LONGAWAY, PF2_LIGHTDND, PF2_HEAVYDND, PF2_FREECHAT, PF2_INVISIBLE, PF2_ONTHEPHONE, PF2_OUTTOLUNCH };
wchar_t *GetDefaultStatusMessage(PROTOCOLSETTINGEX *ps, int status);
int GetActualStatus(PROTOCOLSETTINGEX *protoSetting);
@@ -91,14 +88,23 @@ bool IsSuitableProto(PROTOACCOUNT *pa);
#define FLAG_ONTS 0x0200 // db: on terminal session disconnect
#define FLAG_ENTERIDLE 0x0400 // db: enter idle with AA mode
-typedef enum
+#define PF2_OFFLINE 0x0200
+
+struct StatusModeMap
+{
+ int iStatus, iFlag;
+};
+
+extern StatusModeMap statusModes[MAX_STATUS_COUNT];
+
+enum STATES
{
ACTIVE, // user is active
STATUS1_SET, // first status change happened
STATUS2_SET, // second status change happened
SET_ORGSTATUS, // user was active again, original status will be restored
HIDDEN_ACTIVE // user is active, but this is not shown to the outside world
-} STATES;
+};
struct SMProto : public PROTOCOLSETTINGEX, public MZeroedObject
{
diff --git a/plugins/StatusManager/src/confirmdialog.cpp b/plugins/StatusManager/src/confirmdialog.cpp
index 0491a77c94..c784102d9e 100644
--- a/plugins/StatusManager/src/confirmdialog.cpp
+++ b/plugins/StatusManager/src/confirmdialog.cpp
@@ -338,19 +338,20 @@ static INT_PTR CALLBACK ConfirmDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, LP
actualStatus = currentStatus;
}
- for (int i = 0; i < _countof(statusModeList); i++) {
- if (((flags & statusModePf2List[i]) || (statusModePf2List[i] == PF2_OFFLINE)) && (!((!(flags)& Proto_Status2Flag(statusModePf2List[i]))) || ((CallProtoService(proto->m_szName, PS_GETCAPS, (WPARAM)PFLAGNUM_5, 0)&Proto_Status2Flag(statusModePf2List[i]))))) {
- wchar_t *statusMode = Clist_GetStatusModeDescription(statusModeList[i], 0);
+ for (auto &it : statusModes) {
+ int pf5 = CallProtoService(proto->m_szName, PS_GETCAPS, PFLAGNUM_5, 0);
+ if (((flags & it.iFlag) || it.iFlag == PF2_OFFLINE) && (!((!(flags) & Proto_Status2Flag(it.iFlag))) || (pf5 & Proto_Status2Flag(it.iFlag)))) {
+ wchar_t *statusMode = Clist_GetStatusModeDescription(it.iStatus, 0);
item = SendDlgItemMessage(hwndDlg, IDC_STATUS, CB_ADDSTRING, 0, (LPARAM)statusMode);
- SendDlgItemMessage(hwndDlg, IDC_STATUS, CB_SETITEMDATA, item, statusModeList[i]);
- if (statusModeList[i] == proto->m_status)
+ SendDlgItemMessage(hwndDlg, IDC_STATUS, CB_SETITEMDATA, item, it.iStatus);
+ if (it.iStatus == proto->m_status)
SendDlgItemMessage(hwndDlg, IDC_STATUS, CB_SETCURSEL, item, 0);
}
}
// enable status box
EnableWindow(GetDlgItem(hwndDlg, IDC_STATUS), (ListView_GetNextItem(GetDlgItem(hwndDlg, IDC_STARTUPLIST), -1, LVNI_SELECTED) >= 0));
- if ((!((CallProtoService(proto->m_szName, PS_GETCAPS, PFLAGNUM_1, 0)&PF1_MODEMSGSEND)&~PF1_INDIVMODEMSG)) || (!(CallProtoService(proto->m_szName, PS_GETCAPS, PFLAGNUM_3, 0)&Proto_Status2Flag(actualStatus))))
+ if ((!((CallProtoService(proto->m_szName, PS_GETCAPS, PFLAGNUM_1, 0) & PF1_MODEMSGSEND) & ~PF1_INDIVMODEMSG)) || (!(CallProtoService(proto->m_szName, PS_GETCAPS, PFLAGNUM_3, 0) & Proto_Status2Flag(actualStatus))))
EnableWindow(GetDlgItem(hwndDlg, IDC_SETSTSMSG), FALSE);
else if (proto->m_status == ID_STATUS_LAST || proto->m_status == ID_STATUS_CURRENT)
EnableWindow(GetDlgItem(hwndDlg, IDC_SETSTSMSG), TRUE);
diff --git a/plugins/StatusManager/src/KeepStatus/keepstatus.cpp b/plugins/StatusManager/src/keepstatus.cpp
index 5b130f024a..cbb52e8777 100644
--- a/plugins/StatusManager/src/KeepStatus/keepstatus.cpp
+++ b/plugins/StatusManager/src/keepstatus.cpp
@@ -17,7 +17,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "..\stdafx.h"
+#include "stdafx.h"
int KSLangPack;
diff --git a/plugins/StatusManager/src/KeepStatus/keepstatus.h b/plugins/StatusManager/src/keepstatus.h
index e4b1f5a7a4..e4b1f5a7a4 100644
--- a/plugins/StatusManager/src/KeepStatus/keepstatus.h
+++ b/plugins/StatusManager/src/keepstatus.h
diff --git a/plugins/StatusManager/src/KeepStatus/ks_options.cpp b/plugins/StatusManager/src/ks_options.cpp
index fe96ea81b2..11428347db 100644
--- a/plugins/StatusManager/src/KeepStatus/ks_options.cpp
+++ b/plugins/StatusManager/src/ks_options.cpp
@@ -17,7 +17,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "..\stdafx.h"
+#include "stdafx.h"
/////////////////////////////////////////////////////////////////////////////////////////
// Basic options
diff --git a/plugins/StatusManager/src/StartupStatus/ss_options.cpp b/plugins/StatusManager/src/ss_options.cpp
index dd6e877083..2ef03d852a 100644
--- a/plugins/StatusManager/src/StartupStatus/ss_options.cpp
+++ b/plugins/StatusManager/src/ss_options.cpp
@@ -17,7 +17,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "..\stdafx.h"
+#include "stdafx.h"
char* OptName(int i, const char* setting)
{
@@ -539,10 +539,10 @@ class CSSAdvancedOptDlg : public CDlgBase
int flags = (CallProtoService(ps->m_szName, PS_GETCAPS, PFLAGNUM_2, 0))&~(CallProtoService(ps->m_szName, PS_GETCAPS, PFLAGNUM_5, 0));
lstStatus.ResetContent();
- for (int i = 0; i < _countof(statusModeList); i++) {
- if ((flags & statusModePf2List[i]) || (statusModeList[i] == ID_STATUS_OFFLINE)) {
- int item = lstStatus.AddString(Clist_GetStatusModeDescription(statusModeList[i], 0), statusModeList[i]);
- if (ps->m_status == statusModeList[i])
+ for (auto &it : statusModes) {
+ if ((flags & it.iFlag) || (it.iStatus == ID_STATUS_OFFLINE)) {
+ int item = lstStatus.AddString(Clist_GetStatusModeDescription(it.iStatus, 0), it.iStatus);
+ if (ps->m_status == it.iStatus)
lstStatus.SetCurSel(item);
}
}
diff --git a/plugins/StatusManager/src/StartupStatus/ss_profiles.cpp b/plugins/StatusManager/src/ss_profiles.cpp
index c0345e7441..f678db190d 100644
--- a/plugins/StatusManager/src/StartupStatus/ss_profiles.cpp
+++ b/plugins/StatusManager/src/ss_profiles.cpp
@@ -17,7 +17,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "..\stdafx.h"
+#include "stdafx.h"
#define MAX_MMITEMS 6
diff --git a/plugins/StatusManager/src/StartupStatus/ss_toolbars.cpp b/plugins/StatusManager/src/ss_toolbars.cpp
index af1091a023..e264d0126c 100644
--- a/plugins/StatusManager/src/StartupStatus/ss_toolbars.cpp
+++ b/plugins/StatusManager/src/ss_toolbars.cpp
@@ -17,7 +17,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "..\stdafx.h"
+#include "stdafx.h"
#define MAX_MMITEMS 6
diff --git a/plugins/StatusManager/src/StartupStatus/startupstatus.cpp b/plugins/StatusManager/src/startupstatus.cpp
index 4f3a487bb2..f315ddfc97 100644
--- a/plugins/StatusManager/src/StartupStatus/startupstatus.cpp
+++ b/plugins/StatusManager/src/startupstatus.cpp
@@ -17,7 +17,7 @@
Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
-#include "..\stdafx.h"
+#include "stdafx.h"
int SSLangPack;
diff --git a/plugins/StatusManager/src/StartupStatus/startupstatus.h b/plugins/StatusManager/src/startupstatus.h
index 5d16d50843..5d16d50843 100644
--- a/plugins/StatusManager/src/StartupStatus/startupstatus.h
+++ b/plugins/StatusManager/src/startupstatus.h
diff --git a/plugins/StatusManager/src/stdafx.h b/plugins/StatusManager/src/stdafx.h
index 6767d08ef4..e9343eab16 100644
--- a/plugins/StatusManager/src/stdafx.h
+++ b/plugins/StatusManager/src/stdafx.h
@@ -38,9 +38,9 @@ struct CMPlugin : public PLUGIN<CMPlugin>
};
#include "commonstatus.h"
-#include "KeepStatus\keepstatus.h"
-#include "StartupStatus\startupstatus.h"
-#include "AdvancedAutoAway\advancedautoaway.h"
+#include "keepstatus.h"
+#include "startupstatus.h"
+#include "advancedautoaway.h"
extern bool g_bMirandaLoaded;
extern int AAALangPack, KSLangPack, SSLangPack;