Commit graph

149 commits

Author SHA1 Message Date
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
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
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
35150701e3 Merge branch 'buzzert/deleted_flags' into 'master'
Fixes bug where messages marked for deletion still appear in message list

See merge request GNOME/geary!54
2019-02-02 02:47:46 +00:00
Michael Gratton
719bbca901 Ensure ImapDB.DatabaseTest and AccountTest dispose of their db instances
Make sure the database these instances are/have are destroyed before
deleting the database file, so it is definitely not being kept open.
2019-01-22 01:49:36 +11:00
Michael Gratton
8a057a2086 Fix name of temp dir used in ImapDB.AccountTest 2019-01-22 00:57:26 +11:00
Michael Gratton
5f73eb94b2 Use standard recursive delete in ImapDB.DatabaseTest 2019-01-22 00:57:26 +11:00
James Magahern
30e9e8950b Merge branch 'master' into buzzert/deleted_flags
* master: (212 commits)
  Import standard GNOME Flatpak CI config rather than copy/pasting it
  Update Gitlab CI Flatpak build with standard template
  Fix build with new FolderPath API
  Only collapse runs of space, tab, carriage return, and newline
  Do not add non openable folders entry in sidemenu. Bug 712902
  Reducing padding in conversation viewer list
  Fix build warnings
  Fix possible critical when removing an account is removed
  Fix local accounts for special-case providers not configured correctly
  Rework GenericAccount::ensure_special_folder_asyc yet again
  Add some useful debugging to GenericAcount
  Fix ambiguous test in AccountInformation.set_special_folder
  Fix pathological FolderPath.is_equal() case, add unit test
  Revamp Geary.FolderPath implementation
  Add additional FolderPath unit tests
  Convert Geary.FolderRoot to be an actual root, not just a top-level
  Stop duplicate inboxes being created, not being listed
  Ensure MinimalFolder remote open forces closed on hard errors
  Ensure accounts don't accidentially create multiple inbox-type folders
  Remove unwanted debuging cruft
  ...
2019-01-20 12:59:06 -08: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
faf7a2bdfd Add some unit tests for Geary.ImapDb.Account folder management 2019-01-14 11:01:03 +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
Michael Gratton
20447c814f Provide common account and service status tracking via Account
Similarly to ClientService, add a `current_status` property that denotes
the account's operational state, so that clients can just set a notify
on that to be informed of all account status changes. Keep the property
updated by watching for changes to the client service's status property.
2019-01-01 22:29:07 +11:00
Michael Gratton
827db39fe2 Provide common service status tracking via ClientService
This adds a `current_status` property to ClientService to track the
service's operational state, wich can be monitored by both the engine
and clients for changes. Hook up subclasses to keep that update, and
move connectivity management in to ClientService to provide a common
implementation.
2019-01-01 22:29:07 +11:00
Michael Gratton
ebe4e190ac Fix credentials not being updated in the engine when changed in editor
Add a method to Accounts.Manager to update credentials for local
accounts. Update Geary.ClientService to enable both an endpoint and
service config to be updated when changed, and simplify how that gets
done. Update Accounts.EditorServerPane to ensure these get called.
2018-12-27 10:34:43 +10:30
Michael Gratton
95ebdd65d2 Tidy up ClientService API a bit
Require endpoint to always be present so it is never null, and hence
passed in through account creation. Rename props to be a bit more
descriptive.
2018-12-27 10:20:58 +10:30
Michael Gratton
1bccd51a25 Clean up AccountInformation and ServiceInformation APIs
Remove remaining crufty properties left over from pulling accounts out
of the engine, rename imap/smtp to incoming/outgoing since maybe one
day other protocols or implementations will be supported. Remove the
old pairs of properties for TLS and SMTP auth, replace the
SmtpCredentials enum with something that is also independent of
protocol.
2018-12-09 11:06:20 +11:00
Michael Gratton
8fe6d4f85a Move CredentialsMediator back to AccountInformation
In practice, the same mediator is always being used for both services,
and by removing it from ServiceInformation we can provide default
instances for both IMAP and SMTP, meaning we can load account config
before service config, making handling loading for both much tidier.
2018-12-08 13:53:37 +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
fa5ecf0c22 Tidy up account info sender mailbox implementation
This finishes conversion from the old approach (primary+aliase list) to
the new (a single ordered list). API is simplified a bit, and some
convenience properties are added.
2018-12-02 12:43:38 +11:00
Michael Gratton
038cf7c997 Update to Account.set_endpoints set only one specific endpoint
This will allow updating the endpoint for only a single service instead
of both if only one has changed.
2018-11-30 23:49:30 +11:00
Michael Gratton
41402c9108 Tidy up Account and derived class's constructors
Get the account's id (renamed fron "name") from the account's config and
construct the id internally. Construct the ImapDB.Account instance
internally as well since it doesn't require any input from the engine.
2018-11-30 23:49:30 +11:00
Michael Gratton
e760b074a2 Move endpoints from account config to implementation objects (1/3)
This removes Endpoint from ServiceInformation and moves it to a new
ClientService class, since ServiceInformation is for apps to provide
configuration, and Endpoints are effectively implementation detail. The
new ClientService class is in effect an analoge to ServiceInformation
in the same way as Account is to AccountInformation, and so this is a
better place to store an account's endpoints. Two instances have been
added to Account as `incoming` and `outgoing` properties instead of imap
and SMTP to be a bit more generic and with an eye to supporting other
protocols in the future.

This is possble to implement now non-generic providers are populating
ServiceInformation classes rather than Endpoints directly, and reduces
the complexity of the code needed to manage endpoints since all of the
untrusted_host callback complexity in AccountInformation and the Engine
can be removed, and will also allow simplifing credentials and SMTP
codepaths somewhat.

This work has been broken up in to thee parts to make the changes
clearer.
2018-11-30 23:49:30 +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
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
Michael James Gratton
f79f5ee255 Fix not being able to re-add account previously removed from the engine. 2018-11-30 23:49:30 +11:00
Michael James Gratton
fa3b8fa53f Add priority arg to Geary.Files.recursive_delete_async(). 2018-11-30 23:49:30 +11:00
Michael James Gratton
d24720db87 Allow checking for and removing ConfigFile keys and groups. Add tests. 2018-11-30 23:49:30 +11:00
Michael Gratton
69ac6eb48f Remove Geary.Folder.wait_for_remote_async()
This doesn't make any sense for local-only folders, and only gets used
for internal implementation details for IMAP folders, so remove the
public API and replace its use internally.
2018-11-10 23:38:54 +11:00
Michael Gratton
8d1b5b565c Add Geary.Account.is_online property
This will be useful for displaying this status to the user in the
future, and allows removing MinimalFolder.is_remote_available, which is
hopelessly innacturate in the face of network problems.
2018-11-10 09:25:05 +11:00
James Magahern
b4b377d1fa Also fix the new marked_as_deleted test to account for these changes 2018-10-17 23:51:18 -07:00
James Magahern
3e1efb4f8b Moves flag change handling from list-store to conversation-monitor.
Also adds a unit test for such behavior.
2018-10-10 02:01:56 -07:00
James Magahern
022a0b0435 Fixes broken tests and adds new test 2018-10-07 19:05:12 -07:00