aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java')
-rw-r--r--src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java b/src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java
index 8f264639d..d6e45f5fe 100644
--- a/src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java
+++ b/src/main/java/de/pixart/messenger/persistance/DatabaseBackend.java
@@ -1097,6 +1097,25 @@ public class DatabaseBackend extends SQLiteOpenHelper {
return prekeys;
}
+ public int getSignedPreKeysCount(Account account) {
+ String[] columns = {"count(" + SQLiteAxolotlStore.KEY + ")"};
+ String[] selectionArgs = {account.getUuid()};
+ SQLiteDatabase db = this.getReadableDatabase();
+ Cursor cursor = db.query(SQLiteAxolotlStore.SIGNED_PREKEY_TABLENAME,
+ columns,
+ SQLiteAxolotlStore.ACCOUNT + "=?",
+ selectionArgs,
+ null, null, null);
+ final int count;
+ if (cursor.moveToFirst()) {
+ count = cursor.getInt(0);
+ } else {
+ count = 0;
+ }
+ cursor.close();
+ return count;
+ }
+
public boolean containsSignedPreKey(Account account, int signedPreKeyId) {
Cursor cursor = getCursorForPreKey(account, signedPreKeyId);
int count = cursor.getCount();