Commit graph

37 commits

Author SHA1 Message Date
Jim Nelson
ce73f610dc More efficient use of network resources
Previously, Geary could sometimes request elements of an email
message it already had in the database.  Often this was due to
the client requesting information already present as well as one
additional field; the old implementation required all the requested
fields be pulled down.

Now Geary will work out on a message-by-message basis what is
present and what is not and request only missing fields for each
one.  It will cluster messages missing the same fields into the
same request and it submits all requests simultaneously, to take
advantage of IMAP pipelining.

This work has some orthogonal benefits toward #5224, better
Dovecot support, by making the upper layers able to merge an email
using both locally-fetched data and remotely-fetched data.
2012-05-14 17:55:06 -07:00
Jim Nelson
c62553007b FETCH decoding fails, causing various problems: Closes #4781
This also closes #5079, which I believe was caused by #4781 (and
could reproduce once isolated).

This commit may also close bug #5189, but need to verify further
on reporter's machine before closing.

These problems are all related to emails lacking a Message-ID in
their header, common with spam and mass-emailers.
2012-05-03 20:27:12 -07:00
Jim Nelson
5a2a371e01 Geary fails to report newly arrived email: Closes #5114
This appears to be a timing issue between a message being deleted
and a message arriving at approx. the same time.  The new event
handler dealing with incoming mail is not so strict and uses UID
addressing to be more generous in scooping up any new email than
it has in the local store.

*Believe* this to be fixed, but as this is so difficult to repro
and diagnose, there may still be some cases out there.
2012-05-02 21:22:52 -07:00
Jim Nelson
4b6ac96a7d Reestablish dropped connections: Closes #4568
This rather large patch makes Geary.Conversations now responsible
for reestablishing a connection with the server if it ever drops
due to error.  Once reestablished, Conversations will resynchronize
and report any new messages to the client.  To the client, it's
invisible.

Working on this revealed problems with session teardown and Folder
state issues, as well as a memory leak.  These are all fixed in
the patch.

There remains other connection timeout problems when the network is
unavailable, but will need to be addressed in a separate patch.
2012-05-01 20:36:35 -07:00
Nate Lillich
d61e1b1b1d Fixes #4981. Message flags should always be properly updated now using the message ID instead of the location table's row ID 2012-04-17 10:29:41 -07:00
Jim Nelson
b3bc72b332 Further work from two weeks ago simplifying the Folder interface
Because the SQLite and IMAP folder classes no longer implement
Geary.Folder, they can be simplified greatly, which this patch
does.
2012-04-10 15:14:03 -07:00
Jim Nelson
ba4115fca1 Further rework of engine: Combined EngineFolder with GenericImapFolder
In addition, some of the work done in the old GenericImapFolder is
now broken out into separate components that monitor the folder
to do their work (the prefetcher and the email flags watcher).  This
should make their code easier to maintain and understand.
2012-03-22 16:57:18 -07:00
Jim Nelson
352fa94b76 First commit of a Geary engine rework
This decouples the IMAP and Sqlite units from the Geary.Folder and
Geary.Account interface.  Geary.EngineFolder will no longer deal
with generic local and remote folders, rather it is built knowing
it is dealing with IMAP.

This is necessary because of the IMAP engine changes coming, that
is dealing with servers that return server data out of order,
and even complete requests out of order.
2012-03-22 12:05:55 -07:00
Jim Nelson
a19a3d0ea7 Initial implementation of background prefetching: #4462
This implements a background prefetch of all normalized messages
in the folder.  It does not implement the chunked prefetch scheme
we discussed.  It uses a simple priority scheme as well, only
pulling one message at a time, although it may be worthwhile
later implementing a pull-back system where the prefetch waits
until higher-priority traffic completes before continuing.
2012-03-13 16:06:05 -07:00
Adam Dingle
281f29bc77 Updated copyrights to 2012. Closes #4564 2012-01-10 10:40:34 -08:00
Eric Gregory
049a718c34 Archive/delete and mark unread now use ReplayQueue. Closes #4526 2012-01-09 10:58:13 -08:00
Eric Gregory
9ea2b48919 Archive/delete messages. Closes #3806 2011-12-15 16:16:27 -08:00
Eric Gregory
e784d1b9b3 Signal for updating EmailFlags. Closes #4478 2011-12-13 16:13:20 -08:00
Eric Gregory
fe099d9fb9 Mark messages as read when clicked. Closes #4476 2011-12-07 18:48:14 -08:00
Eric Gregory
46a2686dd2 Resolves assertion due to null MessageRow object 2011-11-15 17:31:36 -08:00
Jim Nelson
f5b7d29a8c Better duplicate detection in local database
This incorporates much better duplicate detection in the local database, using both RFC-822 Message-ID as well as IMAP metadata (internaldate, RFC822 size) to determine if a message is already stored in the database.  Very useful when a message is stored in multiple folders, or an already-downloaded message is returned to a folder it originated in (i.e. INBOX).

