Commit graph

427 commits

Author SHA1 Message Date
Michael Gratton
fac257a273 Merge branch 'mjog/558-webkit-shared-process-redux' into 'mainline'
Webkit shared process redux

See merge request GNOME/geary!565
2020-10-13 08:27:01 +00:00
Michael Gratton
2357f8fd01 Merge branch 'mjog/default-development-build' into 'mainline'
Set default build profile to development

See merge request GNOME/geary!597
2020-10-13 08:00:26 +00:00
Michael Gratton
1d80ed2034 ComposerPageState: Use CSS for managing focus with composer body parts
Now that the `:focus-within` pseudoclass is supported, use this rather
than some custom JS to update custom HTML classes. This also prevents
spurious mutation events from firing.
2020-10-13 00:02:09 +11:00
Michael Gratton
0609fbc3d7 Util.JS: Remove now-unused code 2020-10-13 00:02:09 +11:00
Michael Gratton
89453931bf Util.Js: Improve JSC Value to GLib.Variant conversion
Stop needlessly wrapping object members and array elements in
variant variants.

Don't wrap object values in variants since the code is already using
vardicts for these. Return a variant array if a JS array contains values
of all the same type and don't wrap these in variants, else return
a tuple, which don't need to be wrapped either.
2020-10-13 00:02:09 +11:00
Michael Gratton
c813aa5707 Components.WebView: Check for pass up exceptions when calling JS code
Update web extension to check for errors when invoking page state
methods and pass a message back if found. Check for this, decode and
throw a vala error in the WebView if found.
2020-10-13 00:02:09 +11:00
Michael Gratton
ff565bc6ef Components.WebView: Convert to using messages for JS method invocation
Use WebKitGTK UserMessage objects for invoking JS methods rather than
serialising to JS strings and running those. This is possibly slightly
less efficient, but removes the onus on serialising to and parsing from
JS and once switched over from message handlers to UserMessage objects
will be using a single uniform IPC interface for both.
2020-10-13 00:02:09 +11:00
Michael Gratton
1ba2bd0f5b Util.JS: Support converting between JSC.Value and GLib.Variant objects
Add `variant_to_value` and `value_to_variant` methods, document them
and add tests.
2020-10-13 00:02:09 +11:00
Michael James Gratton
d7af23201c Revert "Revert "Merge branch 'mjog/558-webkit-shared-process' into 'mainline'""
This reverts commit cbe6e0ba9b, which reinstates
commit e4a5b85698.

See !411 and !374
2020-10-13 00:02:02 +11:00
Michael Gratton
aaa2934acf meson_options.txt: Update to use meson best practices and clean up
Convert to use meson features for features. Reorganise and rename
options for consistency. Make descriptions a bit less redundant.
2020-10-03 23:34:31 +10:00
Michael Gratton
03f05c6448 Merge branch 'mjog/986-namespace-assert' into 'mainline'
Disconnect from IMAP client sessions when logging out

Closes #986

See merge request GNOME/geary!586
2020-10-01 23:09:53 +00:00
Michael Gratton
bd85c4f1a8 Composer.Widget: Fix criticals when "mailto:" has empty body 2020-09-27 19:57:52 +10:00
Michael Gratton
41be8693d4 Geary.Imap.ClientSession: Treat logout as disconnect
Convert `get_protocol_state` to an automatic property, so that rather
than requiring explcit signals for lifecycle events, a GObject notify
signal can be used instead.

Convert disconnect signal to a property so it can be accessed if needed.

Convert code listening to the disconnect signal to listen to notify
signals for `protocol_state` instead, and hence also treat the session
as disconnected when a logout is in progress.

Fixes #986
2020-09-27 17:38:10 +10:00
Michael Gratton
85e9046c71 Geary.Imap: Make command cancellable a property of the command object
Since both submitting a command no longer requires a cancellable, and it
is desirable to avoid sending a queued command that has already been
cancelled beforehand, add a new `Command.should_send` Cancellable
property to specify if a command should (still) be sent or not, and stop
passing a cancellable to ClientSession when submitting commands.

Allow call sites to pass in existing cancellable objects, and thus also
add it it as a ctor property to the Command class and all subclasses.

Lastly, throw a cancelled exception in `wait_until_complete` if send
was cancelled so that the caller knows what happened.

Remove redundant cancellable argument from
`Imap.Client.command_transaction_async` and rename it to
`submit_command` to make it more obvious about what it does.
2020-09-02 14:34:41 +10:00
Michael Gratton
87340a9675 Merge branch 'mjog/955-special-use-unavailable-at-startup' into 'mainline'
Geary.Account.Information: Fix special use folder not correctly stored

