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

Unverified Commit bcb22ca7 authored by Wolf-Martell Montwé's avatar Wolf-Martell Montwé Committed by GitHub
Browse files

Merge pull request #9295 from shamim-emon/fix-issue-9294

Convert ResponseCodeExtractor class from Java to Kotlin
parents a479c9dd c5fa6780
Loading
Loading
Loading
Loading
+0 −19
Original line number Diff line number Diff line
package com.fsck.k9.mail.store.imap;


class ResponseCodeExtractor {
    public static final String AUTHENTICATION_FAILED = "AUTHENTICATIONFAILED";


    private ResponseCodeExtractor() {
    }

    public static String getResponseCode(ImapResponse response) {
        if (response.size() < 2 || !response.isList(1)) {
            return null;
        }

        ImapList responseTextCode = response.getList(1);
        return responseTextCode.size() != 1 ? null : responseTextCode.getString(0);
    }
}
+15 −0
Original line number Diff line number Diff line
package com.fsck.k9.mail.store.imap

internal object ResponseCodeExtractor {
    const val AUTHENTICATION_FAILED: String = "AUTHENTICATIONFAILED"

    @JvmStatic
    fun getResponseCode(response: ImapResponse): String? {
        if (response.size < 2 || !response.isList(1)) {
            return null
        }

        val responseTextCode = response.getList(1)
        return if (responseTextCode.size != 1) null else responseTextCode.getString(0)
    }
}