Commit graph

45 commits

Author SHA1 Message Date
Michael Gratton
f5f9350d2f Consistently use '_dir' suffix for meson directory variables 2019-09-27 23:55:32 +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 James Gratton
98e2d319eb Remove CMake build.
Closes Bug 777044.
2018-06-13 22:30:10 +10:00
Niels De Graef
01c13f726f Port build system to Meson. Bug 777044.
Some remarks:

* Note that Meson adds a hard dependency on Python 3.

* All dependencies and defines are now listed together.

* Some build files were put in their respective subdirectories, e.g. the Geary
  engine library will be built from the Meson file in `src/engine`.

* `--fatal-warnings` is no longer an explicit flag, as Meson provides
  `-Dwerror=true` for this.

* An explicit resource file needs to be used. The issue to support this from
  Meson itself can be found at https://github.com/mesonbuild/meson/issues/706 .

* The `gnome.yelp()` function parses a LINGUAS file so we no longer need to keep
  track of all languages in our build system.

* There are no Debian scripts defined in the meson.build files to keep them
  clean, but they can be kept as separate scripts in `build-aux`.

* Left out the `dist` target as there is now `ninja dist`

* `geary-docs` is disabled by default, as valadoc-0.38.3 returns errors.

https://bugzilla.gnome.org/show_bug.cgi?id=777044
2017-12-12 00:27:46 +01:00
Michael James Gratton
3e721feedb Rebuild MessageSearchTable. Database version 25. Bug 772522.
* sql/version-025.sql: Rebuild MessageSearchTable, and while we're here
  optimise it as well.
2016-10-22 07:34:30 +11:00
Jim Nelson
23511dc36c Periodic database & attachments garbage collection: Bug #714134
See the ticket (comment #2) for more information on the thinking and
strategy here, but in a nutshell this will remove from the Geary
database all emails no longer accessible via any folder and not seen
on the server in over 30 days.  It also deletes those messages
attachment(s) and removes any empty directories in the attachment/
directory to prevent clutter.  If enough messages are garbage
collected, Geary will vacuum the database at startup, which will
lower its disk footprint and reduce fragmentation, potentially
increasing performance.
2014-12-18 17:00:47 -08:00
Jim Nelson
533ab75ee3 Improved search experience: Bug #720361
This introduces a new full-text search algorithm that attempts to
curb the effects of overstemming in the Porter Snowball stemmer.
The FTS table will be regenerated with this update.

The crux of this new algorithm is a configurable heuristic that
reduces stemmed matching.  The configuration is not available via the
UI (I suspect it will only confuse users) but can be changed by power
users via GSettings.  More information is available at:

https://wiki.gnome.org/Apps/Geary/FullTextSearchStrategy
2014-12-16 12:26:31 -08:00
Jim Nelson
58c7a4b6d2 Include new .sql file in installation. 2014-08-13 12:20:05 -07:00
Jim Nelson
a9db6e8c44 Show attachments lacking a Content-Disposition: Bug #713830
Attachments without Content-Disposition are now generated and shown
in the client.  This requires a database upgrade as well as rescanning
all messages to generate the previously missing attachments.

In addition, this upgrade now stores the attachments' Content-ID in
the database.  This makes it much easier for the client to associate
a particular MIME section in the RFC822 message with an attachment in
the database and on disk.
2014-08-12 14:22:57 -07:00
Charles Lindsay
c3e5270517 Fix a number of database hiccups
1) Use docid instead of id in search table.

We had previously included an 'id INTEGER PRIMARY KEY' column in the
MessageSearchTable, assuming it would get the same rowid alias treatment
as it does in non-FTS tables.  That assumption was wrong: it was being
created as a FTS column.  This fixes it so we use docid everywhere.

To fix the old incorrect docid values, we simply blow away the search
table and let the natural search table population process, which now has
the correct docid insertion code, fix the problem.

This also removes the id column from the search table creation SQL, but
this will only affect new users.  Upgraders will see an empty, vestigal
id column in their search table.  Since SQLite doesn't easily let you
remove columns, it's just easier to ignore the column than go through
all the work to fix it.

2) Do as many rowid lookups as possible in batches, instead of doing
them individually in loops.  This speeds up working with large sets of
email.

3) Rejigger indices on the MessageLocationTable to make certain queries
faster.  This creates a new covering index in particular for the email
prefetcher, which previously had to sort using a temp table.  The new
index should work in the general case too, as we should never be looking
at ordering without folder_id (and since folder_id comes first, it works
as an index on just folder_id, too).

