Commit graph

298 commits

Author SHA1 Message Date
Michael Gratton
e4cbff8bfa De-cruftify Geary.Collection utility functions
Remove functions that have as-convenient methods in up-tp-date Gee,
rename ::get_first to ::first so it reads better and add API docs,
replace ::to_array_list with ::copy, since that's what's actually
needed.
2019-11-19 19:22:38 +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
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
29042bb2d8 Move composer classes into their own namespace
Rename all composer classes prefixed with "Composer" so that the prefix
is a namespace instead. This increases the compartmentalisation of the
classes, making `internal` a useful member modifier and makes them
consistent with the code style guide.
2019-11-17 20:00:02 +11:00
Michael Gratton
1447d1acbc Minimise DOM changes made by ComposerPageState::cleanContent JS
By overriding ComposerPageState::getHtml to accept a parameter that
supports getting HTML with empty composer parts removed, cleanContent
can simply be made to linkify the page, thus allowing a ComposerWidget
to be re-used multiple times when sending an email.
2019-11-17 20:00:01 +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
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
979e8b42ac Added a few tests for RFC822.Message
- Inline attachments in from_composed_email
- get_recipients
- get_searchable_body
- get_searchable_recipients
- get_network_buffer
2019-11-17 16:40:13 +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
c002285fef Geary.App.ConversationMonitor: Fix re-entrancy issues
Avoid some issues if a monitor is closed as it is still being opened,
clean up the API and implementation a bit.
2019-11-07 11:58:56 +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
94e0736cfd Update Geary.Outbox.EmailIdentifier variant type marker
Use 'o' instead of 's' to avoid confusion with search ids. Add test.
2019-10-30 14:17:44 +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
753a67f40a Merge branch 'links' into 'mainline'
Don't linkify text near a URL that looks like a URL with a bad protocol

See merge request GNOME/geary!339
2019-10-26 05:31:55 +00: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
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
Alex Henrie
feed89225f Don't linkify text near a URL that looks like a URL with a bad protocol 2019-10-22 18:53:18 -06: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
f6e270f83d Merge branch 'mjog/ci-updates' into 'mainline'
CI updates

See merge request GNOME/geary!331
2019-10-16 03:01:14 +00:00
Michael Gratton
8206cf434d Remove Flatpak test locale hack, just use en_US.UTF-8 for now
FDO 19.08 runtime now includes C.UTF-8 locale, but since Fedora
now ships one that collates high-bit chars, it differs compared
to Debian et al's and FDO.

As a result, just use en_US.UTF-8 for now, probably until glibc
actually ships it and so they all agree.
2019-10-16 13:36:29 +11:00
Michael Gratton
69e3cdf9b5 Fix ComposerPageState::containsAttachmentKeyword
Just use ComposerPageState::htmlToText to get the email's main content
without quotes, not some custom code.
2019-10-07 23:49:12 +11:00
Michael Gratton
a8ef91f3a8 ui/composer-web-view.js: Improve keyword detection
Update ComposerPageState.containsKeywords to split on any punctuation,
not just spaces, so that text like "see the attachment." will get
detected.
2019-10-07 23:48:38 +11:00
Michael Gratton
5732d23e98 ui/composer-web-view.js: Add element blacklist to htmlToText
Update ComposerPageState.htmlToText() to allow ignoring certain elements
if needed. Update tests to test the function directly rather than going
through ComposerPageState.toText().
2019-10-07 23:42:49 +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
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
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
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
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
Joe Barnett
15e0d18dd6 Fix 100% CPU usage on mismatch utf escapes in rfc822 string
Since we're adding 2 to the index_of return value, we can't
compare to -1.

See issue #504
2019-08-06 17:06:44 -07:00
Michael Gratton
329d0380e9 Add some minor unit tests 2019-08-06 21:37:39 +10:00
Michael Gratton
2a0de1ce41 Remove Util.Webkit namespace and functions
After the JSC migration they were all a bunch of simple inline
one-liners, so were just making the code more complex than it needed to
be.
2019-07-21 10:46:42 +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
6f1834d696 Port JavaScript code from JS to JSC APIs
JSC is WebKitGTK's supported API going forward and is more
straight-forward than the old JS API, so this simplifies the code and
removes a number of deprecated calls.
2019-07-21 09:01:58 +10:00
Michael Gratton
f14b16fe7a Move WebKitUtil namespace to Util.WebKit 2019-07-20 09:13:43 +10:00
Michael Gratton
7cc3e6633e Make adding MIME parts to a new RFC822 message async
This will allow us to schedule some long-running work on a background
thread.
2019-07-19 20:41:34 +10:00
Michael Gratton
b955bc433e Hardcode PartTest's source encoding since it shouldn't change 2019-07-18 15:05:03 +10:00
Michael Gratton
2cb0a83342 Don't munge Base64 encoded text parts when saving to disk
Avoid doing character encoding conversion and CRLF stripping when saving
text parts to disk. This prevents UTF-8 encoded text attachments from
being broken when base64 encoded and no encoding is specified.

See #362
2019-07-18 14:38:38 +10:00
Michael Gratton
faf84db9f4 Actually ensure the engine PartTest suite is run 2019-07-18 14:37:23 +10:00
Michael Gratton
6a871c25c6 Remove Geary.RFC822.Part.get_effective_content_type
Just make the `content_type` property non-nullable and set a default
in the ctor instead, since it's unlikely to ever be null despite the
GMime API suggesting it could be. Update call sites to use the property
instead.
2019-07-18 14:37:10 +10:00
Michael Gratton
b6ec51bc3a Don't consider substrings when checking distinct mailbox names
RFC822.MailboxAddress.has_distinct_name() really needs to not do
sub-string checks since it will cause addresses like
`"foo-bar@baz" <bar@baz>` to not have a distinct name. To keep the fix
for #491 in effect, also adds special case checking for sinlge quotes.

Add some more tests to cover these cases.

Partially reverts commit 6e137eb649

See discussion in GNOME/geary!252
2019-07-17 18:11:17 +10:00
Michael Gratton
bed1bad3ea Fix "'test@example.com' <test@example.com>" marked as spoofed
Make RFC833.MailboxAddress.has_distinct_name() consider substrings
rather than straight-up string comparison.

See #491
2019-07-06 14:38:05 +10:00
Michael Gratton
b0ca8c9e0a Switch to using GLib structured logging
This converts the logging infrastructure to using structured logging
calls, adds and sets a structured logging writer.
2019-06-30 16:15:03 +10:00
Michael Gratton
6e137eb649 Make RFC822.MailboxAddress.has_distinct_name is case-insensitive
This prevents mailboxes being marked as spoofed when the name part and
address part are equal but with different case.
2019-06-27 10:35:26 +10:00