Some servers (e.g. Dovecot) use placeholder strings instead of the empty
string (e.g. "MISSING_DOMAIN") in FETCH Envelope responses when a
required address part (e.g. local part, domain) are empty.
This adds a quirk that can be enabled for such servers to check for the
placeholders and if found, replace them with empty strings.
Now that we have classes logging on sub-domains, and the ability to
suppress specific domains, remove flags and switch over to doing
domain suppression for manipulating debug settings in the client.
The GVariant type "*" only matches a single data type, not many, and
the sense of the test to check serialised ids was wrong anyway. As a
reuslt, this method probably never worked. Add a unit test.
FDO 19.08 runtime now includes C.UTF-8 locale, but since Fedora
now ships one that collates high-bit chars, it differs compared
to Debian et al's and FDO.
As a result, just use en_US.UTF-8 for now, probably until glibc
actually ships it and so they all agree.
The only reason it was in the engine was so it could be used by both
the client and the web extension, without worrying about the
webkit2gtk and webkit2gtk_web_extension packages conflicting. However
it didn't really belong there, and added a dependency for the engine
on javascriptcoregtk which doesn't belong. So this fixes all that.
Geary.ImapDb.Database/utf8_case_insensitive_collation depends on a well
known UTF-8 collation order, but distros only ship C.UTF-8 by default
and Flatpak doesn't ship that, so support en_US.UTF-8 as a fallback.
See https://gitlab.com/freedesktop-sdk/freedesktop-sdk/issues/812
Replaces harvesting code in ImapDB code so as to be stand-alone and
reusable. Implement harvesting policy to only harvest from a set of
whitelisted special folder types (so junk and trash is not harvested)
and only harvest valid, non-spoofed, addresses.
Remove CI test workaround
See merge request GNOME/geary!198
(cherry picked from commit 8654c7ae136d2467f7b5b2e85a436d9039bd64bc)
4fc688de Revert "Work around DB tests always failing on gcc150.osuosl.org CI runner"
6b4b598a Add test runner multiplier to account for slow CI runners
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.
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.
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.
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 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 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.
This adds a check for malware spoofing of RFC 822 mailbox addresses such
as those found in Mailsploit, and if found only displays the email
address part and not the mailbox name part.
Part 1 of Mailsploit mitigation.
* src/engine/rfc822/rfc822-mailbox-address.vala (MailboxAddress): Add new
is_spoofed method to check if the mailbox address looks like it has
been spoofed. Add is_distinct method to determine if the name and the
label is the same. Do whitespace and non-printing character stripping
when generating display versions of the mailbox address, rename methods
to make it more obvious what they do and update call sites. Add unit
tests to cover all this.
* src/client/conversation-viewer/conversation-message.vala
(ConversationMessage): Check name is distinct and is not valid before
displaying it. Use new MailboxAddress methods for getting display
versions of the address, to ensure we get the stripped versions of the
addresses.
* src/client/conversation-list/formatted-conversation-data.vala
(ParticipantDisplay): Ensure full addresses are always HTML-markup
escaped before displaying them as markup, to avoid dropping "<address>"
values as invalid HTML. Always show the full address if an address is
invalid.
* src/engine/util/util-string.vala (reduce_whitespace): Strip not only
whitespace but also non-printing characters. Add unit tests.
This generalises the approach used to execute the flag watcher and
background sync, provides a high-level means of managing local and remote
operations, and provides a means of compartmentalising operation-specific
code.
* src/engine/imap-engine/imap-engine-account-operation.vala
(AccountProcessor): Interface for denoting classes that implements some
account-specific operation.
* src/engine/imap-engine/imap-engine-account-processor.vala
(AccountProcessor): Class to manage the operation queue and execute
operations.
* src/engine/imap-engine/imap-engine-generic-account.vala
(GenericAccount): Create and manage an instance of AccountProcessor,
add queue_operation method to allow operations to be queued.
This allows us to compile the engine tests against the internal VAPI, so
we can unit test internal classes.
* CMakeLists.txt: Add top-level targets test-engine-run and
test-client-run that execute the respective test binaries. Make
the tests target depend on them and make them depend on their
binaries.
* Makefile.in: Add test-client and test-engin targets for convenience.
* src/CMakeLists.txt: Make the right invocation of valac to generate a
correct geary-engine-internal.vapi. Make gsettings schema generation
depend on geary-client so it exists for test-client if the main binary
hasn't been built.
* test/CMakeLists.txt: Split everything up into to builds, one for
test-engine and the other for test-client. Use geary-engine-internal
when building test-engine for access to internal classes and members.
* test/engine/util-idle-manager-test.vala,
test/engine/util-timeout-manager-test.vala: Use Glib MainContext rather
than the GTK main loop for pumping events so the test cases compile
without GTK.
* test/test-engine.vala, test/test-client.vala: New main source file for
test binaries based on old main.vala.
* src/engine/app/conversation-monitor/app-conversation-set.vala
(ConversationSet.add_all_emails_async): Replace monitor arg with a
multiset of email paths, update call site to do the path lookup on the
caller's side instead. Add unit tests.
(ConversationSet.merge_conversations_async): Remove monitor arg with a
multiset of email paths, get paths for emails to be merged from the
conversations themselves, since they should be up to date.
(Conversation.remove_all_emails_by_identifier): Add unit tests.
* src/engine/app/app-conversation.vala (Conversation): We currently can't
easily unit test Conversation instances since the ctor requires a
ConversationMonitor argument, which is complicated. Replace the monitor
arg with a base folder (which is what it actually needs the monitor for
anyway) and remove the signals in favour of adding and modifying the
API to allow folder paths to be explicitly updated. Remove
clear_owner() method and dtor now it's useless. Update call sites. Add
unit tests to make sure the add/remove and multi-path related code
still works at least.
This allows us to compile the engine tests against the internal VAPI, so
we can unit test internal classes.
* CMakeLists.txt: Add top-level targets test-engine-run and
test-client-run that execute the respective test binaries. Make
the tests target depend on them and make them depend on their
binaries.
* Makefile.in: Add test-client and test-engin targets for convenience.
* src/CMakeLists.txt: Make the right invocation of valac to generate a
correct geary-engine-internal.vapi. Make gsettings schema generation
depend on geary-client so it exists for test-client if the main binary
hasn't been built.
* test/CMakeLists.txt: Split everything up into to builds, one for
test-engine and the other for test-client. Use geary-engine-internal
when building test-engine for access to internal classes and members.
* test/engine/util-idle-manager-test.vala,
test/engine/util-timeout-manager-test.vala: Use Glib MainContext rather
than the GTK main loop for pumping events so the test cases compile
without GTK.
* test/test-engine.vala, test/test-client.vala: New main source file for
test binaries based on old main.vala.