Commit graph

74 commits

Author SHA1 Message Date
Michael Gratton
454cc0bcfe build: Fix Flatpak CI test failures caused by meson 0.57
Add previously implicit build dependencies for tests.

See GNOME/gnome-build-meta#372,
https://discourse.gnome.org/t/meson-0-57-update-may-break-tests-ci/6220
2021-04-23 00:59:02 +10:00
Michael Gratton
20a4fd3ed2 Geary.ImapDb.SearchQuery: Rename to Geary.FtsSearchQuery
There's nothing IMAP-specific about the class, so move it to common
and rename to reflect what it is actually used for.
2021-01-19 20:48:17 +11:00
Michael Gratton
6a614adf73 Geary.ImapDb.SearchQuery: Use expression to generate FTS5 queries
Move SQL generation for FTS search from ImapDb.Account to SearchQuery.
Convert to use Geary.SearchQuery.Term instances to generate SQL, rather
than parsing the expression. Simplify the generated SQL substantially
and generate MATCH values that work with SQLite FTS5.
2021-01-19 20:48:17 +11:00
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 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
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
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
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
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
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
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
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
6d5f63692b Geary.Mime.ContentType: Rename ::deserialise to ::parse
Add unit tests.
2020-05-05 21:57:17 +10: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
6d22950129 Add a simple mock server for testing network code 2020-03-27 08:29:14 +11:00
Michael James Gratton
cbe6e0ba9b Revert "Merge branch 'mjog/558-webkit-shared-process' into 'mainline'"
Revert merge request GNOME/geary!374 for now since the shared process
model breaks old-style WebProcess message handler IPC.

This can be un-reverted when out JS is ported to the new Messages API
that is landing in WebKitGTK 2.28.

This reverts commit e4a5b85698, reversing
changes made to 66f6525480.
2020-02-13 12:56:52 +11:00
Michael Gratton
ceb9c9764a Rename ClientWebView to Components.WebView per code style 2019-11-26 14:26:03 +11:00
Michael Gratton
ca6cbecb83 Add manual Components.Validator::validator method
Support manual validation where needed, add unit tests.

This also slightly changes the behaviour of non-required field, since
an empty non-required field should be valid.
2019-11-20 17:11:14 +11:00
Michael Gratton
56876365ba Rename GearyApplication class and source to match code style
Rename `GearyApplication` => `Application.Client` and
`geary-application.vala to `application-client.vala`. Update call sites
and test cases.
2019-11-17 21:38:29 +11:00
Michael Gratton
e426517b30 Rename Config class and source file to match code style
Rename `Configuration` => `Application.Configuration` and
`geary-config.vala to `application-config.vala`. Update call sites and
test cases.
2019-11-17 16:53:42 +11:00
Chris Heywood
eaa98883a7 Tests for ComposedEmail.contains_inline_img_src and replace_inline_img_src 2019-11-17 16:40:13 +11:00
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
af2915707d Consistently use '..._c_args' and '..._vala_args' for meson vars 2019-09-27 23:56:52 +10:00
Michael Gratton
df8a96c104 Clean up meson dependency lists 2019-07-21 10:05:24 +10:00
Michael Gratton
da6ac828bd Move Geary.JS package into client as Util.JS
The only reason it was in the engine was so it could be used by both
the client and the web extension, without worrying about the
webkit2gtk and webkit2gtk_web_extension packages conflicting. However
it didn't really belong there, and added a dependency for the engine
on javascriptcoregtk which doesn't belong. So this fixes all that.
2019-07-21 10:00:32 +10:00
Michael Gratton
03b5fcee8a Pass email to a contact harvester instance when persisting it
Add a ContactHarvester arg to ImapDB.Folder.create_or_merge_email and
call it on the resulting email. Add and update a new harvester
property to MinimalFolder and pass that in as needed.
2019-06-13 16:33:44 +10:00
Michael Gratton
65ab37938f Implement new contact harvester for the engine
Replaces harvesting code in ImapDB code so as to be stand-alone and
reusable. Implement harvesting policy to only harvest from a set of
whitelisted special folder types (so junk and trash is not harvested)
and only harvest valid, non-spoofed, addresses.
2019-06-13 16:32:47 +10:00
Michael Gratton
809f664319 ContactStoreImpl unit tests 2019-06-13 16:28:55 +10:00
Michael Gratton
c58d0b74e9 Add simple SMTP integration test 2019-04-24 17:18:03 +10:00
Michael Gratton
a163dea96a Merge branch 'wip/application-cleanup' into 'mainline'
Application cleanup

