From f7634a85be516feef753bdb32fed8df7da1573ed Mon Sep 17 00:00:00 2001 From: Daniel Gultsch Date: Wed, 22 Jul 2015 15:31:00 +0200 Subject: [PATCH] treat private, non-anonymous mucs like 1:1 chats notification wise --- .../java/eu/siacs/conversations/entities/Conversation.java | 7 +++++++ .../siacs/conversations/services/NotificationService.java | 2 +- src/main/res/values/strings.xml | 4 ++-- src/main/res/xml/preferences.xml | 2 +- 4 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/main/java/eu/siacs/conversations/entities/Conversation.java b/src/main/java/eu/siacs/conversations/entities/Conversation.java index 2efd8a290..6d99e3588 100644 --- a/src/main/java/eu/siacs/conversations/entities/Conversation.java +++ b/src/main/java/eu/siacs/conversations/entities/Conversation.java @@ -519,6 +519,13 @@ public class Conversation extends AbstractEntity implements Blockable { return getContact().getOtrFingerprints().contains(getOtrFingerprint()); } + /** + * short for is Private and Non-anonymous + */ + public boolean isPnNA() { + return mode == MODE_SINGLE || (getMucOptions().membersOnly() && getMucOptions().nonanonymous()); + } + public synchronized MucOptions getMucOptions() { if (this.mucOptions == null) { this.mucOptions = new MucOptions(this); diff --git a/src/main/java/eu/siacs/conversations/services/NotificationService.java b/src/main/java/eu/siacs/conversations/services/NotificationService.java index 956f704eb..47f0347fa 100644 --- a/src/main/java/eu/siacs/conversations/services/NotificationService.java +++ b/src/main/java/eu/siacs/conversations/services/NotificationService.java @@ -64,7 +64,7 @@ public class NotificationService { return (message.getStatus() == Message.STATUS_RECEIVED) && notificationsEnabled() && !message.getConversation().isMuted() - && (message.getConversation().getMode() == Conversation.MODE_SINGLE + && (message.getConversation().isPnNA() || conferenceNotificationsEnabled() || wasHighlightedOrPrivate(message) ); diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index cc514ef3d..1adb8235a 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -108,8 +108,8 @@ Also vibrate when a new message arrives Sound Play ringtone with notification - Conference notifications - Always notify when a new conference message arrives instead of only when highlighted + Notifications in Public Conferences + Always notify when a message arrives in a public conference instead of only when highlighted Notification grace period Disable notifications for a short time after a carbon copy was received Advanced Options diff --git a/src/main/res/xml/preferences.xml b/src/main/res/xml/preferences.xml index 5b7d69040..13598cb6f 100644 --- a/src/main/res/xml/preferences.xml +++ b/src/main/res/xml/preferences.xml @@ -83,7 +83,7 @@ android:title="@string/pref_sound" />