Commit graph

259 commits

Author SHA1 Message Date
Michael Gratton
0ae633d88f Update existing tests to work with ValaUnit 2020-06-30 17:31:07 +10:00
Chris Heywood
71262f0e79 Merge branch 'mainline' into remove-old-msgs-beyond-storage-pref 2020-05-17 12:03:30 +10:00
Michael Gratton
c54ff85ccd Geary.RFC822.Message: Update API for SMTP formatting
Remove `Message.without_bcc` ctor since we can now get GMime to exclude
BCC headers when serialising, avoiding the overhead of taking a complete
copy of the message just to strip BCCs.

Rename `get_network_buffer` to `get_rfc822_buffer` to be a bit more
explicit in that's the way to get an actual RFC822 formatted message.
Replace book args with flags, and take a protocol-specific approach
rather than feature-specific, because in the end you're either going to
want all the SMTP formatting quirks or none of them.

Remove custom dot-stuffing support from Smtp.ClientConnection, since it
is redundant.
2020-05-06 14:58:56 +10:00
Michael Gratton
26e76b6f4d Geary.RFC822Error: Rename so it's actually in the RFC822 namespace 2020-05-06 14:58:56 +10:00
Michael Gratton
288c78a93a Geary.RFC822.Message: Rework constructors and stocking from GMimeMessage
Make constructors use the Message.from_gmime where possible. Merge that
and stock_from_gmime so it's clear the stocking only happens in the
ctor. Update stocking to use high-level GMime APIs where available to
avoid re-parsing header values.
2020-05-06 14:58:56 +10:00
Michael Gratton
6e7631b8d3 Geary.RFC822: Clean up message data interfaces and classes
Split Geary.RFC822.MessageData interface up into DecodedMessageData and
EncodedMessageData so the difference between the two is clear and they
can't be used interchangeably.

Add `DecodedMessageData::to_rfc822_string` to provide a common interface
for round-tripping decoded data.

Update all classes to implement one of these and follow the same general
API patterns.
2020-05-06 14:58:56 +10:00
Michael Gratton
5b253cbee6 Geary.RFC822.MessageIdList: Update API to match MailboxAddresses
Make immutable, provide similar properties and accessors as
MailboxAddresses.
2020-05-06 14:58:56 +10:00
Michael Gratton
940781a379 test/engine: Make RFC822 tests use their own subdirectory
Ensures they match the same source layout as in the engine.
2020-05-06 14:58:56 +10:00
Michael Gratton
e0c1fb8a80 Geary.RFC822: Ensure various data constructors throw errors
Rather than just silently ignoring error conditions, throw RFC822
errors instead.
2020-05-06 14:58:56 +10:00
Michael Gratton
6d5f63692b Geary.Mime.ContentType: Rename ::deserialise to ::parse
Add unit tests.
2020-05-05 21:57:17 +10:00
Chris Heywood
4ff783b231 Merge branch 'mainline' into remove-old-msgs-beyond-storage-pref 2020-04-30 18:08:19 +10:00
Michael Gratton
991c9ef5d7 Geary.App.ConversationMonitor: Fix more races when starting/stopping
Ensure that if stopping the conversation monitor while it is waiting
for the folder to open that the folder isn't closed, and if an error
is thrown when opening the folder that it gets thrown by
::start_monitoring anyway.

