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.
* src/engine/api/geary-service-information.vala (ServiceInformation):
Make KeyFile arg mandator for load and save methods, since it will
always need to be provided. Update subclasses.
* src/client/accounts/local-service-information.vala
(LocalServiceInformation): Remove from Geary package since it's not an
engine class. Update call sites.
Instead of passing in user config and data base dirs to the Engine from
the app, then pulling them out from the engine again from the app, just
store them in AccountManager, since that's where they are needed.
* src/client/accounts/account-manager.vala (AccountManager): Store user
config and data base dirs directly rather than getting them from the
engine. Split account directory creation out into a separate method so
they aren't re-made every time the config is saved.
* src/engine/api/geary-engine.vala (Engine): Remove user config and data
dir properties and open_async args. Update call sites and unit tests.
* src/client/application/geary-controller.vala (GearyController): Chase
AccountManager and Engine API changes. Ensure account dirs are created
when an new account is added.
* src/engine/api/geary-account-information.vala (AccountInformation):
Explicitly track copies rather relying on account dirs being
null. Don't require dirs be set in the default ctor, since they won't
be known, provide a method for updating them later on instead.
This reverts commit 43341cd3e3, reversing
changes made to ffb4befdd8.
This is causing segfault in Geary.JS.to_string_released() when running
client tests, so reverting until a solution is found.
This became necessary sooner rather than later since WebKitGTK 2.21
with the upstream valac bindings are now incompatible with the custom
in-source bindings.
Reverting commit 1d8c4aea broke the mailbox class a bit. This fixes the
issue, introduces Ascii.last_index_of which is needed by Mailbox anyway,
and adds some test for it. Also 'optimises' Ascii.index_of bit as well.
This introduces the Geary.RFC822.Part class, which provides a place to
MIME entity body decoding code so it can be reused when needed. It also
provides a place to put common GMime to Geary object conversion, and
apply some common policy decisions, such as what is the default content
type if none is specified.
* src/engine/rfc822/rfc822-part.vala: New Part class that represents a
MIME entity. Move code for both decoding entity body from
RFC822.Message and code for cleaning content filename from RFC822.Util
to here. Convert GMime entity header objects into their Geary
equivalents and make available as properties. Provide a common means of
determining the content type of the part if not explicitly set.
* src/engine/rfc822/rfc822-message-data.vala (PreviewText.with_header):
Construct a RFC822.Part and use that for decoding preview text. Swap
args to make some more sense and update call sites.
* src/engine/rfc822/rfc822-message.vala (InlinePartReplacer): Simply pass
through an instance of a RFC822.Part rather than the multi-arg list,
since that has all the data needed by replacers.
* src/engine/imap-db/imap-db-attachment.vala (Attachment): Require and
use RFC822.Part instances for obtaining attachment bodies rather than
GMime.Part instances. Update call sites.
* src/engine/rfc822/rfc822-message.vala (Message): Fix has_plain_body(),
handle the case where displayed MIME entities (as opposed to attached
ones) with no Content-Type default to US-ASCII, per the RFC.
* test/engine/rfc822-message-test.vala (MessageTest): Add tests for
testing and accessing body content as both plain text and HTML. Use
GResources for accessing test message bodies rather than extremely long
const strings.
This replaces the const ContentType.DEFAULT_CONTENT_TYPE string and
related code with static defaults for both displayed and attached MIME
entities.
* src/engine/mime/mime-content-type.vala (ContentType): Replace
DEFAULT_CONTENT_TYPE const with static DISPLAY_DEFAULT and
ATTACHMENT_DEFAULT static instances. Remove is_default() since that no
longer makes sense. Update call sites and unit tests.
* src/engine/mime/mime-content-parameters.vala (ContentParameters): Make
the class immutable so it is safe to be used as a component of the
static ContentType DISPLAY_DEFAULT and ATTACHMENT_DEFAULT members.
This mostly aims to make the Geary.Attachment and ImapDB.Attachment
objects usable more generally for managing attachments, allowing
these to be instantiated once, persisted, and then reused, rather than
going through a number of representations (GMime, SQlite, Geary) and
having to be saved and re-loaded.
* src/engine/api/geary-attachment.vala (Attachment): Remove id property
and allow both file and filesize properties to be set after instances
are constructed. Update call sites.
* src/engine/api/geary-email.vala (Email): Remove get_attachment_by_id
since it unused.
* src/engine/imap-db/imap-db-attachment.vala (Attachment): Chase
Geary.Attachment API changes, move object-specific persistence code
into methods on the actual object class itself and modernise a
bit. Rename static methods to be a bit more terse. Update call sites
and add unit tests.
* src/engine/imap-db/imap-db-folder.vala (Folder): Rather than saving
attachments to the db then reloading them to add them to their email
objects, just instantiate Attachment instances once, save and then add
them.
* src/engine/imap-db/imap-db-gc.vala (GC): Replace custom SQL with
existing accessor for listing attachments.
* src/engine/util/util-stream.vala (MimeOutputStream): New adaptor class
for GMime streams to GIO output streams.
This stops generating account storage paths, and in particular the
location of attachment files, in a number of different places. Instead,
we determine the paths once, in ImapDb.Account and pass them around as
needed. This will help making the ImapDB classes unit-testable, and
in particular ImapDb.Folder by passing an instance of Db.Database,
rather than ImapDb.Database.
This makes both the open() and open_connection() methods on
Geary.DB.Database asynchronous, which allows the VersionedDatabase
open_background() and its hackery to be removed, and upgrades to be
performed asynchronously as well. It also adds a
exec_transaction_async() method to Connection, allowing an existing
object to also be used to establish an async transaction.
* src/engine/db/db-connection.vala (Connection): Add
exec_transaction_async method, update doc comments.
* src/engine/db/db-database.vala (Database): Make open and
open_connection async by executing SQLite code in a background thread,
update call sites. Move job management code out of
exec_transaction_async into a new internal add_async_job() method so it
can be used by Connection. Add unit tests.
* src/engine/db/db-transaction-async-job.vala (TransactionAsyncJob): Add
an optional internal connection method and make the job's cancellable
an internal property so a Connection instance can specify itself for
the transaction.
* src/engine/db/db-versioned-database.vala (VersionedDatabase): Remove
open_background() hack since open() is now async. Make version upgrade
hooks for derived classes async and update call sites. Use a
Nonblocking.Mutex rather than GLib mutex so upgrade exclusion works
asynchronously. Add unit tests.
* src/engine/imap-db/imap-db-database.vala (Database): Make database
upgrade methods async and execute SQL in async instructions now that
the bases classes support it. Add unit tests.
* src/engine/app/app-conversation-monitor.vala (ConversationMonitor):
Don't check the folder blacklist for external folder signals when the
signal is received, do it when the operation is executed so it's fresh.
* src/engine/app/conversation-monitor/app-fill-window-operation.vala
(FillWindowOperation): Only re-fill the conversation if we get a full
load, anything else means we hit the end of the folder.
* test/engine/app/app-conversation-monitor-test.vala: New unit tests
for ConversationMonitor.
* test/engine/api/geary-account-mock.vala,
test/engine/api/geary-folder-mock.vala: Mix in MockObject mock up all
method calls.
* test/engine/api/geary-email-identifier-mock.vala: Fix the comparator
method when the other instance is null.