Also some minor fixes to listing email by EmailIdentifier which save a roundtrip to the server for certain edge cases.
2011-11-14 12:09:52 -08:00
Jim Nelson
4cea0fb0d2 Removed messages are now removed from conversations: Closes #4347
Conversations now fully monitor the Folder for both additions and removals of messages.
This exposed a couple of bugs in the database code, which are fixed here as well.  I also
used this opportunity to clean up some of the internal Conversations code, simplifying Node
management.  #4333 will be a big boost here when implemented.
2011-11-10 13:20:48 -08:00
Jim Nelson
3f6d8eac5a Moving away from positional addressing. Greater emphasis on EmailIdentifiers for
addressing.

Positional addressing is a nightmare for a lot of reasons, especially keeping positions
up-to-date as the Folder mutates.  Now, positions are returned with the email but for
advisory reasons only, and do not keep up-to-date.  It is expected that a client will use
positional addressing to "bootstrap" the application's data store, then use EmailIdentifier
addressing to traverse the Folder's contents.
2011-11-09 16:40:28 -08:00
Jim Nelson
cd0b926d57 Engine implementation of conversations: #3808
This introduces Geary.Conversations into the API, which scans a Folder and arranges the
messages into threaded conversations.
2011-10-21 17:04:33 -07:00
Jim Nelson
b50b769e77 Really fixes bug where FAST messages had wrong EmailLocations.
Prior commit did not completely fix the problem in the case where a remote folder open took
a long time.  This bulletproofs the solution, but does mean that there will be some
situations where FAST messages return with EmailLocations that radically change in the near
future.  As the contract allows for any changes whatsoever, this is acceptable.
2011-10-18 19:56:54 -07:00
Jim Nelson
ab69b20b1c Moved a lot of implementation-specific code into a new impl/ directory, keeping the api
directory concerned only with user-facing interfaces.  Also, cleaned up some of the public
interfaces in support modules to private.
2011-10-17 19:03:15 -07:00
Jim Nelson
7e8edcb355 Transactions added to database code: Closes #4235
The entire database module now uses Transactions in order to guarantee atomicity of all
operations.  However, due to limitations in SQLHeavy and its implementation of async, we
can't use it (and SQLite's) transactional models.  This patch introduces a rather hamhanded
transactional model where the entire database is locked for each request using a
NonblockingMutex.  This is the safest approach, but certainly not an optimal one.  When
SQLHeavy's code is in place, hopefully we can rip this out with a minimum of fuss.
2011-10-12 16:52:54 -07:00
Jim Nelson
af7c5f585e Fixes a crasher when a message on the server has an empty Subject: line. 2011-10-07 16:58:19 -07:00
Jim Nelson
428c0825a9 Fast listing of messages in a folder
This adds a new flag when listing messages, FAST.  This indicates that the caller wants
messages that are immediately available to the Folder, avoiding a round-trip to the server
(or even disk) if possible.  Not all folders will support FAST, but it can be used (as it is
now in the client) to quickly populate the message list and then initiate a connection in
the background to get the straight dope.
2011-10-04 19:02:59 -07:00
Jim Nelson
7442caf88e Detect deleted (or moved) messages in open folder: #3793
This commit finishes the second half of #3793 by detecting when messages have been deleted
(or moved out of) an open folder and notifying the system of the change.  The nonblocking
synchronization primitives have been beefed up and may be broken out to a separate library
some day.