Hopefully fixes #741
2020-04-24 15:30:04 +10:00
Michael Gratton
81a22175ab Geary.FolderMock: Convert to use new async mock calls. 2020-04-24 15:22:55 +10:00
Michael Gratton
48ed8d9fe3 Geary.Account: Support creating folders in the personal name space
Add `create_personal_folder` method, implement it in
ImapEngine.GenericAccount. Use this when creating required special
folders to reduce code duplication.
2020-04-23 09:35:19 +10:00
Michael Gratton
e22d74db4b Geary.Folder: Add SpecialUse.CUSTOM and set_used_as_custom method
Support applications setting custom special uses for folders.
2020-04-18 18:37:35 +10:00
Michael Gratton
c98efafb28 Fix failing test after test case async changes 2020-04-10 14:29:20 +10:00
Michael Gratton
196f05e595 test/test-case.vala: Rename TestCase async calls to match AsyncCallWaiter's 2020-04-10 12:58:09 +10:00
Michael Gratton
8dcab7f306 Geary.SpecialFolderType: Rename class and related properties, signals
The `SpecialFolderType` was somewhat mis-named, since the special use
does not (in most cases) confer any special type, rather it's simply
defines what a particular folder is used /for/.

As such, rename the enum to to `Geary.Folder.SpecialUse`, moving it in
to the `Folder` class, since it relates specifically to folders, also
rename `Folder::special_folder_type` and
`Folder::special_folder_type_changed` reflect the above and not
duplicate the type name, and similarly rename
`Account::folders_special_type`.

Update the many call sites.
2020-03-31 16:15:57 +11:00
Michael Gratton
32acff51b8 Geary.SpecialFolderType: Rename SPAM to JUNK
The latter is more general as it can also be used for malware, etc,
and less evocative of processed pig products.
2020-03-31 15:37:38 +11:00
Michael Gratton
297a59ca80 Merge branch 'mjog/imap-connection-fixes' into 'mainline'
IMAP connection fixes

See merge request GNOME/geary!479
2020-03-30 11:35:18 +00:00
Michael Gratton
2eb597fec1 Geary.RFC822.Message: Always re-determine the encoding for body parts
When attaching body parts to a message from a composed email, don't
re-use the transfer encoding used from the plain part for the HTML part,
since the latter may be different if e.g. the HTML contains no line
breaks and hence is a single long line.

See #771
2020-03-29 16:29:30 +11:00
Michael Gratton
f3c02c7800 Geary.RFC822.Utils: Ensure best encoding/charset not missing data
By not closing/flushing the buffer, ::get_best_charset and
::get_best_encoding were not including the last line of the buffer, and
missing single very long lines when guessing the encoding.

Fixes #771
2020-03-29 16:24:58 +11:00
Michael Gratton
42152d00ba Geary.RFC822.Message: Work around long HTML lines exceeding SMTP max len 2020-03-29 09:51:17 +11:00
Michael Gratton
b53d5b2470 Simply Geary.Imap.ClientService selected mailbox handling
Convert mailbox and mailbox RW/RO state accessors to properties and
rename to be more explicit about what they mean. Remove mailbox arg
from ::getProtocolState() since it's unused.
2020-03-27 08:29:14 +11:00
Michael Gratton
9e01d8dca0 Remove Geary.Imap.ClientSession::server-data-received signal
This was only being used internally, and it leaks low level details out
of the mid-level abstraction.
2020-03-27 08:29:14 +11:00
Michael Gratton
7ac72379bb Update Geary.Imap.ClientSession namespace handling
Add namespace accessors, handle updating namespaces when processing
the received data, not when executing the command so that unsolicited
namespaces are still recognised. Clear namespaces when new data is
receieved and when not in selected and auth states. Add unit tests.
2020-03-27 08:29:14 +11:00
Michael Gratton
b46838f100 Update Geary.Imap.Capabilities handling
Move Capabilities to the api directory and make immutable.

Don't pass around out params to simply increment the revision and use a
field in ClientSession, just use the last capability instance. Ensure
after starting a TLS session capabilities are cleared. Add unit tests
for getting both implicit and explicity capaibilities when initiating
a client session.
2020-03-27 08:29:14 +11:00
Michael Gratton
13d43d41b2 Update Geary.Imap.ClientSession connect timeout handling
Allow specifying the connect greeting timeout length, ensure that
any connect errors are in place before releasing the connect waiter,
add unit test to ensure it works properly.
2020-03-27 08:29:14 +11:00
Michael Gratton
54156003b4 Add TestCase.assert_double 2020-03-27 08:29:14 +11:00
Michael Gratton
62f1df12cb Rework Geary.Imap.ClientConnection signal and error handling
Remove connect, disconnect and close_error signals, since they are
implied by their respective methods completing and/or throwing an
error. Remove Deserializer pass-through signals, treat all three kinds
as generic receive errors instead.

