summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorKirill Volinsky <KVolinsky@COMMON.EU.CORP.TOYOTA.com>2017-06-15 15:05:11 +0300
committerKirill Volinsky <KVolinsky@COMMON.EU.CORP.TOYOTA.com>2017-06-15 15:10:01 +0300
commit4f6145c3b880aba158633af290ce1210dcec95a1 (patch)
tree8b28bc7fdf317338850f49918e3d9c828fea5ad7 /plugins
parent4c3b947ddacabef2754f8ee9551c6be0786b73ba (diff)
XSoundNotify: added ability to set own sound for account (sometimes sound not played, i think it was before my changes)
Diffstat (limited to 'plugins')
-rw-r--r--plugins/XSoundNotify/src/dialog.cpp8
-rw-r--r--plugins/XSoundNotify/src/options.cpp221
-rw-r--r--plugins/XSoundNotify/src/stdafx.h6
-rw-r--r--plugins/XSoundNotify/src/version.h2
-rw-r--r--plugins/XSoundNotify/src/xsn_main.cpp42
5 files changed, 212 insertions, 67 deletions
diff --git a/plugins/XSoundNotify/src/dialog.cpp b/plugins/XSoundNotify/src/dialog.cpp
index d4a7353364..bbc972fac2 100644
--- a/plugins/XSoundNotify/src/dialog.cpp
+++ b/plugins/XSoundNotify/src/dialog.cpp
@@ -69,7 +69,7 @@ static INT_PTR CALLBACK DlgProcContactsOptions(HWND hwndDlg, UINT msg, WPARAM wP
if (p == NULL) {
ptrW name(db_get_wsa(hContact, SETTINGSNAME, SETTINGSKEY));
if (name != NULL)
- XSN_Users.insert(new XSN_Data(hContact, name, IsDlgButtonChecked(hwndDlg, IDC_CONT_IGNORE_SOUND) ? 1 : 0));
+ XSN_Users.insert(new XSN_Data(hContact, name, IsDlgButtonChecked(hwndDlg, IDC_CONT_IGNORE_SOUND) ? 1 : 0, 1));
}
}
return TRUE;
@@ -117,7 +117,7 @@ static INT_PTR CALLBACK DlgProcContactsOptions(HWND hwndDlg, UINT msg, WPARAM wP
SetDlgItemText(hwndDlg, IDC_CONT_LABEL_SOUND, PathFindFileName(FileName));
p = XSN_Users.find((XSN_Data *)&hContact);
if (p == NULL)
- XSN_Users.insert(new XSN_Data(hContact, FileName, IsDlgButtonChecked(hwndDlg, IDC_CONT_IGNORE_SOUND) ? 1 : 0));
+ XSN_Users.insert(new XSN_Data(hContact, FileName, IsDlgButtonChecked(hwndDlg, IDC_CONT_IGNORE_SOUND) ? 1 : 0, 1));
else {
wcsncpy(p->path, FileName, _countof(p->path));
p->ignore = IsDlgButtonChecked(hwndDlg, IDC_CONT_IGNORE_SOUND) ? 1 : 0;
@@ -170,10 +170,10 @@ static INT_PTR CALLBACK DlgProcContactsOptions(HWND hwndDlg, UINT msg, WPARAM wP
if (!db_get_ws(hContact, SETTINGSNAME, SETTINGSKEY, &dbv)) {
wchar_t longpath[MAX_PATH];
PathToAbsoluteW(dbv.ptszVal, longpath);
- XSN_Users.insert(new XSN_Data(hContact, longpath, IsDlgButtonChecked(hwndDlg, IDC_CONT_IGNORE_SOUND) ? 1 : 0));
+ XSN_Users.insert(new XSN_Data(hContact, longpath, IsDlgButtonChecked(hwndDlg, IDC_CONT_IGNORE_SOUND) ? 1 : 0, 1));
db_free(&dbv);
}
- else XSN_Users.insert(new XSN_Data(hContact, L"", IsDlgButtonChecked(hwndDlg, IDC_CONT_IGNORE_SOUND) ? 1 : 0));
+ else XSN_Users.insert(new XSN_Data(hContact, L"", IsDlgButtonChecked(hwndDlg, IDC_CONT_IGNORE_SOUND) ? 1 : 0, 1));
}
else p->ignore = IsDlgButtonChecked(hwndDlg, IDC_CONT_IGNORE_SOUND) ? 1 : 0;
}
diff --git a/plugins/XSoundNotify/src/options.cpp b/plugins/XSoundNotify/src/options.cpp
index 2d69f08ea5..f7735d774b 100644
--- a/plugins/XSoundNotify/src/options.cpp
+++ b/plugins/XSoundNotify/src/options.cpp
@@ -50,6 +50,7 @@ static INT_PTR CALLBACK OptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
int cursel = SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_PROTO, CB_GETCURSEL, 0, 0);
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 (MCONTACT hContact = db_find_first(); hContact; hContact = db_find_next(hContact)) {
char *szUniqueId = NULL;
if (db_get_b(hContact, pa->szModuleName, "ChatRoom", 0))
@@ -93,23 +94,44 @@ static INT_PTR CALLBACK OptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
case IDC_OPT_COMBO_USERS:
if ((HIWORD(wParam) == CBN_SELCHANGE) || (HIWORD(wParam) == LBN_SELCHANGE)) {
int cursel = SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_USERS, CB_GETCURSEL, 0, 0);
- MCONTACT hContact = (MCONTACT)SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_USERS, CB_GETITEMDATA, cursel, 0);
EnableWindow(GetDlgItem(hwndDlg, IDC_OPT_BUTTON_CHOOSE_SOUND), TRUE);
- DBVARIANT dbv = { 0 };
- if (!db_get_ws(hContact, SETTINGSNAME, SETTINGSKEY, &dbv))
- {
- EnableWindow(GetDlgItem(hwndDlg, IDC_OPT_BUTTON_TEST_PLAY), TRUE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_OPT_BUTTON_RESET_SOUND), TRUE);
- SetDlgItemText(hwndDlg, IDC_OPT_LABEL_SOUND, PathFindFileName(dbv.ptszVal));
- db_free(&dbv);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_OPT_IGNORE_SOUND), TRUE);
+ if (!cursel) {
+ PROTOACCOUNT *pa = (PROTOACCOUNT *)SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_PROTO, CB_GETITEMDATA, cursel, 0);
+ DBVARIANT dbv = { 0 };
+ if (!db_get_ws(NULL, SETTINGSNAME, pa->szModuleName, &dbv)) {
+ EnableWindow(GetDlgItem(hwndDlg, IDC_OPT_BUTTON_TEST_PLAY), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_OPT_BUTTON_RESET_SOUND), TRUE);
+ SetDlgItemText(hwndDlg, IDC_OPT_LABEL_SOUND, PathFindFileName(dbv.ptszVal));
+ db_free(&dbv);
+ }
+ else {
+ EnableWindow(GetDlgItem(hwndDlg, IDC_OPT_BUTTON_TEST_PLAY), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_OPT_BUTTON_RESET_SOUND), FALSE);
+ SetDlgItemText(hwndDlg, IDC_OPT_LABEL_SOUND, TranslateT("Not set"));
+ }
+ 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);
+ CheckDlgButton(hwndDlg, IDC_OPT_IGNORE_SOUND, db_get_b(NULL, SETTINGSNAME, value, 0) ? BST_CHECKED : BST_UNCHECKED);
+ mir_free(value);
}
else {
- EnableWindow(GetDlgItem(hwndDlg, IDC_OPT_BUTTON_TEST_PLAY), FALSE);
- EnableWindow(GetDlgItem(hwndDlg, IDC_OPT_BUTTON_RESET_SOUND), FALSE);
- SetDlgItemText(hwndDlg, IDC_OPT_LABEL_SOUND, TranslateT("Not set"));
+ MCONTACT hContact = (MCONTACT)SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_USERS, CB_GETITEMDATA, cursel, 0);
+ DBVARIANT dbv = { 0 };
+ if (!db_get_ws(hContact, SETTINGSNAME, SETTINGSKEY, &dbv)) {
+ EnableWindow(GetDlgItem(hwndDlg, IDC_OPT_BUTTON_TEST_PLAY), TRUE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_OPT_BUTTON_RESET_SOUND), TRUE);
+ SetDlgItemText(hwndDlg, IDC_OPT_LABEL_SOUND, PathFindFileName(dbv.ptszVal));
+ db_free(&dbv);
+ }
+ else {
+ EnableWindow(GetDlgItem(hwndDlg, IDC_OPT_BUTTON_TEST_PLAY), FALSE);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_OPT_BUTTON_RESET_SOUND), FALSE);
+ SetDlgItemText(hwndDlg, IDC_OPT_LABEL_SOUND, TranslateT("Not set"));
+ }
+ CheckDlgButton(hwndDlg, IDC_OPT_IGNORE_SOUND, db_get_b(hContact, SETTINGSNAME, SETTINGSIGNOREKEY, 0) ? BST_CHECKED : BST_UNCHECKED);
}
- EnableWindow(GetDlgItem(hwndDlg, IDC_OPT_IGNORE_SOUND), TRUE);
- CheckDlgButton(hwndDlg, IDC_OPT_IGNORE_SOUND, db_get_b(hContact, SETTINGSNAME, SETTINGSIGNOREKEY, 0) ? BST_CHECKED : BST_UNCHECKED);
}
return 0;
@@ -138,18 +160,34 @@ static INT_PTR CALLBACK OptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
if (GetOpenFileName(&ofn)) {
SetDlgItemText(hwndDlg, IDC_OPT_LABEL_SOUND, PathFindFileName(FileName));
int cursel = SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_USERS, CB_GETCURSEL, 0, 0);
- MCONTACT hContact = (MCONTACT)SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_USERS, CB_GETITEMDATA, cursel, 0);
- XSN_Data *p = XSN_Users.find((XSN_Data *)&hContact);
- if (p == NULL)
- XSN_Users.insert(new XSN_Data(hContact, FileName, IsDlgButtonChecked(hwndDlg, IDC_OPT_IGNORE_SOUND) ? 1 : 0));
- else
- {
- wcsncpy(p->path, FileName, _countof(p->path));
- p->ignore = IsDlgButtonChecked(hwndDlg, IDC_OPT_IGNORE_SOUND) ? 1 : 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 == NULL)
+ 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 == NULL)
+ 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);
}
- 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);
}
@@ -158,22 +196,43 @@ static INT_PTR CALLBACK OptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
case IDC_OPT_BUTTON_TEST_PLAY:
{
int cursel = SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_USERS, CB_GETCURSEL, 0, 0);
- 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 == NULL) {
- DBVARIANT dbv;
- if (!db_get_ws(hContact, SETTINGSNAME, SETTINGSKEY, &dbv)) {
- wchar_t longpath[MAX_PATH];
- PathToAbsoluteW(dbv.ptszVal, longpath);
+ 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 == NULL) {
+ DBVARIANT dbv;
+ if (!db_get_ws(NULL, SETTINGSNAME, pa->szModuleName, &dbv)) {
+ wchar_t longpath[MAX_PATH];
+ PathToAbsoluteW(dbv.ptszVal, longpath);
+ SkinPlaySoundFile(longpath);
+ db_free(&dbv);
+ }
+ }
+ else {
+ wchar_t longpath[MAX_PATH] = { 0 };
+ PathToAbsoluteW(p->path, longpath);
SkinPlaySoundFile(longpath);
- db_free(&dbv);
}
}
else {
- wchar_t longpath[MAX_PATH] = { 0 };
- PathToAbsoluteW(p->path, longpath);
- SkinPlaySoundFile(longpath);
+ 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 == NULL) {
+ DBVARIANT dbv;
+ if (!db_get_ws(hContact, SETTINGSNAME, SETTINGSKEY, &dbv)) {
+ wchar_t longpath[MAX_PATH];
+ PathToAbsoluteW(dbv.ptszVal, longpath);
+ SkinPlaySoundFile(longpath);
+ db_free(&dbv);
+ }
+ }
+ else {
+ wchar_t longpath[MAX_PATH] = { 0 };
+ PathToAbsoluteW(p->path, longpath);
+ SkinPlaySoundFile(longpath);
+ }
}
}
return 0;
@@ -185,35 +244,70 @@ static INT_PTR CALLBACK OptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
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);
- MCONTACT hContact = (MCONTACT)SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_USERS, CB_GETITEMDATA, cursel, 0);
- XSN_Data *p = XSN_Users.find((XSN_Data *)&hContact);
- if (p != NULL) {
- XSN_Users.remove(p);
- delete p;
- SendMessage(GetParent(hwndDlg), PSM_CHANGED, 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 != NULL) {
+ XSN_Users.remove(p);
+ delete p;
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ }
+ db_unset(NULL, SETTINGSNAME, 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);
+ db_unset(NULL, SETTINGSNAME, 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 != NULL) {
+ XSN_Users.remove(p);
+ delete p;
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ }
+ db_unset(hContact, SETTINGSNAME, SETTINGSKEY);
+ db_unset(hContact, SETTINGSNAME, SETTINGSIGNOREKEY);
}
- db_unset(hContact, SETTINGSNAME, SETTINGSKEY);
- db_unset(hContact, SETTINGSNAME, SETTINGSIGNOREKEY);
}
return 0;
case IDC_OPT_IGNORE_SOUND:
{
int cursel = SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_USERS, CB_GETCURSEL, 0, 0);
- MCONTACT hContact = (MCONTACT)SendDlgItemMessage(hwndDlg, IDC_OPT_COMBO_USERS, CB_GETITEMDATA, cursel, 0);
- XSN_Data *p = XSN_Users.find((XSN_Data *)&hContact);
- if (p == NULL) {
- DBVARIANT dbv;
- if (!db_get_ws(hContact, SETTINGSNAME, SETTINGSKEY, &dbv)) {
- wchar_t longpath[MAX_PATH];
- PathToAbsoluteW(dbv.ptszVal, longpath);
- XSN_Users.insert(new XSN_Data(hContact, longpath, IsDlgButtonChecked(hwndDlg, IDC_OPT_IGNORE_SOUND) ? 1 : 0));
- db_free(&dbv);
+ 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 == NULL) {
+ DBVARIANT dbv;
+ if (!db_get_ws(NULL, SETTINGSNAME, pa->szModuleName, &dbv)) {
+ wchar_t longpath[MAX_PATH];
+ PathToAbsoluteW(dbv.ptszVal, 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(hContact, L"", IsDlgButtonChecked(hwndDlg, IDC_OPT_IGNORE_SOUND) ? 1 : 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 == NULL) {
+ DBVARIANT dbv;
+ if (!db_get_ws(hContact, SETTINGSNAME, SETTINGSKEY, &dbv)) {
+ wchar_t longpath[MAX_PATH];
+ PathToAbsoluteW(dbv.ptszVal, 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 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;
}
@@ -227,9 +321,20 @@ static INT_PTR CALLBACK OptsProc(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
if (mir_wstrcmpi(XSN_Users[i]->path, L"")) {
wchar_t shortpath[MAX_PATH];
PathToRelativeW(XSN_Users[i]->path, shortpath);
- db_set_ws(XSN_Users[i]->hContact, SETTINGSNAME, SETTINGSKEY, shortpath);
+ if (XSN_Users[i]->iscontact)
+ db_set_ws(XSN_Users[i]->hContact, SETTINGSNAME, SETTINGSKEY, shortpath);
+ else
+ db_set_ws(NULL, SETTINGSNAME, (LPCSTR)XSN_Users[i]->hContact, shortpath);
+ }
+ if (XSN_Users[i]->iscontact)
+ db_set_b(XSN_Users[i]->hContact, SETTINGSNAME, SETTINGSIGNOREKEY, XSN_Users[i]->ignore);
+ else {
+ size_t value_max_len = mir_strlen((const char*)XSN_Users[i]->hContact) + 8;
+ char *value = (char *)mir_alloc(sizeof(char) * value_max_len);
+ mir_snprintf(value, value_max_len, "%s_ignore", (const char*)XSN_Users[i]->hContact);
+ db_set_b(NULL, SETTINGSNAME, value, XSN_Users[i]->ignore);
+ mir_free(value);
}
- db_set_b(XSN_Users[i]->hContact, SETTINGSNAME, SETTINGSIGNOREKEY, XSN_Users[i]->ignore);
}
break;
}
diff --git a/plugins/XSoundNotify/src/stdafx.h b/plugins/XSoundNotify/src/stdafx.h
index a04427e9f8..47e1176e07 100644
--- a/plugins/XSoundNotify/src/stdafx.h
+++ b/plugins/XSoundNotify/src/stdafx.h
@@ -22,15 +22,17 @@
struct XSN_Data
{
- MCONTACT hContact;
+ LPARAM hContact;
wchar_t path[MAX_PATH];
BYTE ignore;
+ BYTE iscontact;
- __forceinline XSN_Data(MCONTACT _aContact, wchar_t *_path, BYTE _ignore) :
+ __forceinline XSN_Data(LPARAM _aContact, wchar_t *_path, BYTE _ignore, BYTE _iscontact) :
hContact(_aContact)
{
wcsncpy(path, _path, _countof(path));
ignore = _ignore;
+ iscontact = _iscontact;
}
};
diff --git a/plugins/XSoundNotify/src/version.h b/plugins/XSoundNotify/src/version.h
index 9a03703505..37a22967d6 100644
--- a/plugins/XSoundNotify/src/version.h
+++ b/plugins/XSoundNotify/src/version.h
@@ -1,7 +1,7 @@
#define __MAJOR_VERSION 1
#define __MINOR_VERSION 0
#define __RELEASE_NUM 1
-#define __BUILD_NUM 2
+#define __BUILD_NUM 3
#include <stdver.h>
diff --git a/plugins/XSoundNotify/src/xsn_main.cpp b/plugins/XSoundNotify/src/xsn_main.cpp
index 2233816700..b97d930f8d 100644
--- a/plugins/XSoundNotify/src/xsn_main.cpp
+++ b/plugins/XSoundNotify/src/xsn_main.cpp
@@ -14,7 +14,7 @@ int hLangpack;
LIST<XSN_Data> XSN_Users(10, NumericKeySortT);
HGENMENU hChangeSound = NULL;
MWindowList hChangeSoundDlgList = NULL;
-BYTE isIgnoreSound = 0, isOwnSound = 0;
+BYTE isIgnoreSound = 0, isOwnSound = 0, isIgnoreAccSound = 0, isAccSound = 0;
CLIST_INTERFACE *pcli;
CHAT_MANAGER *pci;
@@ -124,6 +124,23 @@ static int ProcessEvent(WPARAM hContact, LPARAM lParam)
SkinPlaySoundFile(PlaySoundPath);
db_free(&dbv);
isOwnSound = 1;
+ return 0;
+ }
+
+ char *szProto = GetContactProto(hContact);
+ PROTOACCOUNT *pa = Proto_GetAccount(szProto);
+ 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);
+ isIgnoreAccSound = db_get_b(NULL, SETTINGSNAME, value, 0);
+ mir_free(value);
+ if (!isIgnoreAccSound && !db_get_ws(NULL, SETTINGSNAME, pa->szModuleName, &dbv)) {
+ wchar_t PlaySoundPath[MAX_PATH] = { 0 };
+ PathToAbsoluteW(dbv.ptszVal, PlaySoundPath);
+ isAccSound = 0;
+ SkinPlaySoundFile(PlaySoundPath);
+ db_free(&dbv);
+ isAccSound = 1;
}
return 0;
@@ -154,6 +171,22 @@ static int ProcessChatEvent(WPARAM, LPARAM lParam)
SkinPlaySoundFile(PlaySoundPath);
db_free(&dbv);
isOwnSound = 1;
+ return 0;
+ }
+ char *szProto = GetContactProto(hContact);
+ PROTOACCOUNT *pa = Proto_GetAccount(szProto);
+ 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);
+ isIgnoreAccSound = db_get_b(NULL, SETTINGSNAME, value, 0);
+ mir_free(value);
+ if (!isIgnoreAccSound && !db_get_ws(NULL, SETTINGSNAME, pa->szModuleName, &dbv)) {
+ wchar_t PlaySoundPath[MAX_PATH] = { 0 };
+ PathToAbsoluteW(dbv.ptszVal, PlaySoundPath);
+ isAccSound = 0;
+ SkinPlaySoundFile(PlaySoundPath);
+ db_free(&dbv);
+ isAccSound = 1;
}
}
}
@@ -163,13 +196,18 @@ static int ProcessChatEvent(WPARAM, LPARAM lParam)
static int OnPlaySound(WPARAM, LPARAM)
{
- if (isIgnoreSound)
+ if (isIgnoreSound || isIgnoreAccSound)
return 1;
if (isOwnSound) {
isOwnSound = 0;
return 1;
}
+ if (isAccSound) {
+ isAccSound = 0;
+ return 1;
+ }
+
return 0;
}