forked from thunderbird/thunderbird-android
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
124 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
plugins { | ||
id(ThunderbirdPlugins.Library.jvm) | ||
alias(libs.plugins.android.lint) | ||
} | ||
|
||
dependencies { | ||
api(projects.feature.autodiscovery.api) | ||
} |
46 changes: 46 additions & 0 deletions
46
...ure/autodiscovery/demo/src/main/kotlin/app/k9mail/autodiscovery/demo/DemoAutoDiscovery.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
package app.k9mail.autodiscovery.demo | ||
|
||
import app.k9mail.autodiscovery.api.AutoDiscovery | ||
import app.k9mail.autodiscovery.api.AutoDiscoveryResult | ||
import app.k9mail.autodiscovery.api.AutoDiscoveryRunnable | ||
import app.k9mail.autodiscovery.api.IncomingServerSettings | ||
import app.k9mail.autodiscovery.api.OutgoingServerSettings | ||
import app.k9mail.core.common.mail.EmailAddress | ||
import app.k9mail.core.common.mail.toDomain | ||
import com.fsck.k9.mail.AuthType | ||
import com.fsck.k9.mail.ConnectionSecurity | ||
import com.fsck.k9.mail.ServerSettings | ||
|
||
class DemoAutoDiscovery : AutoDiscovery { | ||
override fun initDiscovery(email: EmailAddress): List<AutoDiscoveryRunnable> { | ||
val domain = email.domain.toDomain() | ||
|
||
return listOf( | ||
AutoDiscoveryRunnable { | ||
if (domain.value == "example.com") { | ||
AutoDiscoveryResult.Settings( | ||
incomingServerSettings = DemoServerSettings, | ||
outgoingServerSettings = DemoServerSettings, | ||
isTrusted = true, | ||
source = "DemoAutoDiscovery", | ||
) | ||
} else { | ||
AutoDiscoveryResult.NoUsableSettingsFound | ||
} | ||
}, | ||
) | ||
} | ||
} | ||
|
||
object DemoServerSettings : IncomingServerSettings, OutgoingServerSettings { | ||
val serverSettings = ServerSettings( | ||
type = "demo", | ||
host = "irrelevant", | ||
port = 23, | ||
connectionSecurity = ConnectionSecurity.SSL_TLS_REQUIRED, | ||
authenticationType = AuthType.AUTOMATIC, | ||
username = "irrelevant", | ||
password = "irrelevant", | ||
clientCertificateAlias = null, | ||
) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters