Commit graph

65 commits

Author SHA1 Message Date
Michael Gratton
4f9df7d74a engine: Remove in-tree unicodesn stemmer
Now that search is using libstemmer, the in-tree stemmer is no longer
needed and can be removed.
2020-10-14 20:05:15 +11:00
Michael Gratton
968bc1a9e8 ImapDb.SearchQuery: Use libstemmer for stemming
Instead of shipping our own forked stemmer via SQLite, add a dependency
on libstemmer and use that instead.
2020-10-14 20:05:12 +11:00
Michael Gratton
aaa2934acf meson_options.txt: Update to use meson best practices and clean up
Convert to use meson features for features. Reorganise and rename
options for consistency. Make descriptions a bit less redundant.
2020-10-03 23:34:31 +10:00
Michael Gratton
257f6fb901 Geary.Db.Connection: Split up into db and transaction-specific impls
Convert `Connection` into an interface, add two concrete implementations
that allow splitting up the database connection used generally, and the
connection passed to transactions. This allows limiting the API surface
that transactions have access to (so they can't e.g. create
sub-transactions) and perform transaction-specific work (e.g. better
logging when an error occurs).
2020-09-05 13:25:41 +10:00
Michael Gratton
a123983cb0 Geary.Imap: Remove COMPRESS command
Geary hasn't used compression for IMAP in a while now due to the
possibility of information leakage for secure connections, so remove
the command as well.
2020-09-02 14:54:42 +10:00
Michael Gratton
35683dd6eb build: Reduce verbosity of meson vars by removing geary_ prefixes 2020-08-13 19:51:33 +10:00
Michael Gratton
c2a1bae025 Geary.Memory.OffsetBuffer: Remove now unused class 2020-07-30 12:53:11 +10:00
Michael Gratton
ddb3a899fb Geary.Imap: Add Quirks object to collect all IMAP service quirk config 2020-05-04 10:53:31 +10:00
Michael Gratton
00f0fb9665 Geary.Logging: Move remaining code from api source to util source
Now that the flags code is gone, move the remaining code from
`src/engine/api/geary-logging.vala` into
`src/engine/util/util-logging.vala`, and remove the former source file.
2020-04-15 17:31:16 +10:00
Michael Gratton
8dcab7f306 Geary.SpecialFolderType: Rename class and related properties, signals
The `SpecialFolderType` was somewhat mis-named, since the special use
does not (in most cases) confer any special type, rather it's simply
defines what a particular folder is used /for/.

As such, rename the enum to to `Geary.Folder.SpecialUse`, moving it in
to the `Folder` class, since it relates specifically to folders, also
rename `Folder::special_folder_type` and
`Folder::special_folder_type_changed` reflect the above and not
duplicate the type name, and similarly rename
`Account::folders_special_type`.

Update the many call sites.
2020-03-31 16:15:57 +11:00
Michael Gratton
b46838f100 Update Geary.Imap.Capabilities handling
Move Capabilities to the api directory and make immutable.

Don't pass around out params to simply increment the revision and use a
field in ClientSession, just use the last capability instance. Ensure
after starting a TLS session capabilities are cleared. Add unit tests
for getting both implicit and explicity capaibilities when initiating
a client session.
2020-03-27 08:29:14 +11:00
Mart Raudsepp
91f78fb411 build: Fix automagic dependency on ytnef library
It would be best to use meson feature option type for ytnef and unwind,
but for now fix the automagic dependency on ytnef with the existing
meson_options.txt setup.
It was adding ytnef to list of dependencies unconditionally, and then
also if tnef-support was enabled. So if the option was disabled, but the
pkg-config file was present, it would still link to it surprisingly.
Just remove the unconditional addition to dep, and rely on the already
existing conditional addition to deps.
2019-12-26 19:28:07 +02:00
Michael Gratton
f025f6904d Move SearchFolder management into the client
Rename the search folder again to App.SearchFolder, move its id class
into it as an inner class. Remove search folder from the engine so the
application can manage it and it's policy in the future. Also remove
the outbox from the accout's list of local folders, so that code can
be removed altogether.
2019-12-18 09:25:07 +11:00
Michael Gratton
924104c282 Clean up search folder implementation
Move SearchFolder and search EmailIdentifier implementation out of
ImapDb and into its own package. Decouple both from ImapDB, and improve
the implementation, fixing a few inefficiencies. Merge search
FolderProperties into the SearchFoldern implementation as an inner
class.

