Loading mail/protocols/imap/src/main/java/com/fsck/k9/mail/store/imap/AlertResponse.javadeleted 100644 → 0 +0 −26 Original line number Diff line number Diff line package com.fsck.k9.mail.store.imap; import static com.fsck.k9.mail.store.imap.ImapResponseParser.equalsIgnoreCase; class AlertResponse { private static final String ALERT_RESPONSE_CODE = "ALERT"; private AlertResponse() { } public static String getAlertText(ImapResponse response) { if (response.size() < 3 || !response.isList(1)) { return null; } ImapList responseTextCode = response.getList(1); if (responseTextCode.size() != 1 || !equalsIgnoreCase(responseTextCode.get(0), ALERT_RESPONSE_CODE)) { return null; } return response.getString(2); } } mail/protocols/imap/src/main/java/com/fsck/k9/mail/store/imap/AlertResponse.kt 0 → 100644 +25 −0 Original line number Diff line number Diff line package com.fsck.k9.mail.store.imap import com.fsck.k9.mail.store.imap.ImapResponseParser.equalsIgnoreCase internal object AlertResponse { private const val ALERT_RESPONSE_CODE = "ALERT" private const val MINIMUM_RESPONSE_SIZE = 3 @JvmStatic fun getAlertText(response: ImapResponse): String? { return if ( response.size >= MINIMUM_RESPONSE_SIZE && response.isList(1) ) { val responseTextCode = response.getList(1) if (responseTextCode.size == 1 && equalsIgnoreCase(responseTextCode[0], ALERT_RESPONSE_CODE)) { response.getString(2) } else { null } } else { null } } } Loading
mail/protocols/imap/src/main/java/com/fsck/k9/mail/store/imap/AlertResponse.javadeleted 100644 → 0 +0 −26 Original line number Diff line number Diff line package com.fsck.k9.mail.store.imap; import static com.fsck.k9.mail.store.imap.ImapResponseParser.equalsIgnoreCase; class AlertResponse { private static final String ALERT_RESPONSE_CODE = "ALERT"; private AlertResponse() { } public static String getAlertText(ImapResponse response) { if (response.size() < 3 || !response.isList(1)) { return null; } ImapList responseTextCode = response.getList(1); if (responseTextCode.size() != 1 || !equalsIgnoreCase(responseTextCode.get(0), ALERT_RESPONSE_CODE)) { return null; } return response.getString(2); } }
mail/protocols/imap/src/main/java/com/fsck/k9/mail/store/imap/AlertResponse.kt 0 → 100644 +25 −0 Original line number Diff line number Diff line package com.fsck.k9.mail.store.imap import com.fsck.k9.mail.store.imap.ImapResponseParser.equalsIgnoreCase internal object AlertResponse { private const val ALERT_RESPONSE_CODE = "ALERT" private const val MINIMUM_RESPONSE_SIZE = 3 @JvmStatic fun getAlertText(response: ImapResponse): String? { return if ( response.size >= MINIMUM_RESPONSE_SIZE && response.isList(1) ) { val responseTextCode = response.getList(1) if (responseTextCode.size == 1 && equalsIgnoreCase(responseTextCode[0], ALERT_RESPONSE_CODE)) { response.getString(2) } else { null } } else { null } } }