Do not send to blocked recipients.

This commit is contained in:
clauz9
2022-02-25 21:23:58 +02:00
committed by Alex Hart
parent 4b07da4978
commit eb12395b8e
13 changed files with 45 additions and 12 deletions

View File

@@ -34,6 +34,7 @@ public class GroupReceiptDatabase extends Database {
public static final int STATUS_DELIVERED = 1;
public static final int STATUS_READ = 2;
public static final int STATUS_VIEWED = 3;
public static final int STATUS_SKIPPED = 4;
public static final String CREATE_TABLE = "CREATE TABLE " + TABLE_NAME + " (" + ID + " INTEGER PRIMARY KEY, " +
MMS_ID + " INTEGER, " + RECIPIENT_ID + " INTEGER, " + STATUS + " INTEGER, " + TIMESTAMP + " INTEGER, " + UNIDENTIFIED + " INTEGER DEFAULT 0);";
@@ -95,6 +96,26 @@ public class GroupReceiptDatabase extends Database {
}
}
public void setSkipped(Collection<RecipientId> recipients, long mmsId) {
SQLiteDatabase db = databaseHelper.getSignalWritableDatabase();
db.beginTransaction();
try {
String query = MMS_ID + " = ? AND " + RECIPIENT_ID + " = ?";
for (RecipientId recipient : recipients) {
ContentValues values = new ContentValues(1);
values.put(STATUS, STATUS_SKIPPED);
db.update(TABLE_NAME, values, query, new String[]{ String.valueOf(mmsId), recipient.serialize()});
}
db.setTransactionSuccessful();
} finally {
db.endTransaction();
}
}
public @NonNull List<GroupReceiptInfo> getGroupReceiptInfo(long mmsId) {
SQLiteDatabase db = databaseHelper.getSignalReadableDatabase();
List<GroupReceiptInfo> results = new LinkedList<>();