Commit graph

332 commits

Author SHA1 Message Date
cketti
d13352a4cd Use new SmtpResponseParser in SmtpTransport 2022-04-11 17:24:55 +02:00
cketti
a7562fe3f3 Add a new parser for SMTP responses 2022-04-11 17:24:55 +02:00
cketti
a11c993491 Add support for duplicate "charset" parameters with matching values 2022-03-11 01:54:17 +01:00
cketti
556188efcc Properly report progress when receiving multiple FETCH responses per message 2022-03-05 02:04:14 +01:00
cketti
9dd076686b Remove unnecessary/unused method parameters 2022-03-05 01:20:23 +01:00
cketti
4bed7a595b Remove unused method parameters 2022-02-24 19:56:50 +01:00
cketti
e59f57f602 Remove unused callbacks from MessageRetrievalListener 2022-02-24 19:42:01 +01:00
cketti
a4e1a77892 Switch to mockito-inline 2022-02-03 01:10:52 +01:00
cketti
251a221b3b Stop using AUTH without arguments (POP3)
At least one server software closes the connection right away after receiving the AUTH command without arguments. Since using the AUTH command without arguments never made it into a standard, I decided to completely remove this functionality.
2022-01-25 17:41:48 +01:00
parkerfath
722e6b923f
Change delimiter in address fields from ASCII 0 to 1 (#5863)
Fixes search by sender name.

Co-authored-by: Fath <fath@147dda1a2773.ant.amazon.com>
2022-01-14 19:40:28 +01:00
cketti
878400c15f Explicitly specify locale in case conversion or string formatting 2021-11-26 15:43:28 +01:00
Tobias Preuss
f0d3f371f0 Avoid leaking CountingOutputStream.
+ Affects com.fsck.k9.mail.filter.CountingOutputStream.
2021-11-23 09:45:05 +01:00
cketti
9861fc4d5a Take special care when decoding encoded words with charset ISO-2022-JP 2021-11-03 14:00:29 +01:00
cketti
94548c11a8 Convert DecoderUtil to Kotlin 2021-11-03 11:56:23 +01:00
cketti
abc2f263da Rename .java to .kt 2021-11-03 11:56:23 +01:00
cketti
61046ef0fd Update Mockito (Kotlin) to version 4.0.0 2021-10-30 05:32:51 +02:00
cketti
f564d0247c Merge branch '5.8-MAINT' into main 2021-08-30 21:13:42 +02:00
cketti
32aefc2795 Fix ServerSettings.isMissingCredentials
We support SMTP without authentication and in that case set the username to the empty string :(
2021-08-28 03:13:21 +02:00
cketti
6084321bde Update Kotlin to 1.5.30
Replace calls to deprecated stdlib functions
2021-08-26 17:44:49 +02:00
cketti
c2ae85e2ec Convert FormatFlowedHelper to Kotlin and change API 2021-08-22 17:04:16 +02:00
cketti
108cdfb327 Rename .java to .kt 2021-08-22 16:53:44 +02:00
cketti
9ee3a76ef1 Move format=flowed decoding to MessageExtractor 2021-08-22 16:20:15 +02:00
cketti
6c2f4b6354 Rename FlowedMessageUtils to FormatFlowedHelper 2021-08-22 15:46:26 +02:00
cketti
766cf838e0
Merge pull request #5578 from k9mail/ignore_chat_messages
Add setting to suppress notifications for chat messages
2021-08-21 21:26:45 +02:00
cketti
0ad8ce2c0d Fix check for missing incoming/outgoing server credentials 2021-08-19 23:09:39 +02:00
cketti
652d52b6a6 Add setting to suppress notifications for chat messages
Messages containing a 'Chat-Version' header field will not generate notifications when this setting is enabled.
2021-08-18 11:17:06 +02:00
cketti
7874fe7e11 Properly handle responses to the IDLE command
When waiting for the command continuation request response ignore irrelevant responses and keep track of relevant untagged responses.
2021-08-13 16:32:30 +02:00
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
cketti
2a3cc1d422 Don't pass charset to EncoderUtil.encodeEncodedWord() 2020-10-04 23:30:23 +02:00
cketti
267c658492 Only consider US-ASCII and UTF-8 in EncoderUtil.determineCharset() 2020-10-04 23:30:23 +02:00
cketti
357e197256 Remove remaining (non-working) 'androidTest' tests 2020-10-04 23:11:42 +02:00
cketti
0c97e2a4e0 Update Robolectric to 4.4
Replace usage of classes from transitive dependencies that are no longer available.
2020-09-18 03:14:46 +02:00
cketti
3211e3942c Show image previews even when wrong MIME type is used
More precisely, show image preview when the MIME type is application/octet-stream and the file extension maps to a supported image MIME type.
2020-09-09 12:16:03 +02:00
cketti
9234b16c13 Convert 'ImapSync' to Kotlin 2020-08-27 22:35:36 +02:00
Tobias Preuss
f8e6e59fd6 Use io extension functions to make code more concise.
+ This change replaces a few usages of BufferedWriter, ByteArrayInputStream,
  OutputStreamWriter with their equivalent Kotlin extension functions.
2020-08-24 19:22:29 +02:00
Tobias Preuss
9c6d08142a Infer type. 2020-07-08 13:58:23 +02:00
cketti
e42e0fa8b9 IMAP: Support negative responses to APPEND command 2020-06-19 18:55:04 +02:00
cketti
dc119f9068 Convert 'ImapFolder' to Kotlin 2020-06-18 14:44:26 +02:00
cketti
be7849eb5d Rename 'ImapFolder' prior to conversion to Kotlin 2020-06-18 14:44:22 +02:00
cketti
84ffe7b3cd Convert 'ImapFolderTest' to Kotlin 2020-06-18 14:44:20 +02:00
cketti
3d97acde5c Rename 'ImapFolderTest' prior to conversion to Kotlin 2020-06-18 14:44:18 +02:00
cketti
4b8d6bf50c Replace 'blacklisted' with 'disallowed' 2020-06-02 17:15:51 +02:00
cketti
4e2ae11238 Don't select charset depending on the recipient address
It's 2020. We now always use UTF-8 for outgoing emails.
2020-05-27 03:07:29 +02:00
cketti
789769ef39 Replace Account.getOutboxFolder() with Account.getOutboxFolderId() 2020-05-04 16:31:00 +02:00
cketti
767f7e0efe Remove StoreConfig 2020-05-01 05:42:50 +02:00
cketti
02049c5882 Create DraftsFolderProvider 2020-05-01 05:38:37 +02:00
cketti
82db38bd08 Create ImapStoreConfig 2020-05-01 05:30:34 +02:00
cketti
a6f75dc587 Remove StoreConfig.getMaximumAutoDownloadMessageSize() 2020-05-01 05:15:51 +02:00
cketti
d7d1fe0c0e Remove StoreConfig.isRemoteSearchFullText() 2020-05-01 04:18:16 +02:00
cketti
1858986fc4 Remove StoreConfig.isAllowRemoteSearch() 2020-05-01 04:03:02 +02:00
cketti
88bcea1552 Remove StoreConfig.getOutboxFolder() 2020-05-01 03:36:42 +02:00
cketti
fcfc7e6a22 Remove unused method StoreConfig.getInboxFolder() 2020-05-01 03:31:11 +02:00
cketti
94489bf55a Change List<? extends Message> to List<Message> where appropriate 2020-04-27 18:37:10 +02:00
cketti
7ac210956a Change List<? extends Message> to List<WebDavMessage> where appropriate 2020-04-27 18:37:10 +02:00
cketti
db7760a9e2 Change List<? extends Message> to List<Pop3Message> where appropriate 2020-04-27 18:37:10 +02:00
cketti
d3bdebccf3 Change List<? extends Message> to List<ImapMessage> where appropriate 2020-04-27 18:37:10 +02:00
cketti
8abac750af Make ImapStore.getFolders() return the proper server ID 2020-04-24 22:00:10 +02:00
cketti
37eea88f82 Refactor ImapStore.getPersonalNamespaces() 2020-04-24 20:33:22 +02:00
cketti
d70564e423 Remove unused code 2020-04-18 19:51:48 +02:00
cketti
a44732ee38 Remove FolderClass.NONE
Rewrite entries in the database to use FolderClass.NO_CLASS
2020-04-08 19:33:03 +02:00
cketti
61f3f06ba7
Merge pull request #4641 from k9mail/remove_old_push_code
Remove old push code
2020-04-06 19:21:53 +02:00
cketti
2a78418911 Remove old Push code 2020-04-05 20:08:29 +02:00
cketti
59630fb13b Change appearance of attachment boxes in message compose screen 2020-04-05 03:40:24 +02:00
cketti
68213ac717
Merge pull request #4634 from k9mail/uidvalidity
IMAP: Clear local message cache when UIDVALIDITY value changes
2020-04-02 21:45:03 +02:00
cketti
0554dfcd04 Clear local message cache when UIDVALIDITY value changes 2020-03-31 22:20:46 +02:00
cketti
5791253122 Add support for UIDVALIDITY to ImapFolder 2020-03-31 16:42:38 +02:00
cketti
f1b73a11b9 Convert 'MessageIdGeneratorTest' to Kotlin 2020-03-29 22:24:11 +02:00
cketti
576696e87e Change fallback hostname for Message-ID to "fallback.k9mail.app" 2020-03-29 22:14:00 +02:00
cketti
ab0aae46c4 Extract interface for UUID generation 2020-03-29 22:10:20 +02:00
cketti
9ef845fda5 Convert 'MessageIdGenerator' to Kotlin 2020-03-29 22:00:03 +02:00
cketti
c71b1f0699 WIP: Renaming file 'MessageIdGenerator' with Kotlin extension 2020-03-29 21:49:11 +02:00
cketti
cfed7b0c08 Don't use android.net.MailTo in ListHeaders 2020-03-28 21:57:04 +01:00
cketti
b0aa07aef9 Move MailTo class to :mail:common module 2020-03-28 21:39:04 +01:00
cketti
982013ded4 Make sure Part.getMimeType() returns a valid MIME type 2020-03-24 02:29:01 +01:00
cketti
7918ffad85 Add MimeType class 2020-03-24 01:53:06 +01:00
cketti
c4ab630161 Remove 'androidTest' tests
We don't regularly run them and most of them don't even compile anymore.
2020-03-11 18:01:41 +01:00
cketti
e4cc7b9a91
Merge pull request #4575 from k9mail/MimeMessage_setReplyTo
Use AddressHeaderBuilder for MimeMessage.setReplyTo()
2020-03-02 14:33:49 +01:00
cketti
4325509d43 Use AddressHeaderBuilder for MimeMessage.setReplyTo() 2020-02-29 22:50:07 +01:00
cketti
916015b1f0 Convert 'MimeHeader' to Kotlin 2020-02-29 21:29:46 +01:00
cketti
21891f1d1d WIP: Renaming file 'MimeHeader' with Kotlin extension 2020-02-29 18:27:13 +01:00
cketti
eccf4738b6 Get rid of 'm' prefix in MimeHeader fields 2020-02-29 18:26:18 +01:00
cketti
2333899afb We no longer need MimeHeader to implement Cloneable 2020-02-29 18:24:04 +01:00
cketti
ab7feffa68 Add JMAP message sync (part 1)
This only supports doing a full sync and downloading complete messages.
2020-02-12 19:12:11 +01:00
cketti
58f32df670 Remove now unused class 'Folder' 2020-01-28 16:22:09 +01:00
cketti
35da218170 Make WebDavFolder no longer extend Folder
This highlighted that a bunch of code in backend-webdav was unused.
2020-01-28 16:22:09 +01:00
cketti
579027e66c Make Pop3Folder no longer extend Folder
This highlighted that a bunch of code in backend-pop3 was unused.
2020-01-26 23:35:25 +01:00
cketti
76bc52beef Make ImapFolder no longer extend Folder 2020-01-26 23:35:25 +01:00
cketti
9335080545 Get rid of common base class RemoteStore
This also allows removing some unnecessary methods in former subclasses.
2020-01-26 05:16:01 +01:00
cketti
0b21a7521d Add JMAP folder sync 2020-01-15 16:14:16 +01:00
cketti
2d470c73a0 Move FolderType and FolderClass out of Folder 2020-01-09 14:08:41 +01:00
cketti
83ad4197b8 Remove unused code from Folder 2020-01-09 14:08:41 +01:00
cketti
13bc16caf8 Remove Message.getFolder() 2020-01-08 23:30:03 +01:00
cketti
aa13a46e3e Don't pass Folder instance to PushReceiver 2019-12-18 01:05:28 +01:00
cketti
079d166ce6 Convert 'EncoderUtilTest' to Kotlin 2019-12-12 00:10:00 +01:00
Bastian Wilhelm
7a8a67ea25 Make sure encoded word encoding doesn't split surrogate pairs 2019-12-11 23:04:54 +01:00
cketti
93d0e14b68 Fix code style issues found by ktlint 2019-11-29 13:44:00 +01:00
cketti
88d863c4c2 Add ktlint and Kotlin code style settings for Android Studio 2019-11-29 13:39:16 +01:00
cketti
d4def08551 Filter duplicate folder names in IMAP LIST response 2019-11-19 23:15:31 +01:00
cketti
6325e4deea Remove now unused code in 'DefaultTrustedSocketFactory' 2019-11-19 15:06:53 +01:00
cketti
57ff989edd Add kotlinOptions.jvmTarget to Gradle projects using Kotlin 2019-11-17 14:45:05 +01:00
cketti
b241201e88 Fix check for invalid IMAP capability response 2019-11-15 14:37:47 +01:00