This commit also introduces the ReplayQueue, which replays events that occur on the server
locally.  This class will probably become much more important as time goes on, perhaps used
to store user events that are replayed on the server as well.
2011-07-29 20:10:43 -07:00
Jim Nelson
d1208e8efe Monitor currently selected folder: #3793
This commit represents the first half of this ticket, as it only monitors additions (new
emails) in the folder.  A second commit will follow for monitoring removals (deleted emails)
in the folder.
2011-07-26 15:29:08 -07:00
Jim Nelson
e812ef6166 Some cleanup dealing with commit for #3851.
The commit for #3851 changed the semantics of how messages are stored in the local cache,
and not all the code was properly updated to recognize that, particularly in EngineFolder.

This patch also introduces EmailIdentifier, which allows for a mail message to be fetched by
a unique identifier rather than its position in the folder list.  This is much more
efficient and less error-prone, and means that Email objects don't have to be updated if
their position changes (although there are still some questions in that area).  For IMAP,
this means being able to use the message's UID.
2011-07-19 15:55:56 -07:00
Jim Nelson
9adabb21ed Assertion failure when reading message: #3858
Caused by a valac bug set off by a generic function designed to convert a Gee List to a Vala
array.  Rather than fight it I've removed the function and added to FetchCommand a
constructor to build the command using a Gee Collection.
2011-07-18 15:57:55 -07:00
Jim Nelson
8b26d6d112 Folder no longer attempts to download existing messages when re-selected: #3851
The SQLite Geary.Folder implementation now uses reference semantics, so when it's reselected
the same Folder object is used and in-memory state is consistent.  Also found an off-by-one
error when first querying an IMAP Folder that caused the most recent new email not to be
downloaded the first time.  Fixed as well in this commit.
2011-07-18 11:48:42 -07:00
Jim Nelson
8e62435dec Fixes off-by-one error and bitfield issue when fetching an email.
In prior revision, the email message that appeared didn't always match the header selected.  This fixes that problem.
2011-07-15 14:29:33 -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
9792780edb Display To:, From:, and Subject: in message viewer: #3812
Fields added.  However, it would be nice to use formatting to separate them from the body of the message.  This is not easy with Gtk.TextView/Gtk.TextBuffer; see https://bugzilla.gnome.org/show_bug.cgi?id=59390.  This may push us to move to Webkit earlier rather than later.
2011-07-14 15:47:01 -07:00
Jim Nelson
4b03ba004e Use GMime to display the text/plain portion of email messages: #3710
This makes available MIME portions of the message, although more work will need to be done to expose all MIME parts.
2011-07-06 15:46:24 -07:00
Jim Nelson
0273b78005 Folder heirarchies: #3788
Now supporting folder heirarchies.  The client will now descend looking for subfolders.  This task now opens up multiple outstanding requests to the Engine as well as exercises the database schema.

Closing this ticket opens the door to finishing #3692.
2011-07-01 15:40:20 -07:00
Jim Nelson
a774034aff More responsive loading of folders: #3702
This commit introduces lazy loading of folder contents, which allows the Engine to report back email in chunks rather than all at once (which might require a round-trip to the server).  This allows for the local database results to be returned to the caller right away while background I/O is occuring.
2011-06-28 16:33:27 -07:00
Jim Nelson
41faa36103 New file naming scheme and organization for the Engine.
The code base is growing much faster than expected, faster than Shotwell it seems (not necessarily line count, but files and necessary organization of the library vs. Shotwell's initial flat directory).  After some thought decided to move to a more standard Vala/GTK naming scheme of all lowercase with dashes for spaces starting with namespace (minus the "geary-", unless the class was in the topmost namespace).  Three motivations:

1. Often confusing when working on code to see three "Folder.vala" in the gedit tabs: one IMAP, one SQLite, and one the interface definition.
2. This paves the way for waf integration, as right now we're held up using it because it barfs on projects with two files of the same name in different directories.
3. I find the CamelCase in the file browser becoming hard on the eyes, and this scheme seems a little more browsable.
2011-06-27 11:24:39 -07:00
Renamed from src/engine/sqlite/api/Folder.vala (Browse further)