summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/m_chat_int.h3
-rw-r--r--libs/win32/mir_app.libbin238324 -> 238528 bytes
-rw-r--r--libs/win64/mir_app.libbin235280 -> 235466 bytes
-rw-r--r--src/mir_app/src/chat_svc.cpp18
-rw-r--r--src/mir_app/src/chat_tools.cpp4
-rw-r--r--src/mir_app/src/ei_defaulticons.cpp2
-rw-r--r--src/mir_app/src/mir_app.def1
-rw-r--r--src/mir_app/src/mir_app64.def1
8 files changed, 20 insertions, 9 deletions
diff --git a/include/m_chat_int.h b/include/m_chat_int.h
index 6aa2bee8a6..a2b9c98587 100644
--- a/include/m_chat_int.h
+++ b/include/m_chat_int.h
@@ -387,7 +387,8 @@ EXTERN_C MIR_APP_DLL(int) Chat_GetTextPixelSize(const wchar_t *pszText, HFONT hF
EXTERN_C MIR_APP_DLL(bool) Chat_GetDefaultEventDescr(const SESSION_INFO *si, const LOGINFO *lin, CMStringW &res);
// sets mute mode for a group chat
-EXTERN_C MIR_APP_DLL(void) Chat_Mute(SESSION_INFO *si, int mode);
+EXTERN_C MIR_APP_DLL(int) Chat_IsMuted(MCONTACT hContact);
+EXTERN_C MIR_APP_DLL(void) Chat_Mute(MCONTACT hContact, int mode);
/////////////////////////////////////////////////////////////////////////////////////////
// common settings
diff --git a/libs/win32/mir_app.lib b/libs/win32/mir_app.lib
index e2966e62fd..4cf5bfb4d5 100644
--- a/libs/win32/mir_app.lib
+++ b/libs/win32/mir_app.lib
Binary files differ
diff --git a/libs/win64/mir_app.lib b/libs/win64/mir_app.lib
index 07df738f4e..ba6e0366a5 100644
--- a/libs/win64/mir_app.lib
+++ b/libs/win64/mir_app.lib
Binary files differ
diff --git a/src/mir_app/src/chat_svc.cpp b/src/mir_app/src/chat_svc.cpp
index 8c72074600..d893a2c754 100644
--- a/src/mir_app/src/chat_svc.cpp
+++ b/src/mir_app/src/chat_svc.cpp
@@ -750,16 +750,24 @@ MIR_APP_DLL(int) Chat_SetUserInfo(SESSION_INFO *si, void *pItemData)
return GC_EVENT_ERROR;
}
-EXTERN_C MIR_APP_DLL(void) Chat_UpdateOptions()
+MIR_APP_DLL(void) Chat_UpdateOptions()
{
for (auto &si : g_arSessions)
if (si->pDlg)
si->pDlg->UpdateOptions();
}
-EXTERN_C MIR_APP_DLL(void) Chat_Mute(SESSION_INFO *si, int mode)
+MIR_APP_DLL(int) Chat_IsMuted(MCONTACT hContact)
{
- db_set_b(si->hContact, "SRMM", "MuteMode", mode);
+ return db_get_b(hContact, "SRMM", "MuteMode", CHATMODE_NORMAL);
+}
+
+MIR_APP_DLL(void) Chat_Mute(MCONTACT hContact, int mode)
+{
+ if (mode != CHATMODE_NORMAL)
+ db_set_b(hContact, "SRMM", "MuteMode", mode);
+ else
+ db_unset(hContact, "SRMM", "MuteMode");
}
/////////////////////////////////////////////////////////////////////////////////////////
@@ -830,7 +838,7 @@ static int OnContactDeleted(WPARAM hContact, LPARAM)
static INT_PTR MuteChat(WPARAM hContact, LPARAM param)
{
- db_set_b(hContact, "SRMM", "MuteMode", param);
+ Chat_Mute(hContact, param);
return 0;
}
@@ -839,7 +847,7 @@ static int PrebuildContactMenu(WPARAM hContact, LPARAM)
if (hContact == 0)
return 0;
- int iMuteMode = db_get_b(hContact, "SRMM", "MuteMode", CHATMODE_NORMAL);
+ int iMuteMode = Chat_IsMuted(hContact);
bool bEnabledJoin = false, bEnabledLeave = false, bIsChat = false;
char *szProto = Proto_GetBaseAccountName(hContact);
if (szProto) {
diff --git a/src/mir_app/src/chat_tools.cpp b/src/mir_app/src/chat_tools.cpp
index cb962183de..382f2f2dcf 100644
--- a/src/mir_app/src/chat_tools.cpp
+++ b/src/mir_app/src/chat_tools.cpp
@@ -158,7 +158,7 @@ static void AddEvent(MCONTACT hContact, HICON hIcon, int type, const wchar_t *pw
BOOL DoTrayIcon(SESSION_INFO *si, GCEVENT *gce)
{
- int iMuteMode = db_get_b(si->hContact, "SRMM", "MuteMode", CHATMODE_NORMAL);
+ int iMuteMode = Chat_IsMuted(si->hContact);
switch (iMuteMode) {
case CHATMODE_MUTE: iMuteMode = CLEF_ONLYAFEW; break;
case CHATMODE_UNMUTE: iMuteMode = 0; break;
@@ -375,7 +375,7 @@ BOOL DoSoundsFlashPopupTrayStuff(SESSION_INFO *si, GCEVENT *gce, BOOL bHighlight
return FALSE;
BOOL bInactive = si->pDlg == nullptr || !si->pDlg->IsActive();
- int iMuteMode = db_get_b(si->hContact, "SRMM", "MuteMode", CHATMODE_NORMAL);
+ int iMuteMode = Chat_IsMuted(si->hContact);
if (bHighlight) {
gce->iType |= GC_EVENT_HIGHLIGHT;
diff --git a/src/mir_app/src/ei_defaulticons.cpp b/src/mir_app/src/ei_defaulticons.cpp
index e2eb20cbf0..763150027c 100644
--- a/src/mir_app/src/ei_defaulticons.cpp
+++ b/src/mir_app/src/ei_defaulticons.cpp
@@ -95,7 +95,7 @@ static void SetChatMute(MCONTACT hContact, int mode)
return;
if (mode == -1)
- mode = db_get_b(hContact, "SRMM", "MuteMode", CHATMODE_NORMAL);
+ mode = Chat_IsMuted(hContact);
HANDLE hIcon;
switch (mode) {
diff --git a/src/mir_app/src/mir_app.def b/src/mir_app/src/mir_app.def
index 022ce9a37b..e994cf236b 100644
--- a/src/mir_app/src/mir_app.def
+++ b/src/mir_app/src/mir_app.def
@@ -823,3 +823,4 @@ Srmm_CreateHotkey @886 NONAME
?getMStringU@PROTO_INTERFACE@@QAE?AV?$CMStringT@DV?$ChTraitsCRT@D@@@@IPBD0@Z @938 NONAME
?getMStringU@PROTO_INTERFACE@@QAE?AV?$CMStringT@DV?$ChTraitsCRT@D@@@@PBD0@Z @939 NONAME
?OnEventDeleted@PROTO_INTERFACE@@UAEXII@Z @940 NONAME
+Chat_IsMuted @941 NONAME
diff --git a/src/mir_app/src/mir_app64.def b/src/mir_app/src/mir_app64.def
index 196c8cba39..c953a52884 100644
--- a/src/mir_app/src/mir_app64.def
+++ b/src/mir_app/src/mir_app64.def
@@ -823,3 +823,4 @@ Srmm_CreateHotkey @886 NONAME
?getMStringU@PROTO_INTERFACE@@QEAA?AV?$CMStringT@DV?$ChTraitsCRT@D@@@@IPEBD0@Z @938 NONAME
?getMStringU@PROTO_INTERFACE@@QEAA?AV?$CMStringT@DV?$ChTraitsCRT@D@@@@PEBD0@Z @939 NONAME
?OnEventDeleted@PROTO_INTERFACE@@UEAAXII@Z @940 NONAME
+Chat_IsMuted @941 NONAME