Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6457c80e authored by Michael Enoma's avatar Michael Enoma
Browse files

Remove LocalStore.getFolderServerId()

parent 8891c56e
Loading
Loading
Loading
Loading
+7 −3
Original line number Diff line number Diff line
@@ -249,9 +249,13 @@ public class MessagingController {
        }
    }

    private String getFolderServerId(Account account, long folderId) throws MessagingException {
        LocalStore localStore = getLocalStoreOrThrow(account);
        return localStore.getFolderServerId(folderId);
    private String getFolderServerId(Account account, long folderId) {
        MessageStore messageStore = messageStoreManager.getMessageStore(account);
        String folderServerId = messageStore.getFolderServerId(folderId);
        if (folderServerId == null) {
            throw new IllegalStateException("Folder not found (ID: " + folderId + ")");
        }
        return folderServerId;
    }

    private long getFolderId(Account account, String folderServerId) {
+0 −14
Original line number Diff line number Diff line
@@ -696,20 +696,6 @@ public class LocalStore {
        return new File(attachmentDirectory, attachmentId);
    }

    public String getFolderServerId(long folderId) throws MessagingException {
        return database.execute(false, db -> {
            try (Cursor cursor = db.query("folders", new String[] { "server_id" },
                    "id = ?", new String[] { Long.toString(folderId) },
                    null, null, null)
            ) {
                if (cursor.moveToFirst() && !cursor.isNull(0)) {
                    return cursor.getString(0);
                } else {
                    throw new MessagingException("Folder not found by database ID: " + folderId, true);
                }
            }
        });
    }


    public static class AttachmentInfo {