aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/siacs/conversations/parser/MessageParser.java
diff options
context:
space:
mode:
authoriNPUTmice <daniel@gultsch.de>2014-10-07 13:37:50 +0200
committeriNPUTmice <daniel@gultsch.de>2014-10-07 13:37:50 +0200
commitd5227e5c253658eb9d6bc1f7bf85397f072125d4 (patch)
treec87bfdf56479421086993fa9b900765281f28947 /src/eu/siacs/conversations/parser/MessageParser.java
parent7f524352730edc630697c693a040ca570cbcedb3 (diff)
refactored grace period
Diffstat (limited to 'src/eu/siacs/conversations/parser/MessageParser.java')
-rw-r--r--src/eu/siacs/conversations/parser/MessageParser.java15
1 files changed, 4 insertions, 11 deletions
diff --git a/src/eu/siacs/conversations/parser/MessageParser.java b/src/eu/siacs/conversations/parser/MessageParser.java
index 18752659..8d5ca898 100644
--- a/src/eu/siacs/conversations/parser/MessageParser.java
+++ b/src/eu/siacs/conversations/parser/MessageParser.java
@@ -1,10 +1,7 @@
package eu.siacs.conversations.parser;
-import android.os.SystemClock;
-import android.util.Log;
import net.java.otr4j.session.Session;
import net.java.otr4j.session.SessionStatus;
-import eu.siacs.conversations.Config;
import eu.siacs.conversations.entities.Account;
import eu.siacs.conversations.entities.Contact;
import eu.siacs.conversations.entities.Conversation;
@@ -19,9 +16,6 @@ import eu.siacs.conversations.xmpp.stanzas.MessagePacket;
public class MessageParser extends AbstractParser implements
OnMessagePacketReceived {
-
- private long lastCarbonMessageReceived = -(Config.CARBON_GRACE_PERIOD * 1000);
-
public MessageParser(XmppConnectionService service) {
super(service);
}
@@ -404,8 +398,6 @@ public class MessageParser extends AbstractParser implements
Message message = null;
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);
@@ -431,8 +423,8 @@ public class MessageParser extends AbstractParser implements
message = this.parseCarbonMessage(packet, account);
if (message != null) {
if (message.getStatus() == Message.STATUS_SEND) {
- lastCarbonMessageReceived = SystemClock
- .elapsedRealtime();
+ mXmppConnectionService.getNotificationService()
+ .activateGracePeriod();
notify = false;
mXmppConnectionService.markRead(
message.getConversation(), false);
@@ -454,7 +446,8 @@ public class MessageParser extends AbstractParser implements
} else {
mXmppConnectionService.markRead(message.getConversation(),
false);
- lastCarbonMessageReceived = SystemClock.elapsedRealtime();
+ mXmppConnectionService.getNotificationService()
+ .activateGracePeriod();
notify = false;
}
}