aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/siacs/conversations/entities
diff options
context:
space:
mode:
authoriNPUTmice <daniel@gultsch.de>2014-10-17 11:01:38 +0200
committeriNPUTmice <daniel@gultsch.de>2014-10-17 11:01:38 +0200
commit3372e50155ac16c9eabce9a484914c2acbf391c8 (patch)
treead00d1e203d0adf56f27a44cd4a9e12301ac41dc /src/eu/siacs/conversations/entities
parent5e3caf962696d3fe39e7ce70274530aa4f77d134 (diff)
made grace period on a per account basis
Diffstat (limited to '')
-rw-r--r--src/eu/siacs/conversations/entities/Account.java27
1 files changed, 20 insertions, 7 deletions
diff --git a/src/eu/siacs/conversations/entities/Account.java b/src/eu/siacs/conversations/entities/Account.java
index 9b1cbcab..ff509ba1 100644
--- a/src/eu/siacs/conversations/entities/Account.java
+++ b/src/eu/siacs/conversations/entities/Account.java
@@ -11,6 +11,7 @@ import net.java.otr4j.crypto.OtrCryptoException;
import org.json.JSONException;
import org.json.JSONObject;
+import eu.siacs.conversations.Config;
import eu.siacs.conversations.R;
import eu.siacs.conversations.crypto.OtrEngine;
import eu.siacs.conversations.persistance.FileBackend;
@@ -21,6 +22,7 @@ import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.graphics.Bitmap;
+import android.os.SystemClock;
public class Account extends AbstractEntity {
@@ -64,16 +66,14 @@ public class Account extends AbstractEntity {
protected boolean online = false;
- transient OtrEngine otrEngine = null;
- transient XmppConnection xmppConnection = null;
- transient protected Presences presences = new Presences();
-
+ private OtrEngine otrEngine = null;
+ private XmppConnection xmppConnection = null;
+ private Presences presences = new Presences();
+ private long mEndGracePeriod = 0L;
private String otrFingerprint;
-
private Roster roster = null;
-
+
private List<Bookmark> bookmarks = new CopyOnWriteArrayList<Bookmark>();
-
public List<Conversation> pendingConferenceJoins = new CopyOnWriteArrayList<Conversation>();
public List<Conversation> pendingConferenceLeaves = new CopyOnWriteArrayList<Conversation>();
@@ -401,4 +401,17 @@ public class Account extends AbstractEntity {
return R.string.account_status_unknown;
}
}
+
+ public void activateGracePeriod() {
+ this.mEndGracePeriod = SystemClock.elapsedRealtime()
+ + (Config.CARBON_GRACE_PERIOD * 1000);
+ }
+
+ public void deactivateGracePeriod() {
+ this.mEndGracePeriod = 0L;
+ }
+
+ public boolean inGracePeriod() {
+ return SystemClock.elapsedRealtime() < this.mEndGracePeriod;
+ }
}