Commit graph

233 commits

Author SHA1 Message Date
Jonathan Haas
bfe504fed3 Make sure we match the whole link text as URL and not only some part. Add some symbols to be invalid in domains. Add 3 tests. 2019-04-27 11:52:51 +02:00
Michael Gratton
534b4e27d9 Don't MIME-encode RFC822 mailbox local parts
This is explicilty disallowed by RFC 2074 §5 and not accepted by mail
servers.

See #336
2019-04-24 20:43:39 +10:00
Michael Gratton
c306c2c5fa Correctly handle escaping UTF-8 characters in RFC822 mailboxes
Use string.get_next_char() to handle iterating over an
RFC822.MailboxAddress mailbox local part, and explicitly allow UTF-8
2, 3, and 4 byte chars without quoting, per RFC 5322.

This lets us fix the test cases that use UTF-8 chars in the local part.
2019-04-24 20:38:11 +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 Gratton
b80f6b0db4 Minor fix for MockObject 2019-04-17 09:06:24 +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
5c7c382ca5 Fix failing test when ytnef support disabled 2019-04-16 23:45:38 +10:00
Michael Gratton
4497b1275a Merge branch 'tnef-support' into 'mainline'
TNEF (winmail.dat) parsing support via libytnef

See merge request GNOME/geary!10
2019-04-16 12:38:25 +00:00
Niels De Graef
9acf5d344d Make Geary DBus-activatable. Bug 775956.
* org.gnome.Geary.service.in: create, and let it be installed by CMake.

* org.gnome.Geary.desktop.in: add `DBusActivatable=true`.

* geary-autostart.desktop.in: use `--gapplication-service` instead of
hidden.

* Change the way arguments are parsed:
  * Use the _command-line_ and _handle-local-options_ signals instead
    of _local-command-line_.
  * Remove the `--hidden` option (replaced by `--gapplication-service`)
  * Use VariantDict (which is a little cleaner)
  * Don't use global variables in Arg, but set them in
  the config instead.
  * We can no longer set a global summary due to the new option handling
  in GApplication. On IRC, I got the feedback that info like this should
  be going into a manpage.

* Since the QUIT-action can now be called without ever activating the
app, make the necessary changes to the `GearyController`:
  * `main_window` and `current_conversations` can be null.
  * use `pending_mailtos()` for the compose action as well.
  * Don't update the UNDO action if we're closing down.

* More instance variables prefixed with this (we're changing the lines
anyway, might as well do it properly).

* `Environment.set_prgname()` is already executed in GApplication.run(),
so no more need for `GearyApplication.PRGNAME`.

Signed-off-by: Niels De Graef <nielsdegraef@gmail.com>
2019-04-12 22:04:56 +10:00
Oliver Giles
18fcf0e18f TNEF (winmail.dat) parsing support via libytnef 2019-04-11 12:24:52 +03:00
Michael Gratton
ef8f97628e Merge branch 'wip/remove-ci-test-workaround' into 'mainline'
Remove CI test workaround

See merge request GNOME/geary!198

(cherry picked from commit 8654c7ae136d2467f7b5b2e85a436d9039bd64bc)

4fc688de Revert "Work around DB tests always failing on gcc150.osuosl.org CI runner"
6b4b598a Add test runner multiplier to account for slow CI runners
2019-04-09 16:16:10 +00: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
aa223d103d Replace references to master with primary
See #324
2019-04-02 13:35:25 +11:00
Michael Gratton
71d8c8b1a4 Update Imap.ClientSession now IMAP NO commands aren't treated as errors
Check the response code when logging in for the command, and handle as
appropriate.
2019-04-01 02:01:04 +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
60a3f9346d Add TestCase.async_complete_full method to avoid requiring a lambda 2019-03-31 01:29:52 +11:00
Michael Gratton
9c115bec38 Clean up protocol date handling substantially
In RFC822.Date, don't use duplicate time_t and GLib.DateTime properties
-- just use the latter, fix formatting of half-hour time zones, fix
where the that class refers to ISO 8601 instead of RFC822 strings since
that is just plain wrong, and finally when parsing an RFC 822 string,
take note of the timezone offset and store that in the DateTime object,
so it is round-tripped correctly.

Stop passing time_t around everywhere else, just use the UNIX time from
the DateTimes we store for protocol objects anyway, so the time zone is
obvious.

Add unit tests.
2019-03-23 15:21:18 +11:00
Rico Tzschichholz
e09475e81d Constructors of abstract classes should not be public 2019-03-15 09:49:05 +11:00
Michael Gratton
12c6bbca56 Fix signature not being updated when composer first opened without one
The ComposerPageState JS object assumed that if no signature was present
when first loaded, that none ever would be. This broke changing the
signature when the composer was opened for an account without one, and
the from account was changed to an account with a sig.

Instead of including the signature as part of the loaded body, always
include just a skeleton signature DIV and ensure the signature is loaded
dynamically after the body has been loaded. Update code and tests to
match this assumption, and add a unit test for updating the sig.

