Skip to content

Commit

Permalink
fixes #205 - mute whatsapp status broadcast by default
Browse files Browse the repository at this point in the history
  • Loading branch information
d99kris committed Mar 16, 2024
1 parent 731aa92 commit 317652b
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 3 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -330,6 +330,7 @@ This configuration file holds general user interface settings. Default content:
mark_read_on_view=1
mark_read_when_inactive=0
message_open_command=
mute_status_broadcast=1
muted_indicate_unread=1
muted_notify_unread=0
muted_position_by_timestamp=1
Expand Down Expand Up @@ -481,6 +482,11 @@ Specifies a custom command to use for opening/viewing message text part. If
not specified, nchat will use `PAGER` environment variable if set, or
otherwise use `less`.

### mute_status_broadcast

Specifies whether (WhatsApp) status broadcast chat should be treated as
muted.

### muted_indicate_unread

Specifies whether chat list should indicate unread status `*` for muted chats.
Expand Down
2 changes: 1 addition & 1 deletion lib/common/src/version.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@

#pragma once

#define NCHAT_VERSION "4.40"
#define NCHAT_VERSION "4.41"
2 changes: 1 addition & 1 deletion src/nchat.1
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.\" DO NOT MODIFY THIS FILE! It was generated by help2man.
.TH NCHAT "1" "March 2024" "nchat v4.40" "User Commands"
.TH NCHAT "1" "March 2024" "nchat v4.41" "User Commands"
.SH NAME
nchat \- ncurses chat
.SH SYNOPSIS
Expand Down
1 change: 1 addition & 0 deletions src/uiconfig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ void UiConfig::Init()
{ "mark_read_on_view", "1" },
{ "mark_read_when_inactive", "0" },
{ "message_open_command", "" },
{ "mute_status_broadcast", "1" },
{ "muted_indicate_unread", "1" },
{ "muted_notify_unread", "0" },
{ "muted_position_by_timestamp", "1" },
Expand Down
9 changes: 8 additions & 1 deletion src/uimodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1537,7 +1537,7 @@ void UiModel::MessageHandler(std::shared_ptr<ServiceMessage> p_ServiceMessage)
const std::vector<ContactInfo>& contactInfos = newContactsNotify->contactInfos;
for (auto& contactInfo : contactInfos)
{
LOG_TRACE("NewContacts");
LOG_TRACE("NewContacts %s", contactInfo.id.c_str());
m_ContactInfos[profileId][contactInfo.id] = contactInfo;
}

Expand All @@ -1557,6 +1557,13 @@ void UiModel::MessageHandler(std::shared_ptr<ServiceMessage> p_ServiceMessage)
LOG_TRACE("new chats %d", newChatsNotify->chatInfos.size());
for (auto& chatInfo : newChatsNotify->chatInfos)
{
LOG_TRACE("new chats %s", chatInfo.id.c_str());
static const bool muteStatusBroadcast = UiConfig::GetBool("mute_status_broadcast");
if (muteStatusBroadcast && (chatInfo.id == "status@broadcast"))
{
chatInfo.isMuted = true;
}

m_ChatInfos[profileId][chatInfo.id] = chatInfo;
HandleChatInfoMutedUpdate(profileId, chatInfo.id);

Expand Down

0 comments on commit 317652b

Please sign in to comment.