4) For bonus measure, log all slow queries (> 1s execution time) to
debug output.

Closes: bgo #725929
2014-03-12 16:39:22 -07:00
Charles Lindsay
85d1a97129 Don't multithread db upgrades
Turns out for long-running upgrades we were running them all in
parallel, which thrashes the disk pretty hard.  This adds a simple mutex
lock around each upgrade, so at least the computer is usable while it's
going on.  A more robust solution would be to have a single-thread
thread pool where we enqueue upgrades, but that's too much change this
late in the release cycle.

Also it turns out that the nullifying of the internaldate_time_t column
before we repopulate it was very costly, and unnecessary.  So, this also
should speed things up for upgrading users.

Closes: bgo #724475
2014-03-03 17:40:53 -08:00
Charles Lindsay
0f6e76edb3 Validate contact emails before adding
Also updates the DB to filter out existing invalid contacts.

Closes: bgo #713932
2014-02-21 15:00:57 -08:00
Charles Lindsay
4dc5d28c58 Fix wrong internaldate_time_t column
We had a bug in our DateTime to time_t conversion logic where all
time_ts would end up in the year 3800.  This fixes that, and repopulates
the internaldate_time_t column with the new, correct time_t values.

Closes: bgo #724335
2014-02-14 16:06:10 -08:00
Charles Lindsay
6631ed91cb Install version-017.sql
Closes: bgo #723281
2014-01-30 10:37:08 -08:00
Charles Lindsay
cce04b814f Add option to save sent mail
This adds the ability for Geary to push sent mail up to the account's
Sent Mail folder (if available).  There's an accompanying account option
that defaults to on (meaning: push sent mail).

The current implementation will leave messages in the Outbox (though
they won't be sent again) if they fail to be pushed to Sent Mail.  This
isn't the best solution, but it at least means you have a way of seeing
the problem and hopefully copying the data elsewhere manually if you
need to save it.

Note that Geary might not always recognize an account's Sent Mail
folder.  This is the case for any "Other" accounts that don't support
the "special use" or "xlist" IMAP extensions.  In this case, Geary will
either throw an error and leave messages in the Outbox, or erase the
message from the Outbox when it's sent, depending on the value of the
account's save sent mail option.  Better support for detecting the Sent
Mail folder in every case is coming soon.

Closes: bgo #713263
2014-01-29 18:18:31 -08:00
Charles Lindsay
64dd643760 Index attachment filenames properly; fix #7575 2013-10-02 12:56:25 -07:00
Jim Nelson
29ae18b3f0 In Non-English locales, Geary displays wrong month: Closes #7354
Stricter parsing and application of INTERNALDATE.
2013-09-25 18:04:58 -07:00
Eric Gregory
3a5085765d Closes #7544 Add newest DB version to installer 2013-09-25 16:16:22 -07:00
Charles Lindsay
4b03618f08 Set SQLite page size to 4K: Closes #7423
This speeds up startup time immensely, probably due it matching the
the filesystem's or Linux memory mgmt's page size.  It's also
expected that this will improve database performance in other ways,
as the default was 1K, meaning potentially more I/O than necessary
for standard operations.
2013-09-24 18:48:12 -07:00
Avi Levy
6867987074 Non-image inline attachments not shown in client: Closes #5748
This processes existing email for inline attachments and adds them
to the attachments table, doing the same for new mail as it arrives.
2013-07-19 16:28:56 -07:00
Charles Lindsay
ad0deb9eb5 Add new SQL files to install list; fix #7160 2013-06-25 16:49:59 -07:00
Charles Lindsay
fca993fec7 Merge branch 'master' into feature/search
Conflicts:
	sql/version-010.sql
	src/client/folder-list/folder-list-folder-entry.vala
	src/engine/rfc822/rfc822-message.vala

Also, I had to manually fix some compile errors introduced due to
interfaces changing on master.
2013-06-24 17:54:41 -07:00
Eric Gregory
dc26b19aac Closes #7120 Store and update unseen count in database 2013-06-21 18:20:56 -07:00
Charles Lindsay
a77874620e Limit search results from DB; fix #7049
This caps the search results at 1000 emails, due to our unfortunate
requirement of constructing an object for each search result.  A better
way to proceed here would be to do the search only as items were loaded
in the SearchFolder, but that gets complicated when the search phrase
gets updated.
2013-06-10 12:21:28 -07:00
Charles Lindsay
a4f680b4ff Basic search table implementation; fix #6766
This is a limited implementation, so please backup your database before
running this search feature branch from now on as we may change things.

It's using a Unicode Snowball stemming tokenizer available from
https://github.com/littlesavage/sqlite3-unicodesn, also handily
available in src/sqlite3-unicodesn in Geary.  If you want to look at the
search tables on the command line, cd into the unicodesn source folder,
run make and make install, then load sqlite3 like:

   sqlite3 -cmd '.load unicodesn.sqlext' /path/to/geary.db
2013-05-17 15:32:52 -07:00
Robert Schroll
974e9459a3 Allow external images from whitelisted senders to be displayed: Closes #5642
This also cleans up some of the update logic for ContactTable, which
could drop contacts' human-readable names when updating their
importance.
2013-05-14 18:07:53 -07:00
Charles Lindsay
eb643abaa6 Add index to in_reply_to column; fix #6504
Since we're searching on the column, we should have an index on it.
2013-03-11 14:34:33 -07:00
Jim Nelson
f54f805501 Prefetch mail in background according to age of message: Closes #6365
This introduces a background account synchronizer into Geary that
prefetches email folder-by-folder to a user-configurable epoch.  The
current default is 15 days.

Additional work to make this user-visible is coming, in particular with

The primary purpose for this feature is to allow "full" conversations
(#4293), which needs more of the mailbox stored locally to do searching.
2013-02-25 20:18:37 -08:00
Charles Lindsay
cee5a81df1 Properly decode Unicode folder names; fix #5217
Previously, we were taking folder names as they came off the wire.
Turns out IMAP specifies that folder names with 8 bit code points are
encoded in a crazy scheme unique to IMAP.  Now, we properly decode that
scheme to the correct UTF-8 folder names to be displayed to the user.

There's also now a database upgrade path that converts all existing
mailboxes to the decoded version, so your existing database should just
keep working.
2013-02-25 15:01:37 -08:00
Jim Nelson
7f741b0a2c Install process missed version-005.sql: Closes #5715 2012-08-25 18:45:25 -07:00
Matthew Pirocchi
f9d4c7cb9e Autocomplete addresses in To, CC, BCC fields: Closes #4284. 2012-08-16 16:07:43 -07:00
Jim Nelson
0e2a533438 Remove SQLHeavy: Closes #5034
It is done.

Initial implementation of the new database subsystem

These pieces represent the foundation for ticket #5034

Expanded transactions, added VersionedDatabase

Further expansions of the async code.

Moved async pool logic into Database, where it realistically
belongs.

Further improvements.  Introduced geary-db-test.

Added SQL create and update files for Geary.Db

version-001 to version-003 are exact copies of the SQLHeavy scripts
to ensure no slight changes when migrating.  version-004 upgrades
the database to remove the ImapFolderPropertiesTable and
ImapMessagePropertiesTable, now that the database code is pure
IMAP.

When we support other messaging systems (such as POP3), those
subsystems will need to code their own database layers OR rely on
the IMAP schema and simply ignore the IMAP-specific fields.

ImapDB.Account fleshed out

ImapDB.Folder is commented out, however.  Need to port next.

ImapDB.Folder fleshed out

MessageTable, MessageLocationTable, and AttachementTable are now
handled inside ImapDB.Folder.

chmod -x imap-db-database.vala

OutboxEmailIdentifier/Properties -> SmtpOutboxEmailIdentifier/Properties

Moved SmtpOutboxFolderRoot into its own source file

SmtpOutboxFolder ported to new database code

Move Engine implementations to ImapDB.

Integration and cleanup of new database code with main source

This commit performs the final integration steps to move Geary
completely over to the new database model.  This also cleans out
the old SQLHeavy-based code and fixes a handful of small bugs that
were detected during basic test runs.

Moved Outbox to ImapDB

As the Outbox is tied to the database that ImapDB runs, move the
Outbox code into that folder.

Outbox fixes and better parameter checking

Bumped Database thread pool count and made them exclusive

My reasoning is that there may be a need for a lot of threads at
once (when a big batch of commands comes in, especially at
startup).  If performance looks ok, we might consider relaxing
this later.
2012-07-11 15:40:39 -07:00
Jim Nelson
ed235a106b SQL upgrade scripts not installed: Closes #5436 2012-06-21 11:58:15 -07:00
Eric Gregory
6963063fd5 Send outgoing messages via Outbox folder: Closes #4569
Squashed commit of many patches that merged Eric's outbox patch
as well as additional changes to upgrade the database rather than
require it be wiped and some refactoring suggested by the Outbox
implementation.  Also updated Outbox to be fully atomic via
Transactions.
2012-06-13 11:54:20 -07:00
Nate Lillich
0258a20ad9 Closes #3809. Attachments are now available through the message viewer and are saved as individual files outside of the database. 2012-06-08 12:39:27 -07:00
Eric Gregory
9e3bab47f0 Closes #4982 Closes #4964 Switched to CMake, added an installer/uninstaller 2012-04-23 18:54:26 -07:00
Eric Gregory
049a718c34 Archive/delete and mark unread now use ReplayQueue. Closes #4526 2012-01-09 10:58:13 -08:00
Jim Nelson
18716ae6ce Fetches only a small portion of the message for previews: Closes #4254, Closes #3799
Before we were fetching the entire message body (including attachments) to get the
preview text.  This patch now offers the ability to fetch a small (128 byte) preview
of the email.

Also, since this ticket is about speeding up performance, I've introduced NonblockingBatch,
which allows for multiple async operations to be executed in parallel easily.  I've added
its use in a few places to speed up operations, including one that was causing the lag
in #3799, which is why this commit closes that ticket.
2011-11-16 18:17:35 -08:00
Jim Nelson
db62ed5d93 FETCH BODY[section]<partial> support.
This adds support for retrieving partial header and body blocks straight from the email, and
therefore support to pull the References header from a message (which, for some reason, IMAP
doesn't support or include in the FETCH ENVELOPE command).  This is necessary for email conversations (#3808).

This required a change to the database schema, meaning old databases will need to be blown
away before starting.
2011-10-17 19:03:15 -07:00
Jim Nelson
0533bc9700 Further work on detecting message removal when folder first selected: #3805
Needed to rethink storage strategies as I researched this and realized that a true scarce database -- where the database is sparsely populated both in columns and rows -- is not feasible due to IMAP's UID rules.  The strategy now means that the database rows are contiguous from the highest (newest) message to the oldest *requested by the user*.  This is a better situation than having to download the UID for the entire folder.
2011-07-15 13:39:02 -07:00
Jim Nelson
6b8951bfd8 Implemented IMAP-specific folder and message properties tables: #3805
This commit adds support for IMAP-specific properties, of which UIDValidity is crucial toward completing #3805.  The additional code is to integrate these tables into the SQLite Geary backend and to make sure this information is requested from the IMAP server.

NOTE: This commit changes the database schema.  Old databases will need to be blown away before running.
2011-07-15 12:54:10 -07:00
Jim Nelson
d179cb9bdd Persist messages locally: #3742
This completes the heavy lifting of persisting messages locally.  The strategy is that the local database may be sparsely populated, both in the availability of messages in a folder and the fields of a message that is partially stored.  As data is pulled from the remote server it's always stored in the database.  Future requests will always go to the database first, preventing unnecessary network traffic.

Also, this patch will detect when a message is stored in multiple folders on the server.  The database uses soft links from the folder to the message, so the message is stored only once in the database.  This technique relies heavily on the availability and validity of the Message-ID header, but we expect this to be reliable the vast majority of the time.
2011-06-23 19:07:04 -07:00
Jim Nelson
4ccabcbd3e Further work toward persisting messages locally (#3742).
This iteration now stores headers locally and fetches them first before going to the network.  Work done in the database to deal with IMAPisms.  More work on the GMime bindings (couple of mistakes in prior commit).
2011-06-21 17:48:40 -07:00
Jim Nelson
9221937e95 Addition of MessageTable and MessageLocationTable toward fixing #3742.
Much of the API between the local and net stores had to be reworked for consistency as well as planning ahead for how messages will be retrieved and stored efficiently.  This work also attempts to keep in mind that other mail sources (POP, etc.) may be required in the future, and hopefully can be added without major rework.
2011-06-16 16:27:08 -07:00
Jim Nelson
4b8ac5689f First stab at implementing persistent storage of IMAP data: #3695.
This large diff represents a growth of the architecture to persist IMAP data as its downloaded.  When listing folders, a local database is consulted first to immediately feed to the caller.  In the background, network calls fetch the "real" list.  The two are collated for differences which are reported to the caller via signals, who are then responsible for updating the user interface appropriately.  No other synchronization work is represented in this diff.

Note that this breaks functionality: when a folder is selected, no messages appear in the message list.  Fixing this requires more work, and this patch was already large enough.  It's ticketed here: #3741
2011-06-10 19:17:35 -07:00