Commit graph

284 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
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
Michael Gratton
7b124abd2e Fix engine test failure under flatpak
Geary.ImapDb.Database/utf8_case_insensitive_collation depends on a well
known UTF-8 collation order, but distros only ship C.UTF-8 by default
and Flatpak doesn't ship that, so support en_US.UTF-8 as a fallback.

See https://gitlab.com/freedesktop-sdk/freedesktop-sdk/issues/812
2019-06-26 12:46:08 +10:00
Michael Gratton
4e1aa32514 Ensure Geary.ContactStoreImpl handles non english searches
Fix DB impl actually do UTF-8 case-insensitive search matching. Add
some unit tests.
2019-06-22 14:11:10 +10:00
Michael Gratton
788a06144f Ensure test drivers all have sane locales set 2019-06-22 14:08:03 +10:00
Michael Gratton
3007ac51da Do prefix-only searching in ContactStoreImpl to impove results 2019-06-13 16:56:03 +10:00
Michael Gratton
71cb7fcdfe Add Geary.ContactStore.search method, impementation and tests 2019-06-13 16:56:03 +10:00
Michael Gratton
66a664f98d Clean up ImapDB.Account ctor/open API a bit
Move args from open_async to ctor and use these to determine and store
DB file and attachment paths as properties. This allows constructing
the DB instance up front and markig it as non-nullable, simplifies
calling patterns and hence allows removing one use of the deprecated
Engine singleton, and by moving in the local data deletion
implementation from ImapEngine.GenericAccount, also allows removing a
static helper method.
2019-06-13 16:55:23 +10:00
Michael Gratton
5e13dd0abd Replace Db.PrepareDelegate with a subclass virtual function hook
While slightly less flexible, it fits the Engine's needs and simplifies
the DB API.
2019-06-13 16:35:17 +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
91caff487b Add support for uint args in expected calls in MockObject 2019-06-13 16:31:26 +10:00
Michael Gratton
bc64cd9847 Provide a way to access actual args for an expected mock call 2019-06-13 16:30:42 +10:00
Michael Gratton
cb8150ce03 Remove existing contact harvesting mechanism
Remove contact harvesting from DB version 005 (version 0.1.1), allowing
the implementation of both ContactStoreImpl and ImapDB.Database to be
cleaned up. Remove contact collection from ImapDB.Folder, reducing the
numer of Gee objects created when creating/merging messages. Finally,
remove the MessageAddresses object now that it is unused.
2019-06-13 16:28:59 +10:00
Michael Gratton
809f664319 ContactStoreImpl unit tests 2019-06-13 16:28:55 +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