diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2014-09-28 16:33:25 +0200 |
---|---|---|
committer | Daniel Gultsch <daniel@gultsch.de> | 2014-09-28 16:33:25 +0200 |
commit | 87010e6094cc35ece98d3beadbbfbc59ea0a25b3 (patch) | |
tree | 08aaa1cbc7a3acab4246e5f516ff8125d99760fd /src/eu/siacs/conversations/parser | |
parent | bff23c2e232e8f9a4e64553215130079b7fc5a4f (diff) |
more improvments for new notification service
Diffstat (limited to 'src/eu/siacs/conversations/parser')
-rw-r--r-- | src/eu/siacs/conversations/parser/MessageParser.java | 18 |
1 files changed, 12 insertions, 6 deletions
diff --git a/src/eu/siacs/conversations/parser/MessageParser.java b/src/eu/siacs/conversations/parser/MessageParser.java index 3891ebf7..d1964b8c 100644 --- a/src/eu/siacs/conversations/parser/MessageParser.java +++ b/src/eu/siacs/conversations/parser/MessageParser.java @@ -8,6 +8,7 @@ import eu.siacs.conversations.entities.Account; import eu.siacs.conversations.entities.Contact; import eu.siacs.conversations.entities.Conversation; import eu.siacs.conversations.entities.Message; +import eu.siacs.conversations.services.NotificationService; import eu.siacs.conversations.services.XmppConnectionService; import eu.siacs.conversations.utils.CryptoHelper; import eu.siacs.conversations.xml.Element; @@ -386,11 +387,13 @@ public class MessageParser extends AbstractParser implements @Override public void onMessagePacketReceived(Account account, MessagePacket packet) { Message message = null; - boolean notify = true; - if (mXmppConnectionService.getPreferences().getBoolean( - "notification_grace_period_after_carbon_received", true)) { - notify = (SystemClock.elapsedRealtime() - lastCarbonMessageReceived) > (Config.CARBON_GRACE_PERIOD * 1000); - } + boolean notify = mXmppConnectionService.getPreferences().getBoolean( + "show_notification", true); + notify = notify + && (SystemClock.elapsedRealtime() - lastCarbonMessageReceived) > (Config.CARBON_GRACE_PERIOD * 1000); + boolean alwaysNotifyInConference = notify + && mXmppConnectionService.getPreferences().getBoolean( + "always_notify_in_conference", false); this.parseNick(packet, account); @@ -427,8 +430,11 @@ public class MessageParser extends AbstractParser implements if (message != null) { if (message.getStatus() == Message.STATUS_RECEIVED) { message.markUnread(); + notify = alwaysNotifyInConference + || NotificationService + .wasHighlightedOrPrivate(message); } else { - message.getConversation().markRead(); + mXmppConnectionService.markRead(message.getConversation()); lastCarbonMessageReceived = SystemClock.elapsedRealtime(); notify = false; } |