diff options
author | George Hazan <ghazan@miranda.im> | 2020-03-20 19:41:54 +0300 |
---|---|---|
committer | George Hazan <ghazan@miranda.im> | 2020-03-20 19:41:54 +0300 |
commit | 90a31cc69ee19b332410aa0f69692dc328625270 (patch) | |
tree | afe0d5b4488da6c9f447a4304fb33792a63521fb /plugins | |
parent | a8d704883591202f97f0c877d036c0c877a79d66 (diff) |
fixes #2269 (XSoundNotify displays garbage in options window)
Diffstat (limited to 'plugins')
-rw-r--r-- | plugins/XSoundNotify/src/dialog.cpp | 32 | ||||
-rw-r--r-- | plugins/XSoundNotify/src/options.cpp | 334 | ||||
-rw-r--r-- | plugins/XSoundNotify/src/stdafx.h | 2 |
3 files changed, 156 insertions, 212 deletions
diff --git a/plugins/XSoundNotify/src/dialog.cpp b/plugins/XSoundNotify/src/dialog.cpp index 39db3a53c7..e26fa0ea1c 100644 --- a/plugins/XSoundNotify/src/dialog.cpp +++ b/plugins/XSoundNotify/src/dialog.cpp @@ -22,34 +22,12 @@ static INT_PTR CALLBACK DlgProcContactsOptions(HWND hwndDlg, UINT msg, WPARAM wP SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
WindowList_Add(hChangeSoundDlgList, hwndDlg, hContact);
Utils_RestoreWindowPositionNoSize(hwndDlg, hContact, MODULENAME, "ChangeSoundDlg");
- char* szProto = Proto_GetBaseAccountName(hContact);
- PROTOACCOUNT *pa = Proto_GetAccount(szProto);
- const char* szUniqueId = Proto_GetUniqueId(pa->szModuleName);
- if (szUniqueId != nullptr) {
- DBVARIANT dbvuid = { 0 };
- if (!db_get(hContact, pa->szModuleName, szUniqueId, &dbvuid)) {
- wchar_t uid[MAX_PATH];
- switch (dbvuid.type) {
- case DBVT_DWORD:
- _itow(dbvuid.dVal, uid, 10);
- break;
-
- case DBVT_ASCIIZ:
- mir_wstrcpy(uid, _A2T(dbvuid.pszVal));
- break;
-
- case DBVT_UTF8:
- mir_wstrcpy(uid, ptrW(mir_utf8decodeW(dbvuid.pszVal)));
- break;
- }
- wchar_t *nick = Clist_GetContactDisplayName(hContact);
- wchar_t value[100];
- mir_snwprintf(value, TranslateT("Custom sound for %s (%s)"), nick, uid);
- SetWindowText(hwndDlg, value);
- db_free(&dbvuid);
- }
- }
+ ptrW uid(Contact_GetInfo(CNF_UNIQUEID, hContact));
+ wchar_t value[100];
+ mir_snwprintf(value, TranslateT("Custom sound for %s (%s)"), Clist_GetContactDisplayName(hContact), uid.get());
+ SetWindowText(hwndDlg, value);
+
EnableWindow(GetDlgItem(hwndDlg, IDC_CONT_BUTTON_CHOOSE_SOUND), TRUE);
DBVARIANT dbv = { 0 };
if (!g_plugin.getWString(hContact, SETTINGSKEY, &dbv)) {
diff --git a/plugins/XSoundNotify/src/options.cpp b/plugins/XSoundNotify/src/options.cpp index 420599f6ef..5d8f3c3640 100644 --- a/plugins/XSoundNotify/src/options.cpp +++ b/plugins/XSoundNotify/src/options.cpp @@ -49,42 +49,10 @@ static INT_PTR CALLBACK OptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l PROTOACCOUNT *pa = (PROTOACCOUNT *)SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_PROTO, CB_GETITEMDATA, cursel, 0);
SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_USERS, CB_SETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_USERS, CB_ADDSTRING, 0, (LPARAM)TranslateT("All contacts")), cursel);
- for (auto &hContact : Contacts()) {
- const char *szUniqueId;
- if (db_get_b(hContact, pa->szModuleName, "ChatRoom", 0))
- szUniqueId = "ChatRoomID";
- else
- szUniqueId = Proto_GetUniqueId(pa->szModuleName);
- if (szUniqueId != nullptr) {
- DBVARIANT dbvuid = { 0 };
- if (!db_get(hContact, pa->szModuleName, szUniqueId, &dbvuid)) {
- wchar_t uid[MAX_PATH];
- switch (dbvuid.type) {
- case DBVT_DWORD:
- _itow(dbvuid.dVal, uid, 10);
- break;
-
- case DBVT_ASCIIZ:
- mir_wstrcpy(uid, _A2T(dbvuid.pszVal));
- break;
-
- case DBVT_UTF8:
- mir_wstrcpy(uid, ptrW(mir_utf8decodeW(dbvuid.pszVal)));
- break;
-
- default:
- mir_wstrcpy(uid, TranslateT("(Unknown contact)"));
- }
-
- wchar_t *nick = Clist_GetContactDisplayName(hContact);
- size_t value_max_len = (mir_wstrlen(uid) + mir_wstrlen(nick) + 4);
- wchar_t *value = (wchar_t *)mir_alloc(sizeof(wchar_t) * value_max_len);
- mir_snwprintf(value, value_max_len, L"%s (%s)", nick, uid);
- SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_USERS, CB_SETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_USERS, CB_ADDSTRING, 0, (LPARAM)value), hContact);
- mir_free(value);
- db_free(&dbvuid);
- }
- }
+ for (auto &hContact : Contacts(pa->szModuleName)) {
+ ptrW uid(Contact_GetInfo(CNF_UNIQUEID, hContact));
+ CMStringW value(FORMAT, L"%s (%s)", Clist_GetContactDisplayName(hContact), uid.get());
+ SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_USERS, CB_SETITEMDATA, SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_USERS, CB_ADDSTRING, 0, (LPARAM)value.c_str()), hContact);
}
}
return 0;
@@ -134,180 +102,178 @@ static INT_PTR CALLBACK OptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l return 0;
case IDC_OPT_BUTTON_CHOOSE_SOUND:
- {
- wchar_t FileName[MAX_PATH];
- wchar_t *tszMirDir = Utils_ReplaceVarsW(L"%miranda_path%");
+ {
+ wchar_t FileName[MAX_PATH];
+ wchar_t *tszMirDir = Utils_ReplaceVarsW(L"%miranda_path%");
+
+ OPENFILENAME ofn = { 0 };
+ ofn.lStructSize = sizeof(ofn);
+ wchar_t tmp[MAX_PATH];
+ if (GetModuleHandle(L"bass_interface.dll"))
+ mir_snwprintf(tmp, L"%s (*.wav, *.mp3, *.ogg)%c*.wav;*.mp3;*.ogg%c%c", TranslateT("Sound files"), 0, 0, 0);
+ else
+ mir_snwprintf(tmp, L"%s (*.wav)%c*.wav%c%c", TranslateT("WAV files"), 0, 0, 0);
+ ofn.lpstrFilter = tmp;
+ ofn.hwndOwner = nullptr;
+ ofn.lpstrFile = FileName;
+ ofn.nMaxFile = MAX_PATH;
+ ofn.nMaxFileTitle = MAX_PATH;
+ ofn.Flags = OFN_HIDEREADONLY | OFN_FILEMUSTEXIST;
+ ofn.lpstrInitialDir = tszMirDir;
+ *FileName = '\0';
+ ofn.lpstrDefExt = L"";
- OPENFILENAME ofn = { 0 };
- ofn.lStructSize = sizeof(ofn);
- wchar_t tmp[MAX_PATH];
- if (GetModuleHandle(L"bass_interface.dll"))
- mir_snwprintf(tmp, L"%s (*.wav, *.mp3, *.ogg)%c*.wav;*.mp3;*.ogg%c%c", TranslateT("Sound files"), 0, 0, 0);
- else
- mir_snwprintf(tmp, L"%s (*.wav)%c*.wav%c%c", TranslateT("WAV files"), 0, 0, 0);
- ofn.lpstrFilter = tmp;
- ofn.hwndOwner = nullptr;
- ofn.lpstrFile = FileName;
- ofn.nMaxFile = MAX_PATH;
- ofn.nMaxFileTitle = MAX_PATH;
- ofn.Flags = OFN_HIDEREADONLY | OFN_FILEMUSTEXIST;
- ofn.lpstrInitialDir = tszMirDir;
- *FileName = '\0';
- ofn.lpstrDefExt = L"";
+ if (GetOpenFileName(&ofn)) {
+ SetDlgItemText(hwndDlg, IDC_OPT_LABEL_SOUND, PathFindFileName(FileName));
+ int cursel = SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_USERS, CB_GETCURSEL, 0, 0);
+ if (!cursel) {
+ PROTOACCOUNT *pa = (PROTOACCOUNT *)SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_PROTO, CB_GETITEMDATA, cursel, 0);
+ XSN_Data *p = XSN_Users.find((XSN_Data *)&pa->szModuleName);
+ if (p == nullptr)
+ XSN_Users.insert(new XSN_Data((LPARAM)pa->szModuleName, FileName, IsDlgButtonChecked(hwndDlg, IDC_OPT_IGNORE_SOUND) ? 1 : 0, 0));
+ else {
+ wcsncpy(p->path, FileName, _countof(p->path));
+ p->ignore = IsDlgButtonChecked(hwndDlg, IDC_OPT_IGNORE_SOUND) ? 1 : 0;
+ }
+ EnableWindow(GetDlgItem(hwndDlg, IDC_OPT_BUTTON_TEST_PLAY), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_OPT_BUTTON_RESET_SOUND), TRUE);
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ }
+ else {
+ MCONTACT hContact = (MCONTACT)SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_USERS, CB_GETITEMDATA, cursel, 0);
+ XSN_Data *p = XSN_Users.find((XSN_Data *)&hContact);
+ if (p == nullptr)
+ XSN_Users.insert(new XSN_Data(hContact, FileName, IsDlgButtonChecked(hwndDlg, IDC_OPT_IGNORE_SOUND) ? 1 : 0, 1));
+ else {
+ wcsncpy(p->path, FileName, _countof(p->path));
+ p->ignore = IsDlgButtonChecked(hwndDlg, IDC_OPT_IGNORE_SOUND) ? 1 : 0;
+ }
+ EnableWindow(GetDlgItem(hwndDlg, IDC_OPT_BUTTON_TEST_PLAY), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_OPT_BUTTON_RESET_SOUND), TRUE);
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ }
+ }
+ mir_free(tszMirDir);
+ }
+ return 0;
- if (GetOpenFileName(&ofn)) {
- SetDlgItemText(hwndDlg, IDC_OPT_LABEL_SOUND, PathFindFileName(FileName));
+ case IDC_OPT_BUTTON_TEST_PLAY:
+ {
int cursel = SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_USERS, CB_GETCURSEL, 0, 0);
if (!cursel) {
PROTOACCOUNT *pa = (PROTOACCOUNT *)SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_PROTO, CB_GETITEMDATA, cursel, 0);
XSN_Data *p = XSN_Users.find((XSN_Data *)&pa->szModuleName);
- if (p == nullptr)
- XSN_Users.insert(new XSN_Data((LPARAM)pa->szModuleName, FileName, IsDlgButtonChecked(hwndDlg, IDC_OPT_IGNORE_SOUND) ? 1 : 0, 0));
- else
- {
- wcsncpy(p->path, FileName, _countof(p->path));
- p->ignore = IsDlgButtonChecked(hwndDlg, IDC_OPT_IGNORE_SOUND) ? 1 : 0;
+ isIgnoreSound = 0;
+ if (p == nullptr) {
+ DBVARIANT dbv;
+ if (!g_plugin.getWString(pa->szModuleName, &dbv)) {
+ wchar_t longpath[MAX_PATH];
+ PathToAbsoluteW(dbv.pwszVal, longpath);
+ Skin_PlaySoundFile(longpath);
+ db_free(&dbv);
+ }
+ }
+ else {
+ wchar_t longpath[MAX_PATH] = { 0 };
+ PathToAbsoluteW(p->path, longpath);
+ Skin_PlaySoundFile(longpath);
}
- EnableWindow(GetDlgItem(hwndDlg, IDC_OPT_BUTTON_TEST_PLAY), TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_OPT_BUTTON_RESET_SOUND), TRUE);
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
else {
MCONTACT hContact = (MCONTACT)SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_USERS, CB_GETITEMDATA, cursel, 0);
XSN_Data *p = XSN_Users.find((XSN_Data *)&hContact);
- if (p == nullptr)
- XSN_Users.insert(new XSN_Data(hContact, FileName, IsDlgButtonChecked(hwndDlg, IDC_OPT_IGNORE_SOUND) ? 1 : 0, 1));
- else
- {
- wcsncpy(p->path, FileName, _countof(p->path));
- p->ignore = IsDlgButtonChecked(hwndDlg, IDC_OPT_IGNORE_SOUND) ? 1 : 0;
+ isIgnoreSound = 0;
+ if (p == nullptr) {
+ DBVARIANT dbv;
+ if (!g_plugin.getWString(hContact, SETTINGSKEY, &dbv)) {
+ wchar_t longpath[MAX_PATH];
+ PathToAbsoluteW(dbv.pwszVal, longpath);
+ Skin_PlaySoundFile(longpath);
+ db_free(&dbv);
+ }
}
- EnableWindow(GetDlgItem(hwndDlg, IDC_OPT_BUTTON_TEST_PLAY), TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_OPT_BUTTON_RESET_SOUND), TRUE);
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- }
- }
- mir_free(tszMirDir);
- }
- return 0;
-
- case IDC_OPT_BUTTON_TEST_PLAY:
- {
- int cursel = SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_USERS, CB_GETCURSEL, 0, 0);
- if (!cursel){
- PROTOACCOUNT *pa = (PROTOACCOUNT *)SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_PROTO, CB_GETITEMDATA, cursel, 0);
- XSN_Data *p = XSN_Users.find((XSN_Data *)&pa->szModuleName);
- isIgnoreSound = 0;
- if (p == nullptr) {
- DBVARIANT dbv;
- if (!g_plugin.getWString(pa->szModuleName, &dbv)) {
- wchar_t longpath[MAX_PATH];
- PathToAbsoluteW(dbv.pwszVal, longpath);
+ else {
+ wchar_t longpath[MAX_PATH] = { 0 };
+ PathToAbsoluteW(p->path, longpath);
Skin_PlaySoundFile(longpath);
- db_free(&dbv);
}
}
- else {
- wchar_t longpath[MAX_PATH] = { 0 };
- PathToAbsoluteW(p->path, longpath);
- Skin_PlaySoundFile(longpath);
- }
}
- else {
- MCONTACT hContact = (MCONTACT)SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_USERS, CB_GETITEMDATA, cursel, 0);
- XSN_Data *p = XSN_Users.find((XSN_Data *)&hContact);
- isIgnoreSound = 0;
- if (p == nullptr) {
- DBVARIANT dbv;
- if (!g_plugin.getWString(hContact, SETTINGSKEY, &dbv)) {
- wchar_t longpath[MAX_PATH];
- PathToAbsoluteW(dbv.pwszVal, longpath);
- Skin_PlaySoundFile(longpath);
- db_free(&dbv);
- }
- }
- else {
- wchar_t longpath[MAX_PATH] = { 0 };
- PathToAbsoluteW(p->path, longpath);
- Skin_PlaySoundFile(longpath);
- }
- }
- }
- return 0;
+ return 0;
case IDC_OPT_BUTTON_RESET_SOUND:
- {
- EnableWindow(GetDlgItem(hwndDlg, IDC_OPT_BUTTON_TEST_PLAY), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_OPT_BUTTON_RESET_SOUND), FALSE);
- CheckDlgButton(hwndDlg, IDC_OPT_IGNORE_SOUND, BST_UNCHECKED);
- SetDlgItemText(hwndDlg, IDC_OPT_LABEL_SOUND, TranslateT("Not set"));
- int cursel = SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_USERS, CB_GETCURSEL, 0, 0);
- if (!cursel) {
- PROTOACCOUNT *pa = (PROTOACCOUNT *)SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_PROTO, CB_GETITEMDATA, cursel, 0);
- XSN_Data *p = XSN_Users.find((XSN_Data *)&pa->szModuleName);
- if (p != nullptr) {
- XSN_Users.remove(p);
- delete p;
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ {
+ EnableWindow(GetDlgItem(hwndDlg, IDC_OPT_BUTTON_TEST_PLAY), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_OPT_BUTTON_RESET_SOUND), FALSE);
+ CheckDlgButton(hwndDlg, IDC_OPT_IGNORE_SOUND, BST_UNCHECKED);
+ SetDlgItemText(hwndDlg, IDC_OPT_LABEL_SOUND, TranslateT("Not set"));
+ int cursel = SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_USERS, CB_GETCURSEL, 0, 0);
+ if (!cursel) {
+ PROTOACCOUNT *pa = (PROTOACCOUNT *)SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_PROTO, CB_GETITEMDATA, cursel, 0);
+ XSN_Data *p = XSN_Users.find((XSN_Data *)&pa->szModuleName);
+ if (p != nullptr) {
+ XSN_Users.remove(p);
+ delete p;
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ }
+ g_plugin.delSetting(pa->szModuleName);
+ size_t value_max_len = mir_strlen(pa->szModuleName) + 8;
+ char *value = (char *)mir_alloc(sizeof(char) * value_max_len);
+ mir_snprintf(value, value_max_len, "%s_ignore", pa->szModuleName);
+ g_plugin.delSetting(value);
+ mir_free(value);
}
- g_plugin.delSetting(pa->szModuleName);
- size_t value_max_len = mir_strlen(pa->szModuleName) + 8;
- char *value = (char *)mir_alloc(sizeof(char) * value_max_len);
- mir_snprintf(value, value_max_len, "%s_ignore", pa->szModuleName);
- g_plugin.delSetting(value);
- mir_free(value);
- }
- else {
- MCONTACT hContact = (MCONTACT)SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_USERS, CB_GETITEMDATA, cursel, 0);
- XSN_Data *p = XSN_Users.find((XSN_Data *)&hContact);
- if (p != nullptr) {
- XSN_Users.remove(p);
- delete p;
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ else {
+ MCONTACT hContact = (MCONTACT)SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_USERS, CB_GETITEMDATA, cursel, 0);
+ XSN_Data *p = XSN_Users.find((XSN_Data *)&hContact);
+ if (p != nullptr) {
+ XSN_Users.remove(p);
+ delete p;
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ }
+ g_plugin.delSetting(hContact, SETTINGSKEY);
+ g_plugin.delSetting(hContact, SETTINGSIGNOREKEY);
}
- g_plugin.delSetting(hContact, SETTINGSKEY);
- g_plugin.delSetting(hContact, SETTINGSIGNOREKEY);
}
- }
- return 0;
+ return 0;
case IDC_OPT_IGNORE_SOUND:
- {
- int cursel = SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_USERS, CB_GETCURSEL, 0, 0);
- if (!cursel) {
- PROTOACCOUNT *pa = (PROTOACCOUNT *)SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_PROTO, CB_GETITEMDATA, cursel, 0);
- XSN_Data *p = XSN_Users.find((XSN_Data *)&pa->szModuleName);
- if (p == nullptr) {
- DBVARIANT dbv;
- if (!g_plugin.getWString(pa->szModuleName, &dbv)) {
- wchar_t longpath[MAX_PATH];
- PathToAbsoluteW(dbv.pwszVal, longpath);
- XSN_Users.insert(new XSN_Data((LPARAM)pa->szModuleName, longpath, IsDlgButtonChecked(hwndDlg, IDC_OPT_IGNORE_SOUND) ? 1 : 0, 0));
- db_free(&dbv);
+ {
+ int cursel = SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_USERS, CB_GETCURSEL, 0, 0);
+ if (!cursel) {
+ PROTOACCOUNT *pa = (PROTOACCOUNT *)SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_PROTO, CB_GETITEMDATA, cursel, 0);
+ XSN_Data *p = XSN_Users.find((XSN_Data *)&pa->szModuleName);
+ if (p == nullptr) {
+ DBVARIANT dbv;
+ if (!g_plugin.getWString(pa->szModuleName, &dbv)) {
+ wchar_t longpath[MAX_PATH];
+ PathToAbsoluteW(dbv.pwszVal, longpath);
+ XSN_Users.insert(new XSN_Data((LPARAM)pa->szModuleName, longpath, IsDlgButtonChecked(hwndDlg, IDC_OPT_IGNORE_SOUND) ? 1 : 0, 0));
+ db_free(&dbv);
+ }
+ else XSN_Users.insert(new XSN_Data((LPARAM)pa->szModuleName, L"", IsDlgButtonChecked(hwndDlg, IDC_OPT_IGNORE_SOUND) ? 1 : 0, 0));
}
- else XSN_Users.insert(new XSN_Data((LPARAM)pa->szModuleName, L"", IsDlgButtonChecked(hwndDlg, IDC_OPT_IGNORE_SOUND) ? 1 : 0, 0));
+ else p->ignore = IsDlgButtonChecked(hwndDlg, IDC_OPT_IGNORE_SOUND) ? 1 : 0;
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
- else p->ignore = IsDlgButtonChecked(hwndDlg, IDC_OPT_IGNORE_SOUND) ? 1 : 0;
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
- }
- else {
- MCONTACT hContact = (MCONTACT)SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_USERS, CB_GETITEMDATA, cursel, 0);
- XSN_Data *p = XSN_Users.find((XSN_Data *)&hContact);
- if (p == nullptr) {
- DBVARIANT dbv;
- if (!g_plugin.getWString(hContact, SETTINGSKEY, &dbv)) {
- wchar_t longpath[MAX_PATH];
- PathToAbsoluteW(dbv.pwszVal, longpath);
- XSN_Users.insert(new XSN_Data(hContact, longpath, IsDlgButtonChecked(hwndDlg, IDC_OPT_IGNORE_SOUND) ? 1 : 0, 1));
- db_free(&dbv);
+ else {
+ MCONTACT hContact = (MCONTACT)SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_USERS, CB_GETITEMDATA, cursel, 0);
+ XSN_Data *p = XSN_Users.find((XSN_Data *)&hContact);
+ if (p == nullptr) {
+ DBVARIANT dbv;
+ if (!g_plugin.getWString(hContact, SETTINGSKEY, &dbv)) {
+ wchar_t longpath[MAX_PATH];
+ PathToAbsoluteW(dbv.pwszVal, longpath);
+ XSN_Users.insert(new XSN_Data(hContact, longpath, IsDlgButtonChecked(hwndDlg, IDC_OPT_IGNORE_SOUND) ? 1 : 0, 1));
+ db_free(&dbv);
+ }
+ else XSN_Users.insert(new XSN_Data(hContact, L"", IsDlgButtonChecked(hwndDlg, IDC_OPT_IGNORE_SOUND) ? 1 : 0, 1));
}
- else XSN_Users.insert(new XSN_Data(hContact, L"", IsDlgButtonChecked(hwndDlg, IDC_OPT_IGNORE_SOUND) ? 1 : 0, 1));
+ else p->ignore = IsDlgButtonChecked(hwndDlg, IDC_OPT_IGNORE_SOUND) ? 1 : 0;
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
- else p->ignore = IsDlgButtonChecked(hwndDlg, IDC_OPT_IGNORE_SOUND) ? 1 : 0;
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
}
- }
- return 0;
+ return 0;
}
break;
@@ -327,9 +293,9 @@ static INT_PTR CALLBACK OptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l if (it->iscontact)
g_plugin.setByte(it->hContact, SETTINGSIGNOREKEY, it->ignore);
else {
- size_t value_max_len = mir_strlen((const char*)it->hContact) + 8;
+ size_t value_max_len = mir_strlen((const char *)it->hContact) + 8;
char *value = (char *)mir_alloc(sizeof(char) * value_max_len);
- mir_snprintf(value, value_max_len, "%s_ignore", (const char*)it->hContact);
+ mir_snprintf(value, value_max_len, "%s_ignore", (const char *)it->hContact);
g_plugin.setByte(value, it->ignore);
mir_free(value);
}
diff --git a/plugins/XSoundNotify/src/stdafx.h b/plugins/XSoundNotify/src/stdafx.h index 7a5c1527ac..850750ad61 100644 --- a/plugins/XSoundNotify/src/stdafx.h +++ b/plugins/XSoundNotify/src/stdafx.h @@ -4,7 +4,7 @@ #include <Shlwapi.h>
#include <newpluginapi.h>
-#include <m_system.h>
+#include <m_contacts.h>
#include <m_database.h>
#include <m_protocols.h>
#include <m_protosvc.h>
|