See merge request GNOME/geary!215
2019-04-21 06:18:14 +00:00
Michael Gratton
d4c29c72d7 Add unit tests for app path accessors 2019-04-21 11:13:01 +10:00
Michael Gratton
bc7f5c5392 Fix TNEF engine tests not being run 2019-04-20 15:06:30 +10:00
Michael James Gratton
dd3a7a1bc8 Add API for (de)serialising FolderPath and EmailIdentifier
Supports (de)serialising via GLib.Variant for use as GLib.Action targets
transmission via DBus, etc.
2019-04-17 09:06:24 +10:00
Michael Gratton
73159ba091 Add new generic LRU cache to the client 2019-04-08 10:26:04 +10:00
Michael Gratton
3a44628da9 Fix ConversationMonitor sometimes not loading more from remote
If a FillWindowOperation didn't load a full amount of messages, it just
assumed that there were no more to load. This is not true however when
loading locally, the folder's vector isn't fully expanded, and it gets
to the end of the vector.

This patch fixes the operation to also queue another fill if the
monitor's folder message window is smaller than the folder's total
message count.

Fixes #289
2019-04-04 16:57:53 +11:00
Michael Gratton
cddbb28a43 Add initial integration test famework and IMAP client session tests 2019-03-31 02:05:14 +11:00
Michael Gratton
6c8f192148 Attempt to de-mangle From names from Mailman, GitLab, etc
Some software like the above will mangle From mailbox names by appending
"via Some Service" to the From mailbox name. This messes up generating
default avatars for the actual people sending these messages, so
attempt to de-mangle the names.

This involves moving primary originator determination from the engine
to the client, since it's now a policy thing. Add unit tests.
2019-03-09 20:17:01 +11:00
Michael Gratton
76ee07595d Make avatar code a bit more robust in the face of bad input
Don't try to dray null initials, actually return null per API contract
when no initials can be found, don't include non-alphanumerics in the
initials. Add test case.
2019-03-09 20:17:01 +11:00
Michael Gratton
539893fb72 Add some unit tests for setting email flags 2019-02-13 18:41:49 +11:00
Michael Gratton
5a22e8e4a2 Convert Geary.FolderRoot to be an actual root, not just a top-level
Instead of each top-level IMAP folder being a FolderRoot object, then
children of that being FolderPath objects, this makes FolderRoot an
"empty" FolderPath, so that both top-level and descendant folders are
plain FolderPath objects. Aside from being more technically correct,
this means that empty namespace roots can now be used interchangably
with non-empty namespace roots (addressing issue #181), and custom
folder implementations no longer need to provide their own trivial,
custom FolderRoot.

To support this, a notion of an IMAP root and a local root have been
added from which all remote and local folder paths are now derived,
existing places that assume top-level == root have been fixed, and
unit tests have been added.
2019-01-15 00:18:45 +11:00
Michael Gratton
faf7a2bdfd Add some unit tests for Geary.ImapDb.Account folder management 2019-01-14 11:01:03 +11:00
Michael Gratton
123f51dbb2 Enable config file versioning
This (way too large patch) enables versioning in config files, and
provides a mechanism by which to load older versions from a newer
version of Geary. It also properly introduces a new v1 config format
that adds several groups to geary.ini to make it easier to read and to
distinguish between incoming/outgoig services rather than IMAP/SMTP.

To do this, a few things that should have happened in seperate patches
were also done:

 * Make AccountInformation's imap and smtp properties mutable (they
 aren't stateful any more anyway), make ServiceInformation non-abstract
 again and remove the subclasses (to get config versioning happening
 without an explosion of a classes, it all has to be handled from the
 AccountManager anyway), and some other misc things.
2018-12-08 13:53:01 +11:00
Michael Gratton
9884faba84 Add general impls for converting enum values to nicks and back.
Use this for service provider related enums.
2018-11-30 23:49:30 +11:00
Michael James Gratton
5305c27ca7 Move AccountManager and related objects into Accounts package.
This makes the manager consistent with the source file naming convention
and the new account UI classes.
2018-11-30 23:49:30 +11:00
Michael James Gratton
74fa29b73f Tidy up Geary.AccountInformation creation.
Pass service provider to ctor so we can make the service provider
property immutable. Fill in service label in ctor so it's always set to
something useful. Move creating orphans from Engine to AccountManager
since it exists only to assign an internal id for new accounts, so it
should handled by the account manager anyway.
2018-11-30 23:49:30 +11:00