Make Deserializer emit end-of-stream signal only on EOS, not on EOS and
on receive error, so it only signals an error condition once.
2020-03-27 08:29:14 +11:00
Michael Gratton
7e77133bda Update Geary.Imap.Command API
Make the class abstract, since it only gets used by subclases. Allow
a null cancellable when waiting for the command to complete.
2020-03-27 08:29:14 +11:00
Michael Gratton
339d8ae26e Add unit test for Geary.Imap.ClientSession 2020-03-27 08:29:14 +11:00
Michael Gratton
95c1916abf Add unit test for Geary.Imap.ClientConnection 2020-03-27 08:29:14 +11:00
Michael Gratton
fe760ff40a Geary.RFC822.Message: Fix Message-Id header not being set
The port to GMime 3 missed setting the Message-Id header on the
underlying GMime Message object when constructing a message, from a
ComposedEmail, so this was not getting set on outoging email.

Fixes #758
2020-03-25 14:05:23 +11:00
Chris Heywood
01e114f09a Fix detach_emails_before_timestamp test case
That's ImapDB.Folder::detach_emails_before_timestamp, fixed
and enabled.
2020-02-10 16:04:13 +01:00
Chris Heywood
e7d3b46b37 Temporarily disable test 2020-01-22 12:19:16 +01:00
Chris Heywood
150417727e Test case for detach_emails_before_timestamp
ie. ImapDB.Folder::detach_emails_before_timestamp.
2020-01-22 10:23:13 +01:00
Chris Heywood
4875b66485 Bump schema version in database test case 2020-01-21 18:22:11 +01:00
Chris Heywood
f60c42a36b More explicit class identification 2020-01-09 14:08:46 +01:00
Chris Heywood
7dfe2971c6 Rename and improve doc. on method 2020-01-09 13:07:17 +01:00
Chris Heywood
5d53bbec26 Merge branch 'mainline' into remove-old-msgs-beyond-storage-pref 2020-01-08 14:43:52 +01:00
Chris Heywood
609ee01e3e Trigger idle cleanup per account when backgrounded
Also handle continuation of cleanup after old messages have been
detached. Flagged vacuuming is performed even when the cleanup
interval hasn't been reached. The tracking of last background
cleanup time in Account.Information is possibly temporary and isn't
yet persisted.
2020-01-08 14:08:52 +01:00
Michael Gratton
b08cee7883 Fix build warning. 2019-12-21 18:31:03 +11:00
Torben
77d44d41a3 Merge branch 'mainline' into letorbi/gmime-3 2019-12-18 11:38:02 +01:00
Michael Gratton
cc0fb9eef2 Remove unused Geary.Folder::list_local_email_fields_async method 2019-12-18 09:25:07 +11:00
Michael Gratton
dda8d9baf1 Remove distinct search folder email identifiers
The only reason SearchFolder.EmailIdentifier exists was to store the
date for ordering the folder, but that can be done with any old class,
meaning we can simply pass though existing ImapDb ids to clients, fixing
a lot of bugs and corner cases along the way.
2019-12-18 09:25:07 +11:00
Torben
7da9ee1252 Fix undefined variable error 2019-12-17 13:41:35 +01:00
Torben
ca2bab0338 Re-activate and improve prepare_header_text_part() test 2019-12-17 13:23:28 +01:00
Torben
c0e8f717e8 Allow addresses without domains (fixes disabled mailbox-addresses-test) 2019-12-16 00:34:30 +01:00
Torben
82c2b36c6e Make mailbox-address tests pass 2019-12-14 00:04:03 +01:00