See merge request GNOME/geary!569
2020-08-31 04:17:32 +00:00
Michael Gratton
39f687fcd3 Geary.Account.Information: Fix special use folder not correctly stored
The special use map needs custom hash and equality functions to
work correctly. Add these and some unit tests.

See #995
2020-08-30 18:26:26 +10:00
Michael Gratton
a64412e696 RFC822MesageTest: Fix locale-sensitive test case
Use `ascii_down()` instead of `down()` so the test case is more robust
in the face of being run under different locales.

Fixes #950
2020-08-29 18:33:15 +10:00
Michael Gratton
710eeb1e65 Merge branch '937-retain-messages-during-gc' into 'mainline'
Retain a number of messages when performing GC

Closes #937

See merge request GNOME/geary!556
2020-08-26 22:07:50 +00:00
Michael Gratton
964b03c068 Application.TlsDatabase: Add unit tests for local (non-GCR) pinning
Make the class internal so it can be tested, add unit tests covering
both in-memory-only and on-disk pinning.
2020-08-25 16:40:08 +10:00
Chris Heywood
4fdaaeacd9 Fix bug with message retention count during GC plus fix test case 2020-08-24 19:29:44 +10:00
Michael Gratton
3ddce74844 sql: Add db migration to clean up message_ids with extra whitespace 2020-08-23 12:58:17 +10:00
Michael Gratton
eb3a8b0fe4 Geary.RFC822.MessageID: Replace GMime parser with more lax parser
Support parsing message IDs with the form `<add-spec>` (per the RFC)
but also `(add-spec)` and `add-spec`.

Add unit tests.
2020-08-22 16:23:07 +10:00
Michael Gratton
4e50822674 Geary.RFC822.MessageID: Ensure RFC822 value does not include errant wtsp
`to_rfc822_string` must not include any leading/trailing white space
even if it was included in the `from_rfc822_string` constructor.
2020-08-22 11:57:12 +10:00
Björn Daase
1d02b8b70b *: fix spelling mistakes found by codespell 2020-08-19 09:34:58 +02:00
Michael Gratton
67a2d32a6c Merge branch 'mjog/dovecot-envelope-mailbox-quirk' into 'mainline'
Dovecot envelope mailbox quirk

See merge request GNOME/geary!546
2020-08-18 07:07:35 +00:00
Michael Gratton
31f10e2787 Geary.Imap: Add quirk for Envelope address structure placeholders
Some servers (e.g. Dovecot) use placeholder strings instead of the empty
string (e.g. "MISSING_DOMAIN") in FETCH Envelope responses when a
required address part (e.g. local part, domain) are empty.

This adds a quirk that can be enabled for such servers to check for the
placeholders and if found, replace them with empty strings.
2020-08-18 16:34:24 +10:00
Michael Gratton
757c0542dc Geary.Imap.ServerResponse: Add quirks property
Add a quirks object as a property so code that parses the response has
access to it. Simplify constructing server responses slightly and pass
the IMAP connection's quirks when doing so.
2020-08-18 16:34:24 +10:00
Michael Gratton
ebf7a8ad1d Geary.Imap: Update IMAP quirks based on server greeting rather type
Use server greeting to update IMAP quirks, so that if e.g. a GMail
account is configured as a generic account, it still gets the right
quirks.
2020-08-18 16:34:24 +10:00
Michael Gratton
0d283dfc72 Geary.RFC822.MailboxAddresses: Update append methods
Rename append method to concatenate_list since that's what it actually does. Add new method
for cat'ing a single mailbox, add methods for merging both a single mailbox and mailbox
list into a new list.
2020-08-18 16:32:26 +10:00
Michael Gratton
df7a30cbe1 Geary.Account: Add {de}register_local_folder methods
Support API clients registering their own local folder implementations.
Use this (and the last commit) to generalise handling of the outbox by
GenericAccount by registering it when the outbox postie is started, and
when creating a map of folders that contain specific ids.

This also ensures API clients are informed of the outbox becoming
available, allowing some special case code to be removed from the app
controller.
2020-08-18 16:32:26 +10:00
Michael Gratton
910228093c Geary.Folder: Add new contains_identifiers method
Add new public method that allows API clients to query whether a folder
contains a specific set of email ids. Add implementation to all
derived classes.
2020-08-18 16:32:26 +10:00
Michael Gratton
1c22eb4ebd Geary.RFC822.MailboxAddress: Handle empty mailbox and domain parts better
If an address does not have an `@`, or if the IMAP constructor is called
with empty mailbox or domain parts, then these properties will be empty.
This is not uncommon, especially on UNIX hosts where system accounts
send email.

