Commit graph

177 commits

Author SHA1 Message Date
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
Alex Henrie
82cd2d92e1 Only collapse runs of space, tab, carriage return, and newline
Closes #184
2019-01-14 19:54:14 -07: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
18d847826a Merge branch 'improve-plaintext-conversion' into 'master'
Add plaintext quote marker to blockquote lines in one pass

See merge request GNOME/geary!73
2019-01-09 00:50:01 +00:00
Michael Gratton
fcc658af97 Merge branch 'wip/17-noisy-problem-reports' into 'master'
Problem reports are too noisy

Closes #17

See merge request GNOME/geary!74
2019-01-07 23:25:47 +00:00
Alex Henrie
a9efe8fd3a Add plaintext quote marker to blockquote lines in one pass 2019-01-01 17:55:28 -07: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
Alex Henrie
00da60debe Delineate tags a, b, i, and u in plaintext conversion 2018-12-31 11:36:41 -07: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
3049837973 Check for conflicting config and data dirs when generating an account id 2018-12-26 15:42:40 +10:30
Michael Gratton
56906e1f35 Fix failing account manager tests
This makes Accounts.Manager more easily unit testable by supplying a
credentials mediator for libsecret, rather than constructing one
internally.
2018-12-26 15:27:47 +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
5305c27ca7 Move AccountManager and related objects into Accounts package.
This makes the manager consistent with the source file naming convention
and the new account UI classes.
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
Michael Gratton
3e461e7b45 Don't include empty root folder path segment constructing a mailbox name
This fixes attempts to create special mailboxes as "/Special" instead
of "Special".
2018-09-25 23:33:12 +10:00
Michael Gratton
f3ad1fe00d Merge branch 'wip/29-ms-breaks-plain-sigs' into 'master'
Fix plain text signatures losing their formatting when rendered by MS products

See merge request GNOME/geary!33
2018-09-12 11:09:34 +00:00
Michael James Gratton
43ba38bb05 Add unit test for IMAP FETCH command constructor. 2018-09-01 22:09:18 +10:00
Michael James Gratton
ab9d0c27ad Make Imap.Command a top-level type rather than inherit from Parameter.
Instead, make the args property a parameter list, and add params to that.

This means Command's serialize method have a different signature compared
to Parameter's, letting us do some more interesting things with it.
2018-09-01 22:09:18 +10:00
Michael James Gratton
51b44f0f4b Remove ListParameter.parent property so lists can have multiple parents.
The ListParameter.parent property only existed to make the deserialier's
life easier, but is also why sketchy code was needed for appending search
criteria from a ServerSearchEmail replay op to the actual IMAP search
command sent to the server.

This removes the property altogether, and replaces its only use in
Deserialier with a stack, as nature intended. This means lists can be
added to more than one other list, and e.g. when a search is executed,
the search critera can be used for multiple requests.
2018-09-01 22:09:18 +10:00
Michael James Gratton
183a9f3e7a Don't quote an RFC 822 mailbox local part if it has a '.' in the middle.
This breaks sending mail via Yahoo since it doesn't like it if the SMTP
return path local part is quoted.

We can't use GMime.utils_quote_string since it's currently broken, so
implement our own quoter.
2018-07-28 17:57:48 +10:00
Michael James Gratton
f3e8b26227 Fix MS mailers munging plain-text signatures in HTML body parts.
Geary previously wrapped plain text sigs (i.e. those that did not contain
any HTML elements) in a DIV styled to preserve whitespace. This is all
perfectly fine, except that certain Microsoft products munged the email
for presentation and destroy the whitespace present in the message body,
causing the sig to be mis-rendered.

This works around their shitty software by using BRs instead of the DIV,
also escapes other control chars and sequential whitespace as well when
using a plain text sig. It also stops trying to smart-escape quoted reply
text, since we know it's going to be HTML from the conversation viewer,
meaning smart escaping only needs to be used for sigs.

See issue #29
2018-07-28 15:53:50 +10:00
Michael James Gratton
b345af61e3 Fix mailbox names not being sent to the server quoted if needed.
Since MailboxParameter inherited from StringParameter directly, it meant
that we could never send mailbox names as quoted strings. Also, the
modified-UTF-7 encoding used for mailbox names does not encode
atom-specials such as "\", so if a mailbox name contained one or more of
these, it would be sent to the mail server unquoted.

This removes the MailboxParameter class altogether, and does the
parameter conversion to/from appropriate StringParameter subclasses as
needed. Also adds unit tests for param conversion for ASCII,
atom-specials, and non-ASCII mailbox names.

Fixes issue #40
2018-07-20 13:43:42 +10:00
Michael James Gratton
d9c913268d Fix Imap.DataFormat.is_atom_special not flagging \, [, or DEL as special
Add unit tests.
2018-07-20 13:29:09 +10:00
Michael James Gratton
4cc7cf1769 Fix empty folder/no matching search UI not showing up.
This fixes a regression introduced by commit 0ea1fe6c3.

* src/engine/app/app-conversation-monitor.vala (ConversationMonitor):
  Signal scan_complete from the same method call that we signal
  scan_started, so that a) we know it will get fired, even if no messages
  are loaded (the issue introduced by 0ea1fe6c3) and b) so we can get rid
  of the inside_scan complexity.
2018-07-08 15:11:44 +10:00
Michael James Gratton
f0ac998684 Allow blacklisting folders when obtaining email from conversations.
Add an optional blacklist arg to Conversations.get_email and
get_earliest_sent_email and similar methods that specifies folders that
email returned should not be contained within. Also add unit tests.
2018-07-07 11:43:51 +10:00
Michael James Gratton
0e6d499808 Fix AccountInformation.has_email_address, add tests. 2018-07-02 21:22:15 +10:00
Michael James Gratton
98e2d319eb Remove CMake build.
Closes Bug 777044.
2018-06-13 22:30:10 +10:00
Michael James Gratton
13c92c3f7e Convert Credentials and CredentialsMediator to refer to tokens, tidy up.
* src/engine/api/geary-credentials.vala (Credentials): Refer to auth
  tokens, not passwords, so we can use the same object for OAuth2
  auth. Update call sites.

* src/engine/api/geary-credentials-mediator.vala (CredentialsMediator):
  Refer to auth tokens, not passwords, so we can use the same object for
  OAuth2 auth. Remove saving and clearing methods from the interface
  since that's only supported for password storage, not SSO like
  GOA. Update implementations and call sites.

* src/engine/api/geary-account-information.vala (AccountInformation):
  Replace many byzantine auth management methods with just a few for
  handling loading and prompting. Remove ServiceFlag enum now it is no
  longer used. Clean up call sites.

* src/client/accounts/account-manager.vala (AccountInformation): Manage
  initial saving and final deletion of libsecret based accounts here,
  rather than all over the code base.
2018-06-12 13:25:05 +10:00
Michael James Gratton
acac68afed Make ServiceInformation.mediator a required, read-only property. 2018-06-12 13:25:05 +10:00