Commit graph

205 commits

Author SHA1 Message Date
cketti
03caacc1a7 Make RealImapConnection (somewhat) thread-safe 2021-07-13 16:01:24 +02:00
cketti
5232a1a962 Ignore IOExceptions when sending DONE (Push)
Errors with the connection are dealt with in the receiver thread.
2021-07-13 15:09:09 +02:00
cketti
d96641d7a0 Remove optimization to reduce the number of times a wakelock is acquired
ImapConnection.isDataAvailable() didn't reliably work on all devices (returned true when no complete IMAP response was available). This lead to situations where a wakelock was being held the whole time the IDLE command was active. At the same time no alarm was set to refresh the IDLE connection. So most of the time the blocking read would time out.
2021-07-09 18:06:13 +02:00
cketti
152424b20c Add a way to close all open IMAP connections
Use a "connection generation" value to mark all connections that have been created since the last closeAllConnections() call. Using that value we can recognize "old" connections that have not been in the connection pool at the time closeAllConnections() was called. We close them as soon as they are passed to releaseConnection().
2021-07-03 20:04:05 +02:00
cketti
ebbe02c057 Add ImapPushConfigProvider 2021-06-23 15:34:31 +02:00
cketti
aa9f6eaefa Add IdleRefreshTimeoutProvider 2021-06-23 14:02:07 +02:00
cketti
ca13a32fec Add ImapFolderPusher to listen for changes to an IMAP folder 2021-06-12 21:09:30 +02:00
cketti
db2b9c746f Add ImapFolderIdler that uses IMAP's IDLE command to listen for changes 2021-06-10 21:40:36 +02:00
cketti
63d9872755 Introduce additional interfaces so RealImapFolder is decoupled from RealImapStore 2021-06-10 21:00:58 +02:00
cketti
94f630cf88 Introduce ImapStore interface 2021-06-10 21:00:58 +02:00
cketti
55c54555ff Introduce ImapFolder interface 2021-06-09 16:15:12 +02:00
cketti
d0fa865e1f Rename ImapFolder.kt to RealImapFolder.kt 2021-06-09 16:15:12 +02:00
cketti
ededa33ff2 Use enum class for ImapFolder.open() argument 2021-06-09 16:15:12 +02:00
cketti
3041a787d6 Introduce ImapConnection interface
The implementation is now called RealImapConnection.
2021-06-09 16:15:12 +02:00
cketti
4a65c5b4a0 Improve logging in MessageExtractor.getTextFromPart() 2021-06-02 00:49:23 +02:00
cketti
45a7942202
Merge pull request #5294 from k9mail/ImapFolder_fixes 2021-05-11 19:58:31 +02:00
cketti
d5c8c35fec Remove ImapFolder caching
The cache was causing problems when a folder was accessed in two threads at the same time. There was also no invalidation mechanism that removed folders that had been removed from the server.

