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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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.
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
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
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.
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.
* 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.
* src/engine/api/geary-engine.vala (Engine): Move account_added and
account_removed signals to AccountRemoved since the engine isn't
tracking this any more. Remove bool param from add_account for the same
reason and update call sites.
ConfigFile is a GLib.KeyFile-like class (and is backed by a KeyFile) that
nonetheless provides convenient a high-level API for getting and setting
grouped config values and asynchronous loading and saving.
* src/engine/util/util-config-file.vala: New ConfigFile class.
* src/engine/api/geary-service-information.vala (ServiceInformation):
Require ConfigFile groups rather than KeyFile instances for loading and
saving. Update subclasses and unit tests.
* src/client/accounts/account-manager.vala (AccountManager): Move generic
account key consts here from Config. Instead of using KeyFile directly,
use ConfigFile groups for loading and saving settings. Rename load and
save methods to be a bit more consistent with the class's role, and
make save_account() throw its errors so they can be reported to the
user. Update call sites.
* src/client/accounts/local-service-information.vala
(LocalServiceInformation): Move service-specific config key consts
here, use new ConfigFile groups for loading and saving.
* src/engine/api/geary-config.vala: Removed, all config consts have been
moved to the classes using them and KeyFile convenience methods
subsumed by ConfigFile.
* src/engine/api/geary-engine.vala (Engine): Require a ServiceInformation
object for IMAP and SMTP when creating orphan info objects. Update call
sites.
* src/client/accounts/account-manager.vala (AccountManager): provide
factory methods for constructing local service info objects. Use these
when re-constituting accounts. Use a singleton SecretMediator object
instance as a bonus.
* src/client/accounts/add-edit-page.vala (AddEditPage): Get
ServiceInformation objects from the account manager, pass an instance
of GearyApplication through so it has access to the manager. Update
call chains back to GearyController to pass the app instance through.