Commit graph

1759 commits

Author SHA1 Message Date
Michael Gratton
bf4f5c4780 Fix GenericAccount::to_email_identifier not actually working
The GVariant type "*" only matches a single data type, not many, and
the sense of the test to check serialised ids was wrong anyway. As a
reuslt, this method probably never worked. Add a unit test.
2019-10-30 14:12:52 +11:00
Michael Gratton
737bdba158 Merge branch 'mjog/571-imap-fetch-space-workaround-redux' into 'mainline'
IMAP body part fetch space workaround redux

Closes #571

See merge request GNOME/geary!342
2019-10-26 05:24:03 +00:00
Michael Gratton
12d0cced35 Use SQL UPSERT clause when updating contacts
This saves a round trip in the common case of a contact already
existing. Requires SQLite 3.24 at a minimum, so bump it in meson.build.
2019-10-26 15:49:34 +11:00
Michael Gratton
0cf5ab734b Merge contacts when harvesting them
Now that ContactStore no longer merges contacts, do so in the harvester.
2019-10-25 14:54:53 +11:00
Michael Gratton
0c563cf101 Fix ContactStoreImpl not saving flags removed from a contact
Don't try to merge contacts, just assume the updated contact passed in
is canonical.
2019-10-25 14:53:59 +11:00
Michael Gratton
ab77067d8a Fix RFC822.Header.get_header_names returning null names
The custom GMime VAPI assumed the call to get_iter() actually returned a
new iter, but it doesn't. Fix that, update Header class style, and add
tests.
2019-10-22 17:20:52 +11:00
Michael Gratton
8cd310bea1 Extend the IMAP FETCH HEADER.FIELDS hack for multiple fields
The same servers that do not support SP in a IMAP FETCH HEADER.FIELD
command (e.g. `BODY[HEADER.FIELDS (DATE)]`) does not support SP when
requesting multiple headers, either
(e.g. `BODY[HEADER.FIELDS (DATE SUBJECT)]`).