The easy fix is to get rid of this cache. There's no state in ImapFolder that survives closing the folder anyway.
2021-05-10 17:47:54 +02:00
cketti
d25d451201 Remove unused ImapFolder properties 2021-05-10 01:32:04 +02:00
cketti
769d658e5a Correctly persist message download state
Add the flag X_DOWNLOADED_FULL when the message has been downloaded completely, the flag X_DOWNLOADED_PARTIAL when only the text of a message has been downloaded, and set no additional flag when only the envelope and structure of the message has been downloaded. The latter happens when we fetch remote search results.
2021-05-10 00:47:27 +02:00
cketti
5444d8be3a Remove explicit dependency on Kotlin's standard library 2021-04-22 03:54:15 +02:00
cketti
632d8f3cb7 Upgrade Mockito-Kotlin to 3.1.0 2021-04-22 03:54:15 +02:00
cketti
428ae60a58 Split Backend.fetchMessage() into two methods
The two new methods now also save the downloaded message data instead of returning a Message instance.
MessageStore.saveRemoteMessage() will now replace a message if it already exists.
2021-04-17 00:04:58 +02:00
cketti
4e4babeea6 Change K9BackendFolder.saveMessage() to use MessageStore 2021-04-15 01:19:18 +02:00
cketti
24f55ee03e Add test for RetrieveMessageOperations.getHeaders() 2021-04-01 01:32:46 +02:00
cketti
0e1ff7d6b1 Remove LocalKeyStore's dependency on Android's Context
And lazily initialize the KeyStore so we're not doing any work when the instance is created.
2021-03-30 22:08:06 +02:00
cketti
bb1c9c32be Convert 'LocalKeyStore' to Kotlin 2021-03-30 22:06:12 +02:00
cketti
ac0a2525f7 Rename .java to .kt 2021-03-30 21:34:28 +02:00
cketti
f47862d789 Add tests for LocalKeyStore 2021-03-30 21:34:28 +02:00
cketti
00f13c0c8e Pass keystore directory as File instance to LocalKeyStore 2021-03-30 20:03:13 +02:00
mehdisadeghi
a0b160c7cd
Add support for In-Reply-To parameter in mailto: URIs (#5194) 2021-03-09 15:32:30 +01:00
cketti
a205920510 Add 'MessageIdParser'
Can be used to parse the value of 'Message-ID', 'In-Reply-To', and 'References' header fields.
2021-03-05 18:45:21 +01:00
cketti
06de64cd2c Make MessageHeaderParser more flexible 2021-02-20 13:28:15 +01:00
cketti
33d06a5ac9 Convert 'MessageHeaderParser' to Kotlin 2021-02-18 17:49:23 +01:00
cketti
224d56526e Rename .java to .kt 2021-02-18 17:49:22 +01:00
cketti
987325d226 SMTP: Read all responses before issuing DATA command 2021-02-16 13:34:46 +01:00
cketti
1f2404557b Migrate storeUri/transportUri to new server settings format 2021-02-01 17:30:21 +01:00
cketti
08d6d9bebc Delete remaining store/transport URI functionality 2021-02-01 17:30:21 +01:00
cketti
69ed32ff8a Convert 'ServerSettings' to Kotlin 2021-02-01 10:39:19 +01:00
cketti
2338381de1 Rename .java to .kt 2021-01-31 18:50:14 +01:00
cketti
1ebc487b56 Don't use custom ServerSettings subclass in SettingsImporter 2021-01-31 18:50:14 +01:00
cketti
97051f3f7c Make WebDavStore use ServerSettings directly
Instead of using WebDavStoreSettings as a ServerSettings subclass make it a helper to extract WebDav-specific settings.
2021-01-31 18:50:14 +01:00
cketti
42e180d6fa Make ImapStore use ServerSettings directly
Instead of using ImapStoreSettings as a ServerSettings subclass make it a helper to extract IMAP-specific settings.
2021-01-31 18:50:14 +01:00
cketti
7ae88bb61d Treat FolderNotFoundException as permanent error 2020-12-23 01:23:24 +01:00
cketti
1873593dc5 Format Kotlin code 2020-10-16 16:41:19 +02:00
cketti
ed8009d9fa Update ktlint-gradle to 9.4.1, ktlint to 0.39.0
Apply ktlint-gradle plugin to all Gradle subprojects.
2020-10-16 14:27:23 +02:00
cketti
5bc7ac3901 When constructing new messages check header values 2020-10-13 03:29:20 +02:00
cketti
8663bbb5b9 Check (unstructured) header field syntax when adding them to MimeHeader 2020-10-13 03:29:20 +02:00
cketti
fac346009a Only pass encoded headers to MimeHeader
Remove code to encode header values from from MimeHeader.writeTo()
2020-10-11 02:28:36 +02:00
cketti
3b7c5ea10f Display message headers in the original order 2020-10-08 16:16:50 +02:00
cketti
3c0d9b99f9 Remove unused Message.setCharset() mechanism 2020-10-04 23:33:31 +02:00