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
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.
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.
Conversation monitor was built around older assumptions of how a folder's
remote connections work - that once a folder opens it will likely also
eventually establish a remote connection, that once the connection is up
it will hang around, and so on.
This patch removes any public notion of (re)seeding, since it can't be
relied to actually happen over the course of the session, ensures that
all folder operations are local-only when the folder does not have a
working remote connection so it doesn't block, and take the opportunity
to reorganise and clean up the monitor API and documentation comments.
* src/engine/app/app-conversation-monitor.vala (ConversationMonitor):
Remove seed signals, and don't bother running an initial reseed if the
folder is already open, since the fill operation will cause any locally
incomplete messages to be filled out from the report. Manage and use an
internal Cancellable for cancelling internal operations when shutting
down. Construct a queue only when starting to monitor conversations,
delete it when stopping. Move as much operation-specific code into the
operations themselves as reasonably possible, making some methods
internal so thy can be accessed from the ops. Ensure all folder listing
operations specify LOCAL_ONLY when the remote is not open. Removed
LocalLoadOperation since that is now redundant. Update the API for
accessing conversations to match Gee conventions and update call
sites. Update documentation comments. Hook back up to locally-complete
signals so we don't miss emails being filled out by the prefetcher, for
now.
* src/engine/app/conversation-monitor/app-conversation-set.vala
(ConversationSet): Rename conversations property to match Gee
conventions, update call sites.
* src/engine/app/conversation-monitor/app-conversation-operation.vala
(ConversationOperation): Allow operations to specify if they should
allow duplicates, and allow the execution method to throw errors, so
they can be handled in a uniform way.
* src/engine/app/conversation-monitor/app-conversation-operation-queue.vala
(ConversationOperationQueue): Accept progress monitor property as a
ctor arg rather than constructing on itself, so it is tied to the
life-cycle of the ConversationMonitor rather than the queue. Add a
signal for notifying of errors thrown when running operations, and use
the new operation-independent support for determining if duplicates
should be queued.
* src/engine/app/conversation-monitor/app-fill-window-operation.vala
(FillWindowOperation): Enforce a maximum window size as well as minimum
to keep loading large windows semi-responsive. Remove code to handle
inserts now that they are handled by their own op.
* src/engine/app/conversation-monitor/app-insert-operation.vala
(InsertOperation): New operation to manage inserts, handle it them by
simply adding them to the conversation if they are newer than the
oldest message, rather that relisting all loaded messages.
* src/engine/imap-engine/imap-engine-minimal-folder.vala
(MinimalFolder): Ensure remote properties are added to and removed from
the folder's aggregate props when the session is opened or
disconnected, rather when the folder is opened or disconnected. Rather
than scheduling a call to close_remote_session via the replay queue
when it is disconnects, do it immediately since it's a race to re-open
it again, and if the disconnect op loses the race it can't close the
old disconnected session.
* src/engine/imap-engine/replay-ops/imap-engine-replay-disconnect.vala:
Removed, since it is no longer used.
This commit makes the Imap.Account and Imap.Folder classes work somewhat
more like Imap.ClientSession, in that they have become higher-level
wrappers around ClientSession which come and go as the client session
does (i.e. as the connection to the IMAP server comes and goes). Further,
partly decouple account session lifecycle in ImapEngine.GenericAccount
and the folder session in ImapEngine.MinimalFolder from those objects
being opened/closed, so that sessions are created only when open /and/
the IMAP server is available, and disconnected on close /or/ when the
underlying connection goes away.
As a result, GenericAccount and MinimalFolder no longer claims a client
session on open and try to keep it forever. Instead if needed, they wait
for the server to become contactable.
This makes Geary much more robust in the face of changing network
connections - when working offline, resuming after sleep, and so on.