Commit graph

96 commits

Author SHA1 Message Date
Niels De Graef
6ce2373a75 Create a config.vapi for config.h
Currently, a lot of our build variables that are defined at
configuration time, are spread out across the code base, often declared
as `extern` which can break when moving around sections of the code
across files.

This commit introduces a "Config" namespace which basically maps to the
definitions in `config.h`, but allows us to properly access them too
from the Vala source code.

By doing so, it helps us to more explicitly see where we rely on a
build variable from this file (which should be obvious from the `Config'
namespace).

To make it ourselves a bit easier in Meson too, we can declare an
internal dependency, which helps ensure that we pull in the dependency
where needed.
2025-12-07 01:32:32 +01:00
Cédric Bellegarde
ddb8a273ce treewide: Removed unused Yahoo imap engine
This is not useful now we have autoconfig support
2022-09-07 12:10:06 +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
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
Chris Heywood
71262f0e79 Merge branch 'mainline' into remove-old-msgs-beyond-storage-pref 2020-05-17 12:03:30 +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
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
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
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
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
cc0fb9eef2 Remove unused Geary.Folder::list_local_email_fields_async method 2019-12-18 09:25:07 +11:00
Michael Gratton
b3488f6cf9 Add Geary.Account::list_local_email_async
Add new method and implementation to support breaking search folder
impl out of the ImapDb package.
2019-12-12 10:47:52 +11:00
Michael Gratton
cb16bdc59d Remove default Geary.EmailIdentifier::hash and ::equal_to impls
Make subclasses implement these themselves and remove the unique string
property, to be (hopefully) more efficient and easier for subclasses
to specialise.
2019-12-12 10:47:52 +11:00
Michael Gratton
c93cfc38b1 Clean up Engine search API
Clean up search API so that query string parsing and error handling can
be pushed out to the client.

Rename Geary.Account::open_search factory method to ::new_search_query
to better reflect what it actually does.

Update Geary.SearchFolder::search to be async so it can throw errors and
the caller can catch them, require SearchQuery objects instead of plain
text query strings.

Add Geary.SearchQuery::owner property so that the query's account can be
sanity checked.

Update API documentation to reflect this.
2019-12-12 10:47:52 +11:00
Michael Gratton
dccb81fcb1 Rework Geary.Engine lifecycle managment
Now that its singleton is gone, and since it's ::open_asyc and
::close_async methods don't do anything async, just merge the former
with the class's ctor and make the latter non-async.

Explicitly construct an instance in Application.Client and ensure it
is closed there as well instead of in the controller, for consistency.
2019-11-19 09:41:09 +11:00
Michael Gratton
ecfd772c07 Clean up Geary.Engine account API and implementation
Keep a single ordered list of accounts around, construct accounts
when their config is first added, and prefer accessing accounts by
config rather than id.
2019-11-19 09:41:04 +11:00
Michael Gratton
43803239a4 Replace Geary.Account::send_email w/ Smtp.ClientService methods
Remove Geary.Account::send_email and the sending progress monitor in
favour of exposing Geary.Smtp.ClientService as a public class and so
allowing clients to acccess those symbols from Geary.Account::outgoing.

Also make ::send_email a convenience class for doing a save/queue and
expose those operations, so clients can managage the two seperately if
desired (e.g. for undoing sending).

Finally, make Outbox.Folder public since it's exposed by the SMTP
service and maybe clients want to do something more detailed with it
anyway?
2019-11-17 20:00:01 +11:00
Michael Gratton
cc4389f41d Make Geary.ComposedEmail implement Geary.EmailHeaderSet
This allows it to be used in exchange with the Geary.Email and
RFC822.Message classes in places.
2019-11-17 19:59:19 +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
09f6fc094a Improve Geary.Account API for listing folders
Make both Account.list_folders and Account.get_special_folder not throw
any errors - either the folders exist, or they don't. Update call sites.
2019-11-05 11:35:31 +11: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
Michael Gratton
983e8ce74e Mark Geary.Account.open_search as async and throwing an error
This lets us make the DB stemmer lookup async when constructing a
search query async and cancellable. Fix call sites.
2019-08-18 22:00:40 +10:00
Rico Tzschichholz
5c909334b7 Add missing generic arguments in engine tests to fix valac criticals
See https://gitlab.gnome.org/GNOME/vala/issues/835
2019-08-15 08:36:46 +02:00
Michael Gratton
71cb7fcdfe Add Geary.ContactStore.search method, impementation and tests 2019-06-13 16:56:03 +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
0b734f7ba2 Don't load all engine contacts on startup
Prepare for doing composer autocomplete via queries by not loading all
contacts at startup in the engine. Update Geary.ContactStore API to that
end, and convert Geary.Account.get_contact_store accessor method to a
property.
2019-06-13 16:28:35 +10:00
Michael Gratton
f7488453d0 Make it easier to obtain folders from path objects from Geary.Account
Replace async folder accessors with sync versions, add a means of
obtaining a folder path from its serialised form.
2019-04-17 09:06:24 +10:00
Michael Gratton
01a154bc5f Make it possible to distinguish between different folder roots
Add a label to Geary.FolderRoot so it different instances can be
differenciated.
2019-04-17 09:06:24 +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
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
Kristian Klausen
9ef6d7ccec Replace all tab indentation with 4 spaces
find . -name '*.vala' -type f -exec sed -i.orig 's/\t/    /g' {} +
and a few manual adjustment.

Fix #271
2019-02-27 19:19:58 +01:00
Michael Gratton
2ad91f5f4d Fix failing test after icon change 2019-02-24 21:50:27 +11:00
Michael Gratton
b41ef0a5b7 Merge branch 'wip/259-arm64-test-failure' into 'master'
Assert FolderPath comparisons properly in unit tests

Closes #259

See merge request GNOME/geary!136
2019-02-24 04:46:54 +00:00
Michael Gratton
ca846edf59 Improve AccountInformation.service_label generation
If the primary email address matches the incoming host name, use that.
Else use a prefix of the hostname but only if it is more that two domain
parts long. E.g. don't shorten "other.com" to "com".

Fixes #261
2019-02-22 16:56:32 +11:00
Michael Gratton
9c3fdbfb5c Assert FolderPath comparisons properly in unit tests
Fixes #259, Debian FTB failure on arm64.
2019-02-22 15:46:14 +11:00
Michael Gratton
4d57ab9b62 Default Outlook accounts to not save sent mail
See #65
2019-02-20 14:06:02 +11:00
Michael Gratton
5475290272 Allow both accounts and services to have provider-specific defaults
This updates both AccountInformation and ServiceInformation to
implicitly apply provide-specific defaults, allowing the same
mechanism to provide defaults for accounts, and meaning that API
clients do not need to do this themselves any more. Add unit tests.
2019-02-20 13:55:17 +11:00
Michael Gratton
af676e0572 Fix FolderPath mis-sorting doubly-disjoint paths
E.g. a>d should be less than b>c, not the other way around.

Fixes #224
2019-02-19 17:31:11 +11:00
Michael Gratton
e1fd9daa83 Fix pathological FolderPath.is_equal() case, add unit test 2019-01-15 00:20:37 +11:00
Michael Gratton
ddbe6e0b09 Revamp Geary.FolderPath implementation
Convert getters that look like properties into actual properties,
remove unused and redundant public and internal API, convert
implementation to use a tree that aucyally maintains references between
steps, rather than each creating a new list of path steps and
manipulating that.
2019-01-15 00:20:37 +11:00
Michael Gratton
423a1dcbf0 Add additional FolderPath unit tests 2019-01-15 00:19:46 +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
19d2fdfcbc Update Geary.Endpoint API and source
Use a generic GSocketConnectable to specify the remote endpoint,
simplify TLS cert management callbacks.
2019-01-09 15:22:19 +11:00