Fixes #309
2019-03-11 12:19:57 +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
4e484e237d Make TestCase.assert_string robust in the face of null actuals 2019-03-09 20:17:01 +11:00
Michael Gratton
9ed81ed759 Remove default instance of ClientWebView's PageState JS object
This default instance was causing double the number of preferred height
events, which was likely creating a race for ConversationWebView. This
might (should?) fix plain text email with quotes sometimes showing up
with a vastly incorrect height.

To ensure that a PageState is constructed properly, make ClientWebView
abstract and use replace the one direct use of the class in the accounts
editor for the signature with a new subclass.

See #283
2019-03-06 20:11:33 +11:00
Michael Gratton
a5beccc64e Fix RFC822 mailbox names with commas breaking composer address entry
When pasting an email address copied from Geary, replying to a message
or entering an address via autocmoplete in the composer, and the
recipient's mailbox name contains a comma, it needs to be quoted so
that it is not parsed by the entry as two seperate addresses.

Fixes #282
2019-03-02 15:11:13 +11:00
Michael Gratton
9ba7c75cd4 Add some tests for decoding/encoding quoted names in RFC822 mailboxes 2019-03-02 14:25:21 +11:00
Kristian Klausen
48c93655cf Remove trailing whitespace
find . -name '*.vala' -type f -exec sed -i 's/ *$//g' {} +
The following files was ignored:
test/client/composer/composer-web-view-test.vala
test/engine/util-html-test.vala

Fix #271
2019-02-28 23:05:31 +01:00
Michael Gratton
a6c1962e47 Apply custom user CSS to composer web view as well as to conversations
This allows people with dark themes to apply style to the cmoposer's
body editor as well as to conversation bodies. Note that this CSS does
not get sent, so WYSIWYG will break if people choose to do this.

Also renames the user CSS file from user-message.css to user-style.css,
but still looks for the old name for now.

Fixes https://bugzilla.gnome.org/show_bug.cgi?id=714129
2019-02-28 18:34:28 +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
b3b44ccd42 Work around DB tests always failing on gcc150.osuosl.org CI runner
See Infrastructure/Infrastructure#97
2019-02-19 17:12:26 +11:00
Michael Gratton
2c4fe9b77f Merge branch 'wip/weak-refs-for-callback-managers' into 'master'
Prevent circular refs using idle and timeout manager when running

See merge request GNOME/geary!110
2019-02-18 00:39:32 +00:00
Michael Gratton
9619d18eda Ensure conversations that have no email in the base folder are dropped
If a least one email in a conversation that is in the base folder but
also in another is removed from the base folder, the conversation may
not be removed from the monitor despite possibly not having any email
in the base folder, since the email may not have been completely removed
from the conversation.

This was particulary being seen with GMail accounts where even single
message conversations were not disappering when trashed because the
converation's email was still in All Mail.

This fix does a few things: Avoids hitting the database when checking
a conversation still has email in the base folder, when it does check
only ensures that email are in the base folder, not *any* folder, and
updates ConversationSet::remove_all_emails_by_identifier to do this
check iternally, clean up its API and implementation and avoids having
to use out args calling it.
2019-02-16 16:26:10 +11:00
Michael Gratton
67bf1183e6 Add base_folder property back to ConversationSet
Athough it was removed a while back, add it back since it is not only
needed when adding conversations, but also when removing email from
conversations to be able to detect when a conversation should be
dropped.
2019-02-16 16:10:47 +11:00
Michael Gratton
3cda1b5c6b Prevent circular refs using idle and timeout manager when running
If an IdleManager or TimeoutManager had been scheduled, it would not get
destroyed until it was executed by the main loop, causing criticals
if the objects enclosed by its callback had been destroyed.

This adds a weak reference to the manager object itself when scheduling
on the main loop, so it can get safely dropped.
2019-02-16 15:58:08 +11:00
Michael Gratton
744cde0c2f Don't update a folder's unread email count during normalisation
Updating the unread count after opening a folder and finding email that
has an unexpected unread status messes up the count obtained from the
server, which has already taken these messages into account.

Here, both the main normalisation process and the email flag updater are
prevented from adjusting the unread count for a folder when they
encounter email that are new and unread, or have an unread status
different from what was last seen by the engine.

See #213
2019-02-15 13:40:04 +11:00
Michael Gratton
539893fb72 Add some unit tests for setting email flags 2019-02-13 18:41:49 +11:00
Michael Gratton
00d381d6a9 Trivial test case cleanup 2019-02-08 11:26:39 +11:00
Michael Gratton
0f554d2371 Fix select-quoting not preserving newlines in some cases
If the common ancestor of the quoted text is the plain-text-message DIV
itself, the isDescendant test fails and the style to preserve new lines
is not maintained. This adds a non-strict check to isDescendant and
enables that when checking the common ancestor node and a test case for
it.
2019-02-02 15:07:41 +11:00