This patch extends the existing hack (see #410) when enabled and
multiple headers are required to send a seperate command for each,
rather than using a list as above.

Fixes #571
2019-10-22 17:20:52 +11:00
Michael Gratton
7bac77df7b Fix segfault on invalid UTF-8 when generating preview 2019-10-22 13:07:27 +11:00
Michael Gratton
cef0aeee5c Merge branch 'mjog/579-logging-deadlock' into 'mainline'
Fix deadlock when finalising log records generates more logging

Closes #579

See merge request GNOME/geary!320
2019-10-01 01:43:47 +00:00
Michael Gratton
bfb1186a9c Merge branch 'mjog/draft-manager-warnings' into 'mainline'
Remove unused functions

See merge request GNOME/geary!323
2019-09-29 02:55:58 +00:00
Michael Gratton
c00f644e5e Remove unused functions 2019-09-29 12:31:51 +10:00
Michael Gratton
e5b239464b Fix deadlock when finalising log records generates more logging
Make sure records are finalised outside the record lock, and minimise
the amount of work that happens inside the record lock in general, so
that no extra logging occurs whilst in inside it, leading to a deadlock.

Fixes #579
2019-09-29 12:25:45 +10:00
Michael Gratton
6ddbf039a8 Merge branch 'mjog/581-crash-forwarding-mail' into 'mainline'
Don't crash on GMime error in RFC822.Message.without_bcc

See merge request GNOME/geary!319
2019-09-28 12:33:24 +00:00
Michael Gratton
1308fcba90 Don't crash on GMime error in RFC822.Message.without_bcc
Reporting an error is hardly useful on the SMTP delivery code path.

Fixes crash in #581
2019-09-28 21:36:32 +10:00
Michael Gratton
7ddeb8d7a6 Fix an assertion failing when saving a draft for the first time
Introduced by !297
2019-09-28 20:56:36 +10:00
Michael Gratton
af2915707d Consistently use '..._c_args' and '..._vala_args' for meson vars 2019-09-27 23:56:52 +10:00
Michael Gratton
1ea567821c Merge branch 'wip/76-gmail-drafts' into 'mainline'
Don't support removing an email when creating another

Closes #76

See merge request GNOME/geary!279
2019-09-25 11:54:42 +00:00
Michael Gratton
ab941fe61f Retry IMAP pool connections on GLib "Unknown error on connect"
Work around for GNOME/glib#1872 by waiting a second and retying when a
G_IO_ERROR_FAILED is received.

Revert this when that bug is fixed.

See #561
2019-09-10 22:42:21 +10:00
Michael Gratton
97ff689bd1 Decouple account processor closing and its op cancellables
By using a single cancellable for both managing the running state of
the AccountProcessor and its operations, if an op cancelled its own
cancellable, it would also stop the processor (and if it didn't, also
pre-cancel andy future ops).

Fix this by decopling processor running state from the operation
cancellables, and use a new cancellable for each operation.
2019-09-06 22:15:07 +10:00
Michael Gratton
9dcde70298 Fix background sync op always being cancelled on folder close
Unset the op's close cancellable before closing the folder so the wait
for the folder to close is not cancelled.
2019-09-06 22:12:57 +10:00
Michael Gratton
4b84616d82 Write literal data in chunks when sending to server
By splitting literal writes into apprpriately sized chunks, the
command's response timer can be updated so that the command doesn't
fail due to a timeout as large values are being sent.

Fixes #543
2019-08-29 23:27:22 +10:00
Michael Gratton
4c56ff3436 Convert Imap.Serialiser.push_literal_data to take generic param
Rather than taking a Literal argument, take a data array instead. This
allows more flexibility in sending literal data to the server.
2019-08-29 23:24:34 +10:00
Michael Gratton
d450e8a394 Clean up Imap.LiteralCommand API
Expose value buffer as a RO property, remove redundant method calls,
fix call sites.
2019-08-29 23:23:19 +10:00
Michael Gratton
b9cbe81e12 Merge branch 'wip/christopherdavis/dual-install' into 'mainline'
build: Set up dual install for flatpak

See merge request GNOME/geary!229
2019-08-28 09:10:14 +00:00
Michael Gratton
942a4fa64f Don't support removing an email when creating another
Remove the `id` param from FolderSupport.Create::create_email_async.
Fix up all implementations and call sites. Update App.DraftManager to
explicitly handle removing the old draft after creating the new one.

This ensures the custom folder delete support gets used and in
particular, ensures that old drafts under Gmail disappear ASAP.

Fixes #76
2019-08-28 18:21:21 +10:00
Michael Gratton
f6e97db5b5 Merge branch 'wip/imap-disconnects-ignored' into 'mainline'
IMAP disconnects ignored

See merge request GNOME/geary!292
2019-08-28 07:53:45 +00:00
Michael Gratton
81e566a78f Merge branch 'wip/131-sent-mail' into 'mainline'
Sent mail not immediately showing up in a conversation

Closes #131

See merge request GNOME/geary!281
2019-08-28 01:22:59 +00:00
Michael Gratton
8cb0cdcfa6 Merge branch 'wip/prefetcher-missing-mail' into 'mainline'
Fix prefetcher missing mail on folder open

See merge request GNOME/geary!294
2019-08-28 00:42:08 +00:00
Michael Gratton
df3e273cc5 Merge branch 'wip/minor-cleanup' into 'mainline'
Minor code cleanup

See merge request GNOME/geary!293
2019-08-28 00:22:01 +00:00
Michael Gratton
5fc0ddfd9b Clean up EmailPrefetcher's class API docs a bit 2019-08-28 10:18:59 +10:00
Michael Gratton
0c59a8c4a3 Ensure EmailPrefetcher's cancellable actually gets cancelled 2019-08-28 10:18:31 +10:00
Michael Gratton
f4aeac5584 Ensure EmailPrefetecher doesn't ignore mail found on folder open
EmailPrefetecher was deliberately ignoring new mail found during
folder normalisation on folder open to avoid the kind of deadlock
solved by the last commit. Since this is no longer a problem, it can
now stop dropping those.

This should fix a number of issues where email is only partly
downloaded.
2019-08-28 10:13:10 +10:00
Michael Gratton
4ec936fe7c Ensure background sync ops are cancelled if the folder closes
Since MinimalFolder.synchronize_remote() waits for the prefetcher to
finish, but the prefetcher only closes when the folder closes, this
could deadlock.
2019-08-28 10:10:24 +10:00
Michael Gratton
b88278c2af Fix build warning 2019-08-28 09:58:15 +10:00
Christopher Davis
bfcee9bff7 build: Set up dual install for flatpak
Part of https://gitlab.gnome.org/GNOME/Initiatives/issues/1;
Sets up dual installation for flatpaks, allowing us to
build and run geary without affecting our system install.
This will allow testing of nightlies and CI artifacts as well
via the flatpak, so we can iterate on designs and share
bundles to test with.
2019-08-26 09:38:31 -07:00
Michael Gratton
eb6afae358 Rename UNCONNECTED FSM and protocol state to NOT_CONNECTED
The former is ambiguous, the latter is not.
2019-08-26 13:55:43 +10:00
Michael Gratton
63210247dd Rename the BROKEN FSM state to CLOSED
BROKEN sounds bad, whereas it's actually a normal state.
2019-08-26 13:52:32 +10:00
Michael Gratton
0b923a29ea Ensure bad IMAP response are treated as other errors
Send a receive error event to the FSM when a bad response is received so
that the connection is closed, in the same way as for other receive
errors.
2019-08-26 13:52:32 +10:00
Michael Gratton
5a9944a9df Handle Imap.Deserialiser EOS better
Ensure that the client connection is disconnected when the deserialiser
receives an EOS from its underlying stream. Rename the signal used
by Imap.ClientConnection to notify the Imap.ClientSession of EOS to make
it more clear what is going on.

Resolves the issue in #481 where an EOS was recevied but the connection
was not pulled down until after a NOOP was sent and timed out.
2019-08-26 13:52:32 +10:00
Michael Gratton
3ff35bcb67 Remove some duplicate debug logging
Only log from FSM event handlers, not from connection signal handlers.
2019-08-26 13:52:32 +10:00
Michael Gratton
08c057345d App.ConversationMonitor: Don't force load ops to be local-only
In an attempt to prevent ConversationMonitor for blocking when a
connection went bad, load operations were set to local-only when
the remote was not open. This meant however that if the remote was in
the process of being opened, that local-only would be set, and hence any
incomplete messages would fail to be downloaded. Now that the Fill op
now explicitly handles filling local-only by default, we can remove
this.

This ensures that when the conversation monitor is notified of new
messages, but they are not yet fullly downloaded since the prefetcher
is still running, that the messge will still show up.
2019-08-26 13:32:53 +10:00
Michael Gratton
02f1d89d27 Smtp.ClientService: Explcitly poll when waiting for sent mail
At least GMail takes some time to copy new messages to the Sent folder
on the server side when sending them, which means the mail may not show
up even after doing a manual remote sync.

This adds an explicit poll, listing new mail in Sent after sending
a message to check for the sent message showing up.
2019-08-26 13:32:53 +10:00
Michael Gratton
4ae0414e44 MinimalFolder::synchronise_remote: Handle sessions gone bad
Since the NOOP that ::synchronise_remote sends doesn't go through the
replay queue, it will throw an error if the connection has gone bad.
Instead, catch it and retry.
2019-08-26 13:32:53 +10:00
Michael Gratton
7b53137c8f Fix missing outbox messages body preview in ConversationViewer 2019-08-26 13:32:53 +10:00
Michael Gratton
dd24b220d0 Ensure new sent mail is found for services that auto-save
Ensure that sent mail shows up in a conversartion ASAP for Google,
Outlook and others that automatically save sent mail by performing a
manual sync of the Sent folder after delivering the mail.
2019-08-26 13:32:53 +10:00
Michael Gratton
d56508f1e7 Clean up ImapEngine.CreateEmail replay op source code 2019-08-26 13:32:53 +10:00
Michael Gratton
079d0205b7 Handle Smtp.ClientService null condition better 2019-08-26 13:32:53 +10:00
Michael Gratton
8bb7d3aeee Ensure folder is refreshed ASAP after creating a new message
If the server supports UID plus, update the message after it was
created to get its IMAP fields and anything else missing filled in.
If not, schedule a explicit folder sync.
2019-08-26 13:32:53 +10:00
Michael Gratton
b717c323bb Schedule folders for background sync even when open
Although the folder normalisation process and email prefetcher should
be enough to sync a folder without requiring an explcit sync, if the
folder opens and closes fast enough that new mail is notified but not
downloaded, the folder will still close and the mail will be missed.

To fix this, if a folder has changed, queue it for sync'ing even if it
is currently open.
2019-08-26 13:32:53 +10:00
Michael Gratton
6871c1cd90 Make remote folder synchronisation a top-level API method
Add Geary.Folder::synchronise_remote method to allow clients to
explicitly check for new mail in a folder. Move code from
ImapEngine.AccountSynchronizer as the basic implementation, but also
ensure pending replay queue notifications are processed before the
process is complete.
2019-08-26 13:32:53 +10:00