summaryrefslogtreecommitdiff
path: root/plugins/XSoundNotify/src/dialog.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <ghazan@miranda.im>2020-03-20 19:41:54 +0300
committerGeorge Hazan <ghazan@miranda.im>2020-03-20 19:41:54 +0300
commit90a31cc69ee19b332410aa0f69692dc328625270 (patch)
treeafe0d5b4488da6c9f447a4304fb33792a63521fb /plugins/XSoundNotify/src/dialog.cpp
parenta8d704883591202f97f0c877d036c0c877a79d66 (diff)
fixes #2269 (XSoundNotify displays garbage in options window)
Diffstat (limited to 'plugins/XSoundNotify/src/dialog.cpp')
-rw-r--r--plugins/XSoundNotify/src/dialog.cpp32
1 files changed, 5 insertions, 27 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)) {