Ensure this is handled correctly in the constructors and are
round-tripped correctly by `to_rfc822_address` and hence
`to_rfc822_string`.
2020-08-18 16:14:37 +10:00
Michael Gratton
e5bfd7295c test-client: Fix test failure for new composer widget tests under CI
Init icon factory so composer tests work under CI, add rsvg as a test
dependency for Ubuntu which as of 20.10 does not include it by default.
2020-08-13 19:52:12 +10:00
Michael Gratton
44654e3f76 Composer.Widget: Rework context email loading
Ensure composer state is restored when loading draft replies and that
`referred_ids` is updated top include the messages the draft refers to.

Make the process for loading different context types more obvious by
doing the work in-place, especially for replies, and avoiding multiple
utility methods that also branch based on type.

Use standard RFC822 classes for managing In-Reply-To and References, and
merge id lists rather than simply concatenating them. Ensure both are
updated when adding additional replies to the email, and they are always
set on any composed email constructed.

Add unit tests for all of the above.
2020-08-13 19:52:12 +10:00
Michael Gratton
691a239031 Composer.ApplicationInterface: New composer app interface
Defining an interface for the composer to access application objects
and services decouples it from Application.Controller, allowing it to be more
easily unit tested.

Replace use of Application.Client and Application.Controller in the
composer and add some basic unit tests.
2020-08-13 19:52:12 +10:00
Michael Gratton
c73888b2c4 Geary.RFC822.MessageIDList: Support merging message id lists
Add support for merging a list with a single id or a another list,
only appending the new id(s) if not already present. Add unit tests.
2020-08-13 19:52:12 +10:00
Michael Gratton
2957f15297 Geary.RFC822.MailboxAddresses: Update equality semantics
Although when processing mailbox addresses lists are effectively sets,
the ordering can be important for people. As such, make `equal_to`
comparisons require identical ordering, and add new `contains_all` for
order-independent comparisons.
2020-08-13 19:51:33 +10:00
Michael Gratton
6e0aa316d8 build: Generate client internal VAPI and build client tests with it 2020-08-13 19:51:33 +10:00
Michael Gratton
35683dd6eb build: Reduce verbosity of meson vars by removing geary_ prefixes 2020-08-13 19:51:33 +10:00
Michael Gratton
2030b2dec7 test: Break out engine mock objects into their own name-space
Engine mocks don't need to be in the `Geary` namespace, and including
them there makes it difficult to use them in client tests, so put them
all in their own name-space and corresponding directory.
2020-08-13 19:51:33 +10:00
Michael Gratton
175c7dc7f2 Geary.RFC822.MessageIDList: Add unit tests for parsing RFC822 id lists 2020-08-13 17:55:07 +10:00
Michael Gratton
33801f22ef sql: Add migration for bad message-id data in the database 2020-08-13 15:50:07 +10:00
Michael Gratton
ec4c6d3989 Geary.RFC822.Message: Fix get_body() critical with multipart messages
Fixes a bad assumption MR !534 made about GMime structure and causing
a crash on sending multipart messages. Add unit tests to cover this
case.
2020-08-03 20:14:32 +10:00
Michael Gratton
e2f2b6cdab Geary.RFC822.Message: Add accessors for message headers and raw body
Allow accessing Header and Text representations of the message.
2020-07-30 12:53:11 +10:00
Michael Gratton
16efce0514 Fix build failure 2020-06-30 18:25:51 +10:00
Michael Gratton
cfbac77fa4 Merge branch 'mjog/unit-test-subproject' into 'mainline'
Unit test subproject and cleanup

See merge request GNOME/geary!517
2020-06-30 08:08:54 +00:00
Michael Gratton
3550c69723 Merge branch 'mjog/server-quirks' into 'mainline'
Server quirks

See merge request GNOME/geary!508
2020-06-30 07:50:05 +00:00
Michael Gratton
4d6dad1cfa Merge branch 'mjog/746-gmail-flag-quote-bug' into 'mainline'
GMail flag quote bug

Closes #746

See merge request GNOME/geary!507
2020-06-30 07:46:17 +00:00
Michael Gratton
0ae633d88f Update existing tests to work with ValaUnit 2020-06-30 17:31:07 +10:00
Michael Gratton
6b1bad28b9 Move generic unit test classes to a new basically-standalone subproject
Break out the generic testing code into something easily re-used, and
improve the API substantially:

 * Use generics to reduce the number of equality tests to effectively
   a single one
 * Make all assert args consistent in that the actual value is always
   listed first.
 * Add convenience API for common string/array/collection assertions
2020-06-30 17:20:12 +10:00