Merge SearchTerm into ImapDB.SearchQuery as an inner class and move the
outer class's source down a level, since it was the only file left in
the imap-db/search dir.
2019-12-12 10:47:52 +11:00
Michael Gratton
978ff12810 Rename Geary.Loggable to Geary.Logging.Source
Rename the class because we need to distinguish between logging sources
and logging state, for cases when the logged object's state may change
between being logged and being displayed.

Rename util souce file to match new name space per source code
convernstion.
2019-12-01 19:37:15 +11:00
Michael Gratton
2d47e4802b Re-select folder, conversation and email on EmailCommand undo
When an EmailCommand is undone, select the folder, conversation and if
relevant scroll to the email in question so as to provide better
context.

This isn't 100% bulletproof, but is about 80% of the way there. The
remainer requires some major Engine rework to decouple local and remote
actions.
2019-11-07 11:58:56 +11:00
Michael Gratton
af2915707d Consistently use '..._c_args' and '..._vala_args' for meson vars 2019-09-27 23:56:52 +10:00
Christopher Davis
bfcee9bff7 build: Set up dual install for flatpak
Part of https://gitlab.gnome.org/GNOME/Initiatives/issues/1;
Sets up dual installation for flatpaks, allowing us to
build and run geary without affecting our system install.
This will allow testing of nightlies and CI artifacts as well
via the flatpak, so we can iterate on designs and share
bundles to test with.
2019-08-26 09:38:31 -07:00
Michael Gratton
df8a96c104 Clean up meson dependency lists 2019-07-21 10:05:24 +10:00
Michael Gratton
da6ac828bd Move Geary.JS package into client as Util.JS
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.
2019-07-21 10:00:32 +10:00
Michael Gratton
f7c833242a Add Geary.Loggable interface for objects that can log and be logged
For now, just implement using existing non-structured logging calls.
2019-06-30 16:14:50 +10:00
Michael Gratton
65ab37938f Implement new contact harvester for the engine
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.
2019-06-13 16:32:47 +10:00
Michael Gratton
5ab35da47b Clean up contact importance API
Move Importance enum into Contact since it's only used there, simplify
members and clean up call sites.
2019-06-13 16:29:49 +10:00
Michael Gratton
cb8150ce03 Remove existing contact harvesting mechanism
Remove contact harvesting from DB version 005 (version 0.1.1), allowing
the implementation of both ContactStoreImpl and ImapDB.Database to be
cleaned up. Remove contact collection from ImapDB.Folder, reducing the
numer of Gee objects created when creating/merging messages. Finally,
remove the MessageAddresses object now that it is unused.
2019-06-13 16:28:59 +10:00
Michael Gratton
2ff2d2421f Clean up ContactFlag API
Move ContactFlag class into Contact class, rename Contact.flags property
to avoid redundancy and make it non-nullable to be able to simplify its
use.
2019-06-13 16:28:51 +10:00
Michael Gratton
0b734f7ba2 Don't load all engine contacts on startup
Prepare for doing composer autocomplete via queries by not loading all
contacts at startup in the engine. Update Geary.ContactStore API to that
end, and convert Geary.Account.get_contact_store accessor method to a
property.
2019-06-13 16:28:35 +10:00
Michael Gratton
4497b1275a Merge branch 'tnef-support' into 'mainline'
TNEF (winmail.dat) parsing support via libytnef

See merge request GNOME/geary!10
2019-04-16 12:38:25 +00:00
Greg V
6acddfd02c engine: add missing libm dependency
floor() is now used at rfc822-message-data.vala:213 via GLib.Math.floor
2019-04-11 19:36:19 +03:00
Oliver Giles
18fcf0e18f TNEF (winmail.dat) parsing support via libytnef 2019-04-11 12:24:52 +03:00
Michael Gratton
9c115bec38 Clean up protocol date handling substantially
In RFC822.Date, don't use duplicate time_t and GLib.DateTime properties
-- just use the latter, fix formatting of half-hour time zones, fix
where the that class refers to ISO 8601 instead of RFC822 strings since
that is just plain wrong, and finally when parsing an RFC 822 string,
take note of the timezone offset and store that in the DateTime object,
so it is round-tripped correctly.

