BackendFolder should never hand out local-only messages
Backend implementations don't need to know about local messages.
@@ -5,6 +5,7 @@ import android.database.sqlite.SQLiteDatabase
import androidx.core.database.getLongOrNull
import androidx.core.database.getStringOrNull
import com.fsck.k9.Account
+import com.fsck.k9.K9
import com.fsck.k9.Preferences
import com.fsck.k9.backend.api.BackendFolder
import com.fsck.k9.backend.api.BackendFolder.MoreMessages
@@ -61,7 +62,7 @@ class K9BackendFolder(
override fun getAllMessagesAndEffectiveDates(): Map<String, Long?> {
return database.rawQuery("SELECT uid, date FROM messages" +
- " WHERE empty = 0 AND deleted = 0 AND folder_id = ?" +
+ " WHERE empty = 0 AND deleted = 0 AND folder_id = ? AND uid NOT LIKE '${K9.LOCAL_UID_PREFIX}%'" +
" ORDER BY date DESC", databaseId) { cursor ->
val result = mutableMapOf<String, Long?>()
while (cursor.moveToNext()) {
