aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/eu/siacs/conversations/persistance
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2017-01-23 17:14:30 +0100
committerDaniel Gultsch <daniel@gultsch.de>2017-01-23 17:14:30 +0100
commit9b6ae6d75fdf07933427774f72310ceecc5f01bd (patch)
tree11410c8c8e57e6d26261a31cccced037e405ba66 /src/main/java/eu/siacs/conversations/persistance
parent4c6ef3b24edcd1169940851fc01103cc9d29d2be (diff)
configurable local message retention period. (untested)
Diffstat (limited to 'src/main/java/eu/siacs/conversations/persistance')
-rw-r--r--src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java b/src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java
index 63d5782b..4d5c4cb7 100644
--- a/src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java
+++ b/src/main/java/eu/siacs/conversations/persistance/DatabaseBackend.java
@@ -769,6 +769,13 @@ public class DatabaseBackend extends SQLiteOpenHelper {
db.delete(Message.TABLENAME, Message.CONVERSATION + "=?", args);
}
+ public boolean expireOldMessages(long timestamp) {
+ String where = Message.TIME_SENT+"<?";
+ String[] whereArgs = {String.valueOf(timestamp)};
+ SQLiteDatabase db = this.getReadableDatabase();
+ return db.delete(Message.TABLENAME,where,whereArgs) > 0;
+ }
+
public Pair<Long, String> getLastMessageReceived(Account account) {
Cursor cursor = null;
try {