Stop passing time_t around everywhere else, just use the UNIX time from
the DateTimes we store for protocol objects anyway, so the time zone is
obvious.

Add unit tests.
2019-03-23 15:21:18 +11:00
Michael Gratton
133167dfd0 Add a common interface for accessing headers from email classes.
This allows either type to be used interchangably as a source of
header data. Add documentation comments for the headers, add missing
message_id property to RFC822.Message.
2019-03-09 20:17:01 +11:00
Thomas Moschny
a1377f3451 Allow to opt-out from using libunwind. 2019-02-17 17:56:46 +01:00
Michael Gratton
72ba5e688a Remove unused source file 2019-02-15 14:04:57 +11:00
Michael Gratton
5152581a0c Merge branch 'wip/181-special-folder-dupes' into 'master'
Fix special folder duplicates

Closes #181

See merge request GNOME/geary!82
2019-01-14 14:08:49 +00: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
668e4b469a Merge branch 'buildfix' into 'master'
Meson build fixes for FreeBSD

See merge request GNOME/geary!78
2019-01-10 12:20:58 +00:00
Michael Gratton
319ea1dada Fix meson config warning 2019-01-10 23:09:12 +11:00
Greg V
f09e5d7c6d Use backup extension when calling sed -i
BSD sed doesn't support -i without the backup extension.
2019-01-09 12:30:49 +03:00
Michael Gratton
92353bf0c9 Add Geary.ErrorContext class for passing rich error context info around
Require ClientService implementations and ProblemReport use contexts
rather than bare errors. Move code for generating backtraces and and
formatting errors from ProblemReport to ErrorContext.
2019-01-07 22:10:34 +11:00
Michael Gratton
3dc60793c8 Move SmtpOutbox impl out of ImapDB, rename to just Outbox
Outbox code now effectively does not depend on ImapDB, and no longer
contains any SMTP code, so this moves it to it's own top-level engine
package and removes SMTP from its name.
2018-11-30 23:49:30 +11:00
Michael Gratton
eb691ce7af Implement ClientService for SMTP (3/3)
This splits off the sending part of SmtpOutboxFolder into a new
Smtp.ClientService class that uses the standard Folder APIs for managing
mail in the outbox, and makes SmtpOutboxFolder handle local mail
CRUD operations only. This enables removing SmtpOutboxFolder from
ImapDB.Account and managing it from GenericAccount instead.

Part three of a three part series.
2018-11-30 23:49:30 +11:00
Michael Gratton
62c90e40db Implement ClientService for IMAP (2/3)
Rename ClientSessionManager to ClientService, make it extend Geary.ClientService and implement
its signauture. Use this as GenericAccount's incoming client service.

Part two of a three part series.
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
1dd36d846a Fix occasional "geary-engine.h: No such file or directory" build errors
E.g. https://gitlab.gnome.org/GNOME/geary/-/jobs/156541

On a sufficiently (non?) parallel system, targets that depend on
geary-engine.h may get built before the geary_engine_internal_vapi
custom target that fixes its location is executed. This removes the
workaround for b.g.o #731322 since that was fixed in 0.40, and updates
workaround for the internal VAPI to be minimally intrusive.
2018-11-29 20:57:38 +11:00
Michael Gratton
6df979dade Add support for creating/deleting folders to the console app 2018-09-26 23:54:47 +10:00
Michael James Gratton
f8e4c2ad93 Remove AUTHENTICATE-specific parameter and IMAP session code.
This is no longer needed now that AuthenticateCommand takes care of its
own continuations.
2018-09-01 22:09:18 +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
865f23beba Add support for (X)OAuth2 IMAP authentication. 2018-06-12 13:25:05 +10:00
Michael James Gratton
ada7f3fdbb Add support for (X)OAuth2 SMTP authentication. 2018-06-12 13:25:05 +10:00
Michael James Gratton
863a11e780 Rename Geary.Service to Protocol, move into ServiceInformation source. 2018-06-12 13:25:05 +10:00