summaryrefslogtreecommitdiff
path: root/plugins/NewXstatusNotify/src
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/NewXstatusNotify/src')
-rw-r--r--plugins/NewXstatusNotify/src/main.cpp16
-rw-r--r--plugins/NewXstatusNotify/src/options.cpp119
-rw-r--r--plugins/NewXstatusNotify/src/options.h2
-rw-r--r--plugins/NewXstatusNotify/src/resource.h6
-rw-r--r--plugins/NewXstatusNotify/src/xstatus.h2
5 files changed, 74 insertions, 71 deletions
diff --git a/plugins/NewXstatusNotify/src/main.cpp b/plugins/NewXstatusNotify/src/main.cpp
index 7a7f9970ce..63ebeb45b2 100644
--- a/plugins/NewXstatusNotify/src/main.cpp
+++ b/plugins/NewXstatusNotify/src/main.cpp
@@ -306,13 +306,13 @@ void GetStatusText(MCONTACT hContact, WORD newStatus, WORD oldStatus, TCHAR *stz
if (opt.UseAlternativeText) {
switch (GetGender(hContact)) {
case GENDER_MALE:
- _tcsncpy(stzStatusText, _tcsninc(StatusList[Index(newStatus)].lpzMStatusText, 4), MAX_STATUSTEXT);
+ _tcsncpy(stzStatusText, StatusList[Index(newStatus)].lpzMStatusText, MAX_STATUSTEXT);
break;
case GENDER_FEMALE:
- _tcsncpy(stzStatusText, _tcsninc(StatusList[Index(newStatus)].lpzFStatusText, 4), MAX_STATUSTEXT);
+ _tcsncpy(stzStatusText, StatusList[Index(newStatus)].lpzFStatusText, MAX_STATUSTEXT);
break;
case GENDER_UNSPECIFIED:
- _tcsncpy(stzStatusText, _tcsninc(StatusList[Index(newStatus)].lpzUStatusText, 4), MAX_STATUSTEXT);
+ _tcsncpy(stzStatusText, StatusList[Index(newStatus)].lpzUStatusText, MAX_STATUSTEXT);
break;
}
}
@@ -858,10 +858,8 @@ int StatusModeChanged(WPARAM wParam, LPARAM lParam)
db_set_b(0, MODULE, "OldUseSound", hlpUseSound);
db_set_b(0, "Skin", "UseSound", FALSE);
}
- else {
- if (hlpUseSound == FALSE)
- db_set_b(0, "Skin", "UseSound", db_get_b(0, MODULE, "OldUseSound", 1));
- }
+ else if (hlpUseSound == FALSE)
+ db_set_b(0, "Skin", "UseSound", db_get_b(0, MODULE, "OldUseSound", 1));
}
}
}
@@ -1080,7 +1078,7 @@ int ProtoAck(WPARAM wParam, LPARAM lParam)
return 0;
}
-INT_PTR EnableDisableMenuCommand(WPARAM wParam, LPARAM lParam)
+INT_PTR EnableDisableMenuCommand(WPARAM, LPARAM)
{
opt.TempDisabled = !opt.TempDisabled;
db_set_b(0, MODULE, "TempDisable", opt.TempDisabled);
@@ -1148,7 +1146,7 @@ int InitTopToolbar(WPARAM, LPARAM)
return 0;
}
-int ModulesLoaded(WPARAM wParam, LPARAM lParam)
+int ModulesLoaded(WPARAM, LPARAM)
{
InitMainMenuItem();
diff --git a/plugins/NewXstatusNotify/src/options.cpp b/plugins/NewXstatusNotify/src/options.cpp
index d63f90feec..dc1b9be4cd 100644
--- a/plugins/NewXstatusNotify/src/options.cpp
+++ b/plugins/NewXstatusNotify/src/options.cpp
@@ -134,14 +134,11 @@ void SaveTemplates()
for (int i = 0; i < ProtoTemplates.getCount(); i++) {
PROTOTEMPLATE *prototemplate = ProtoTemplates[i];
- TCHAR str[MAX_PATH];
- mir_sntprintf(str, SIZEOF(str), _T("%s_TPopupSMsgChanged"), prototemplate->ProtoName);
- char *szstr = mir_t2a(str);
- db_set_ts(0, MODULE, szstr, prototemplate->ProtoTemplateMsg);
- mir_sntprintf(str, SIZEOF(str), _T("%s_TPopupSMsgRemoved"), prototemplate->ProtoName);
- szstr = mir_t2a(str);
- db_set_ts(0, MODULE, szstr, prototemplate->ProtoTemplateRemoved);
- mir_free(szstr);
+ char str[MAX_PATH];
+ mir_snprintf(str, SIZEOF(str), "%s_TPopupSMsgChanged", prototemplate->ProtoName);
+ db_set_ts(0, MODULE, str, prototemplate->ProtoTemplateMsg);
+ mir_snprintf(str, SIZEOF(str), "%s_TPopupSMsgRemoved", prototemplate->ProtoName);
+ db_set_ts(0, MODULE, str, prototemplate->ProtoTemplateRemoved);
}
}
@@ -233,17 +230,20 @@ INT_PTR CALLBACK DlgProcGeneralOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
{
case IDC_CONFIGUREAUTODISABLE:
CreateDialog(hInst, MAKEINTRESOURCE(IDD_AUTODISABLE), hwndDlg, DlgProcAutoDisableOpts);
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
return FALSE;
case IDC_AUTODISABLE:
EnableWindow(GetDlgItem(hwndDlg, IDC_CONFIGUREAUTODISABLE), IsDlgButtonChecked(hwndDlg, IDC_AUTODISABLE));
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
case IDC_BLINKICON:
EnableWindow(GetDlgItem(hwndDlg, IDC_BLINKICON_STATUS), IsDlgButtonChecked(hwndDlg, IDC_BLINKICON));
EnableWindow(GetDlgItem(hwndDlg, IDC_BLINKICON_FORMSGS), IsDlgButtonChecked(hwndDlg, IDC_BLINKICON));
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
break;
case IDC_BT_VIEWLOG:
ShowLog(opt.LogFilePath);
- return FALSE;
+ break;
case IDC_BT_CHOOSELOGFILE:
{
TCHAR buff[MAX_PATH];
@@ -262,15 +262,17 @@ INT_PTR CALLBACK DlgProcGeneralOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
ofn.lpstrInitialDir = buff;
ofn.Flags = OFN_PATHMUSTEXIST | OFN_HIDEREADONLY;
ofn.lpstrDefExt = _T("log");
- if (GetSaveFileName(&ofn))
+ if (GetSaveFileName(&ofn)) {
SetDlgItemText(hwndDlg, IDC_LOGFILE, buff);
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ }
break;
}
+ default:
+ if (HIWORD(wParam) == BN_CLICKED || (HIWORD(wParam) == EN_CHANGE && (HWND)lParam == GetFocus()))
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
- if (HIWORD(wParam) == BN_CLICKED || (HIWORD(wParam) == EN_CHANGE && (HWND)lParam == GetFocus()))
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
-
break;
}
case WM_NOTIFY:
@@ -379,13 +381,13 @@ INT_PTR CALLBACK DlgProcPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
{
TCHAR str[MAX_SECONDLINE] = {0};
for (int i = ID_STATUS_MIN; i <= ID_STATUS_MAX; i++) {
- _tcscpy(str, _T(""));
+ _tcsncpy(str, _T(""), MAX_SECONDLINE);
if (opt.ShowStatus) {
if (opt.UseAlternativeText == 1)
- _tcscpy(str, _tcsninc(StatusList[Index(i)].lpzUStatusText, 4));
+ _tcsncpy(str, StatusList[Index(i)].lpzUStatusText, MAX_SECONDLINE);
else
- _tcscpy(str, StatusList[Index(i)].lpzStandardText);
+ _tcsncpy(str, StatusList[Index(i)].lpzStandardText, MAX_SECONDLINE);
if (opt.ShowPreviousStatus) {
TCHAR buff[MAX_STATUSTEXT];
@@ -397,14 +399,14 @@ INT_PTR CALLBACK DlgProcPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM
if (opt.ReadAwayMsg) {
if (str[0])
_tcscat(str, _T("\n"));
- _tcscat(str, TranslateT("This is status message"));
+ _tcsncat(str, TranslateT("This is status message"), MAX_SECONDLINE);
}
ShowChangePopup(NULL, NULL, LoadSkinnedProtoIcon(NULL, i), i, str);
}
- _tcscpy(str, TranslateT("This is extra status"));
+ _tcsncpy(str, TranslateT("This is extra status"), MAX_SECONDLINE);
ShowChangePopup(NULL, NULL, LoadSkinnedProtoIcon(NULL, ID_STATUS_ONLINE), ID_STATUS_EXTRASTATUS, str);
- _tcscpy(str, TranslateT("This is status message"));
+ _tcsncpy(str, TranslateT("This is status message"), MAX_SECONDLINE);
ShowChangePopup(NULL, NULL, LoadSkinnedProtoIcon(NULL, ID_STATUS_ONLINE), ID_STATUS_STATUSMSG, str);
return FALSE;
@@ -475,13 +477,14 @@ INT_PTR CALLBACK DlgProcAutoDisableOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L
CheckDlgButton(hwndDlg, IDC_CHK_SGLOBAL, opt.DisableSoundGlobally);
CheckDlgButton(hwndDlg, IDC_CHK_ONLYGLOBAL, opt.OnlyGlobalChanges);
- char str[8];
for (int i = ID_STATUS_MIN; i <= ID_STATUS_MAX; i++) {
+ char str[8];
mir_snprintf(str, SIZEOF(str), "p%d", i);
CheckDlgButton(hwndDlg, i, db_get_b(0, MODULE, str, 0));
}
for (int i = ID_STATUS_MIN; i <= ID_STATUS_MAX; i++) {
+ char str[8];
mir_snprintf(str, SIZEOF(str), "s%d", i);
CheckDlgButton(hwndDlg, (i + 2000), db_get_b(NULL, MODULE, str, 0));
}
@@ -490,17 +493,18 @@ INT_PTR CALLBACK DlgProcAutoDisableOpts(HWND hwndDlg, UINT msg, WPARAM wParam, L
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDC_OK:
- char str[8];
opt.DisablePopupGlobally = IsDlgButtonChecked(hwndDlg, IDC_CHK_PGLOBAL);
opt.DisableSoundGlobally = IsDlgButtonChecked(hwndDlg, IDC_CHK_SGLOBAL);
opt.OnlyGlobalChanges = IsDlgButtonChecked(hwndDlg, IDC_CHK_ONLYGLOBAL);
for (int i = ID_STATUS_MIN; i <= ID_STATUS_MAX; i++) {
+ char str[8];
mir_snprintf(str, SIZEOF(str), "p%d", i);
db_set_b(NULL, MODULE, str, IsDlgButtonChecked(hwndDlg, i));
}
for (int i = ID_STATUS_MIN; i <= ID_STATUS_MAX; i++) {
+ char str[8];
mir_snprintf(str, SIZEOF(str), "s%d", i);
db_set_b(NULL, MODULE, str, IsDlgButtonChecked(hwndDlg, i + 2000));
}
@@ -686,12 +690,12 @@ INT_PTR CALLBACK DlgProcSMPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
EnableWindow(GetDlgItem(hwndDlg, IDC_ED_TSMSGREMOVE), templates.PopupSMsgFlags & NOTIFY_REMOVE_MESSAGE);
// Buttons
- SendDlgItemMessage(hwndDlg, IDC_BT_VARIABLES, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Show available variables"), BATF_TCHAR);
+ SendDlgItemMessage(hwndDlg, IDC_BT_VARIABLES, BUTTONADDTOOLTIP, (WPARAM)LPGENT("Show available variables"), BATF_TCHAR);
HICON hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_VARIABLES));
SendDlgItemMessage(hwndDlg, IDC_BT_VARIABLES, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon);
DestroyIcon(hIcon);
- SendDlgItemMessage(hwndDlg, IDC_BT_RESET, BUTTONADDTOOLTIP, (WPARAM)TranslateT("Reset all templates to default"), BATF_TCHAR);
+ SendDlgItemMessage(hwndDlg, IDC_BT_RESET, BUTTONADDTOOLTIP, (WPARAM)LPGENT("Reset all templates to default"), BATF_TCHAR);
hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_RESET));
SendDlgItemMessage(hwndDlg, IDC_BT_RESET, BM_SETIMAGE, IMAGE_ICON, (LPARAM)hIcon);
DestroyIcon(hIcon);
@@ -701,7 +705,7 @@ INT_PTR CALLBACK DlgProcSMPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
SendMessage(hList, LVM_SETEXTENDEDLISTVIEWSTYLE, 0, LVS_EX_FULLROWSELECT | LVS_EX_CHECKBOXES);
LVCOLUMN lvCol = {0};
lvCol.mask = LVCF_WIDTH | LVCF_TEXT;
- lvCol.pszText = TranslateT("Protocol");
+ lvCol.pszText = TranslateT("Account");
lvCol.cx = 118;
ListView_InsertColumn(hList, 0, &lvCol);
// fill the list
@@ -711,46 +715,43 @@ INT_PTR CALLBACK DlgProcSMPopupOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARA
lvItem.iSubItem = 0;
int count;
- PROTOACCOUNT** protos;
+ PROTOACCOUNT **protos;
ProtoEnumAccounts(&count, &protos);
for (int i = 0; i < count; i++) {
- if (!IsSuitableProto(protos[i]))
- continue;
-
- UpdateListFlag = TRUE;
- lvItem.pszText = protos[i]->tszAccountName;
- lvItem.lParam = (LPARAM)protos[i]->szModuleName;
- PROTOTEMPLATE *prototemplate = (PROTOTEMPLATE *)mir_alloc(sizeof(PROTOTEMPLATE));
- prototemplate->ProtoName = protos[i]->tszAccountName;
- TCHAR protoname[MAX_PATH] = {0};
- mir_sntprintf(protoname, SIZEOF(protoname), _T("%s_TPopupSMsgChanged"), protos[i]->tszAccountName);
- char *szprotoname = mir_t2a(protoname);
- DBVARIANT dbVar = {0};
- db_get_ts(NULL, MODULE, szprotoname, &dbVar);
- if (lstrcmp(dbVar.ptszVal, NULL) == 0) {
- db_free(&dbVar);
- _tcsncpy(prototemplate->ProtoTemplateMsg, DEFAULT_POPUP_SMSGCHANGED, SIZEOF(prototemplate->ProtoTemplateMsg));
- }
- else _tcsncpy(prototemplate->ProtoTemplateMsg, dbVar.ptszVal, SIZEOF(prototemplate->ProtoTemplateMsg));
-
- mir_sntprintf(protoname, SIZEOF(protoname), _T("%s_TPopupSMsgRemoved"), protos[i]->tszAccountName);
- szprotoname = mir_t2a(protoname);
- db_get_ts(NULL, MODULE, szprotoname, &dbVar);
- if (lstrcmp(dbVar.ptszVal, NULL) == 0) {
- db_free(&dbVar);
- _tcsncpy(prototemplate->ProtoTemplateRemoved, DEFAULT_POPUP_SMSGREMOVED, SIZEOF(prototemplate->ProtoTemplateRemoved));
- }
- else _tcsncpy(prototemplate->ProtoTemplateRemoved, dbVar.ptszVal, SIZEOF(prototemplate->ProtoTemplateRemoved));
+ if (IsSuitableProto(protos[i])) {
+ UpdateListFlag = TRUE;
+ lvItem.pszText = protos[i]->tszAccountName;
+ lvItem.lParam = (LPARAM)protos[i]->szModuleName;
+ PROTOTEMPLATE *prototemplate = (PROTOTEMPLATE *)mir_alloc(sizeof(PROTOTEMPLATE));
+ prototemplate->ProtoName = protos[i]->szModuleName;
+
+ DBVARIANT dbVar = {0};
+ char protoname[MAX_PATH] = {0};
+ mir_snprintf(protoname, SIZEOF(protoname), "%s_TPopupSMsgChanged", protos[i]->szModuleName);
+ if (db_get_ts(NULL, MODULE, protoname, &dbVar))
+ _tcsncpy(prototemplate->ProtoTemplateMsg, DEFAULT_POPUP_SMSGCHANGED, SIZEOF(prototemplate->ProtoTemplateMsg));
+ else {
+ _tcsncpy(prototemplate->ProtoTemplateMsg, dbVar.ptszVal, SIZEOF(prototemplate->ProtoTemplateMsg));
+ db_free(&dbVar);
+ }
+
+ mir_snprintf(protoname, SIZEOF(protoname), "%s_TPopupSMsgRemoved", protos[i]->szModuleName);
+ if (db_get_ts(NULL, MODULE, protoname, &dbVar))
+ _tcsncpy(prototemplate->ProtoTemplateRemoved, DEFAULT_POPUP_SMSGREMOVED, SIZEOF(prototemplate->ProtoTemplateRemoved));
+ else {
+ _tcsncpy(prototemplate->ProtoTemplateRemoved, dbVar.ptszVal, SIZEOF(prototemplate->ProtoTemplateRemoved));
+ db_free(&dbVar);
+ }
- mir_free(szprotoname);
- ListView_InsertItem(hList, &lvItem);
- ProtoTemplates.insert(prototemplate, ProtoTemplates.getCount());
+ ListView_InsertItem(hList, &lvItem);
+ ProtoTemplates.insert(prototemplate, ProtoTemplates.getCount());
- char dbSetting[128];
- mir_snprintf(dbSetting, SIZEOF(dbSetting), "%s_enabled", protos[i]->szModuleName);
- ListView_SetCheckState(hList, lvItem.iItem, db_get_b(NULL, MODULE, dbSetting, TRUE));
- lvItem.iItem++;
+ char dbSetting[128];
+ mir_snprintf(dbSetting, SIZEOF(dbSetting), "%s_enabled", protos[i]->szModuleName);
+ ListView_SetCheckState(hList, lvItem.iItem, db_get_b(NULL, MODULE, dbSetting, TRUE));
+ lvItem.iItem++;
+ }
}
if (lvItem.iItem)
diff --git a/plugins/NewXstatusNotify/src/options.h b/plugins/NewXstatusNotify/src/options.h
index f8f8657966..6185faadac 100644
--- a/plugins/NewXstatusNotify/src/options.h
+++ b/plugins/NewXstatusNotify/src/options.h
@@ -86,6 +86,8 @@ typedef struct tagTEMPLATES {
BYTE PopupSMsgFlags;
BYTE LogXFlags;
BYTE LogSMsgFlags;
+ BYTE UseOneForAll;
+ BYTE bEnabled;
TCHAR PopupXstatusChanged[256];
TCHAR PopupXstatusRemoved[256];
TCHAR PopupXMsgChanged[256];
diff --git a/plugins/NewXstatusNotify/src/resource.h b/plugins/NewXstatusNotify/src/resource.h
index e827187708..865a779a40 100644
--- a/plugins/NewXstatusNotify/src/resource.h
+++ b/plugins/NewXstatusNotify/src/resource.h
@@ -1,6 +1,6 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
-// Used by ..\res\resource.rc
+// Used by C:\Users\xx\Documents\Visual Studio 2010\Projects\miranda-ng\plugins\NewXstatusNotify\res\resource.rc
//
#define IDD_OPT_XPOPUP 101
#define IDD_INFO_SOUNDS 102
@@ -97,6 +97,8 @@
#define IDC_ED_TXSTATUSREMOVED 1062
#define IDC_ED_TMSGCHANGED 1063
#define IDC_CHK_MSGREMOVED 1064
+#define IDC_CHECK1 1064
+#define IDC_ONEFORALL 1064
#define IDC_ED_TMSGCHANGED2 1065
#define IDC_ED_TMSGREMOVED 1065
#define IDC_TIMEOUT_VALUE 1066
@@ -194,7 +196,7 @@
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 119
#define _APS_NEXT_COMMAND_VALUE 40001
-#define _APS_NEXT_CONTROL_VALUE 1064
+#define _APS_NEXT_CONTROL_VALUE 1065
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
diff --git a/plugins/NewXstatusNotify/src/xstatus.h b/plugins/NewXstatusNotify/src/xstatus.h
index eae4d3cbfd..69b63b18bc 100644
--- a/plugins/NewXstatusNotify/src/xstatus.h
+++ b/plugins/NewXstatusNotify/src/xstatus.h
@@ -100,7 +100,7 @@ typedef struct tagDBEVENT
typedef struct tagPROTOTEMPLATE
{
- TCHAR *ProtoName;
+ char *ProtoName;
TCHAR ProtoTemplateMsg[MAX_PATH];
TCHAR ProtoTemplateRemoved[MAX_PATH];
} PROTOTEMPLATE;