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

Unverified Commit e86803c1 authored by cketti's avatar cketti Committed by GitHub
Browse files

Merge pull request #7320 from thunderbird/extend_id_command

IMAP: Add app version to ID command
parents d41f015e 77ff16bc
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -10,6 +10,7 @@ import com.fsck.k9.mail.AuthType
import com.fsck.k9.mail.power.PowerManager
import com.fsck.k9.mail.ssl.TrustedSocketFactory
import com.fsck.k9.mail.store.imap.IdleRefreshManager
import com.fsck.k9.mail.store.imap.ImapClientId
import com.fsck.k9.mail.store.imap.ImapStore
import com.fsck.k9.mail.store.imap.ImapStoreConfig
import com.fsck.k9.mail.transport.smtp.SmtpTransport
@@ -19,6 +20,7 @@ import kotlinx.coroutines.flow.Flow
import kotlinx.coroutines.flow.distinctUntilChanged
import kotlinx.coroutines.flow.map

@Suppress("LongParameterList")
class ImapBackendFactory(
    private val accountManager: AccountManager,
    private val powerManager: PowerManager,
@@ -27,6 +29,7 @@ class ImapBackendFactory(
    private val trustedSocketFactory: TrustedSocketFactory,
    private val context: Context,
    private val clientIdAppName: String,
    private val clientIdAppVersion: String,
) : BackendFactory {
    override fun createBackend(account: Account): Backend {
        val accountName = account.displayName
@@ -71,7 +74,7 @@ class ImapBackendFactory(

            override fun isSubscribedFoldersOnly() = account.isSubscribedFoldersOnly

            override fun clientIdAppName() = clientIdAppName
            override fun clientId() = ImapClientId(appName = clientIdAppName, appVersion = clientIdAppVersion)
        }
    }

+2 −0
Original line number Diff line number Diff line
@@ -29,12 +29,14 @@ val backendsModule = module {
            trustedSocketFactory = get(),
            context = get(),
            clientIdAppName = get(named("ClientIdAppName")),
            clientIdAppVersion = get(named("ClientIdAppVersion")),
        )
    }
    single<SystemAlarmManager> { AndroidAlarmManager(context = get(), alarmManager = get()) }
    single<IdleRefreshManager> { BackendIdleRefreshManager(alarmManager = get()) }
    single { Pop3BackendFactory(get(), get()) }
    single(named("ClientIdAppName")) { BuildConfig.CLIENT_ID_APP_NAME }
    single(named("ClientIdAppVersion")) { BuildConfig.VERSION_NAME }
    single<OAuth2TokenProviderFactory> { RealOAuth2TokenProviderFactory(context = get()) }

    developmentModuleAdditions()
+1 −0
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@ val featureAccountServerValidationModule = module {
                trustedSocketFactory = get(),
                oAuth2TokenProviderFactory = get(),
                clientIdAppName = get(named("ClientIdAppName")),
                clientIdAppVersion = get(named("ClientIdAppVersion")),
            ),
            pop3Validator = Pop3ServerSettingsValidator(
                trustedSocketFactory = get(),
+1 −0
Original line number Diff line number Diff line
@@ -46,6 +46,7 @@ class ServerValidationModuleKtTest : KoinTest {
        single<LocalKeyStore> { mock() }
        factory<AccountCommonExternalContract.AccountStateLoader> { mock() }
        single(named("ClientIdAppName")) { "App Name" }
        single(named("ClientIdAppVersion")) { "App Version" }
    }

    @OptIn(KoinExperimentalAPI::class)
+6 −0
Original line number Diff line number Diff line
package com.fsck.k9.mail.store.imap

data class ImapClientId(
    val appName: String,
    val appVersion: String,
)
Loading