summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/mir_app/src/chat_svc.cpp8
-rw-r--r--src/mir_app/src/ei_defaulticons.cpp33
2 files changed, 35 insertions, 6 deletions
diff --git a/src/mir_app/src/chat_svc.cpp b/src/mir_app/src/chat_svc.cpp
index 1814ee284b..e44e723b34 100644
--- a/src/mir_app/src/chat_svc.cpp
+++ b/src/mir_app/src/chat_svc.cpp
@@ -832,14 +832,16 @@ static int ModulesLoaded(WPARAM, LPARAM)
mi.pszService = 0;
hMuteRootMenuItem = Menu_AddContactMenuItem(&mi);
+ UNSET_UID(mi);
mi.root = hMuteRootMenuItem;
+ mi.flags = CMIF_SYSTEM;
+ mi.pszService = "GChat/MuteChat";
+ CreateServiceFunction(mi.pszService, MuteChat);
+
mi.position = 1;
mi.hIcolibItem = 0;
- mi.flags = CMIF_SYSTEM;
mi.name.a = LPGEN("Default");
- mi.pszService = "GChat/MuteChat";
hMute0MenuItem = Menu_AddContactMenuItem(&mi);
- CreateServiceFunction(mi.pszService, MuteChat);
Menu_ConfigureItem(hMute0MenuItem, MCI_OPT_EXECPARAM, INT_PTR(CHATMODE_NORMAL));
mi.position = 2;
diff --git a/src/mir_app/src/ei_defaulticons.cpp b/src/mir_app/src/ei_defaulticons.cpp
index 7358768055..ed171eee45 100644
--- a/src/mir_app/src/ei_defaulticons.cpp
+++ b/src/mir_app/src/ei_defaulticons.cpp
@@ -24,11 +24,12 @@ Boston, MA 02111-1307, USA.
#include "m_cluiframes.h"
#include "extraicons.h"
+#include "chat.h"
////////////////////////////////////////////////////////////////////////////////////////
// DB extra icons
-HANDLE hExtraVisibility, hExtraChat, hExtraGender, hExtraProto;
+HANDLE hExtraVisibility, hExtraChat, hExtraChatMute, hExtraGender, hExtraProto;
static void SetVisibility(MCONTACT hContact, int apparentMode, bool clear)
{
@@ -89,6 +90,25 @@ static void SetGender(MCONTACT hContact, int gender, bool clear)
ExtraIcon_SetIconByName(hExtraGender, hContact, ico);
}
+static void SetChatMute(MCONTACT hContact, int mode)
+{
+ if (hContact == 0)
+ return;
+
+ if (mode == -1)
+ mode = db_get_b(hContact, "SRMM", "MuteMode", CHATMODE_NORMAL);
+
+ HANDLE hIcon;
+ switch (mode) {
+ case CHATMODE_MUTE: hIcon = Skin_GetIconHandle(SKINICON_OTHER_OFF); break;
+ case CHATMODE_UNMUTE: hIcon = Skin_GetIconHandle(SKINICON_OTHER_ON); break;
+ default:
+ hIcon = nullptr; break;
+ }
+
+ ExtraIcon_SetIcon(hExtraChatMute, hContact, hIcon);
+}
+
struct Info
{
const char *name;
@@ -160,12 +180,17 @@ static int SettingChanged(WPARAM hContact, LPARAM lParam)
DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING*)lParam;
bool isProto = (strcmp(cws->szModule, proto) == 0);
- if (isProto && strcmp(cws->szSetting, "ApparentMode") == 0) {
+ if (isProto && !strcmp(cws->szSetting, "ApparentMode")) {
SetVisibility(hContact, cws->value.type == DBVT_DELETED ? 0 : cws->value.wVal, true);
return 0;
}
- if (strcmp(cws->szSetting, "Gender") == 0 && (isProto || strcmp(cws->szModule, "UserInfo") == 0)) {
+ if (!strcmp(cws->szModule, "SRMM") && !strcmp(cws->szSetting, "MuteMode")) {
+ SetChatMute(hContact, cws->value.type == DBVT_DELETED ? CHATMODE_NORMAL : cws->value.wVal);
+ return 0;
+ }
+
+ if (!strcmp(cws->szSetting, "Gender") && (isProto || !strcmp(cws->szModule, "UserInfo"))) {
SetGender(hContact, cws->value.type == DBVT_DELETED ? 0 : cws->value.bVal, true);
return 0;
}
@@ -290,6 +315,7 @@ static int ProtocolOnClick(WPARAM wParam, LPARAM, LPARAM)
void DefaultExtraIcons_Load()
{
hExtraChat = ExtraIcon_RegisterIcolib("chat_activity", LPGEN("Chat activity"), "ChatActivity");
+ hExtraChatMute = ExtraIcon_RegisterIcolib("chat_mute", LPGEN("Chat mute mode"), "ChatMute");
hExtraVisibility = ExtraIcon_RegisterIcolib("visibility", "Visibility", Skin_GetIconHandle(SKINICON_OTHER_VISIBLE_ALL));
hExtraGender = ExtraIcon_RegisterIcolib("gender", "Gender", "gender_male", nullptr, 0, EIF_DISABLED_BY_DEFAULT);
hExtraProto = ExtraIcon_RegisterCallback("protocol", "Account", Skin_GetIconHandle(SKINICON_OTHER_ACCMGR),
@@ -304,6 +330,7 @@ void DefaultExtraIcons_Load()
}
for (auto &hContact : Contacts()) {
+ SetChatMute(hContact, -1);
SetExtraIcons(hContact);
SetVisibility(hContact, -1, false);
SetGender(hContact, -1, false);