Commit graph

1576 commits

Author SHA1 Message Date
Robert Schroll
28a489cf22 Avoid detaching a detached composer
https://bugzilla.gnome.org/show_bug.cgi?id=743433
2015-01-26 21:35:36 -05:00
Jim Nelson
d4cc681e91 Retry commands properly if connection lost: Bug #714540
If a command fails due to a hard error (connection dropped, network
loss, etc.), the command is preserved in the in-memory Folder queue
and retried when the connection is reestablished.  This makes Geary
more robust and resistant to simple errors due to connection loss,
i.e. archiving a message and having it return later because the
archive command was dropped and, when the connection reestablished,
the message "reappears" because it's still on the server.

Note that this is *not* offline mode or a replacement for it, merely
a way to make Geary more robust when a user's connection is flaky.
2015-01-26 17:07:10 -08:00
Jim Nelson
a445ddf5ab Don't issue multiple DONEs when deidling connection: Bug #713417
ClientConnection state machine had a timing hole where two DONEs could
be issued in near-succession when closing a single IDLE command.
The hole is issuing the DONE *before* the server acknowledged it
was idling.  When the idling continuation response was received,
the state machine would go to IDLE.  Then, when the next command
was submitted, a second DONE would be issued.  The second DONE
would be treated by the server as a tag with no command, causing
a CLIENTBUG response.

This tracks outstanding DONE commands when deidling and prevents
switching to the IDLE state when an idline continuation response
is received while waiting for the DONE to complete.
2015-01-26 12:32:34 -08:00
Jim Nelson
ed5914e468 Improved connection reestablishment for IMAP folders: Bug #713972
This patch drastically improves network connection handling and
reestablishment.  In particular, the ImapEngine.Folder's open_count
wasn't always properly maintained (in the engine and the client)
causing connection reestablishment issues.  Also, prior code attempted
to deduce when to reestablish a connection based on the type of Error
encountered.  Now, as long as the Folder's open_count is greater than
zero, reestablishment will be attempted (with a back-off algorithm and
special cases in the ClientSessionManager preventing continual login,
i.e. when credentials are bad).

ClientSessionManager also has a back-off algorithm when it's adjusting
its session pool and uses the NetworkMonitor to detect when the host
is simply unavailable due to the network being unavailable (to prevent
continuous retries).

In addition to the above bug, this patch solves the following tickets:
  Bug #714595
  Bug #725959
  Bug #712960
2015-01-22 17:11:39 -08:00
Jim Nelson
cec8b3f350 Don't launch multiple list ops when changing folders: Bug #712977
Clearing the ConversationListStore caused multiple selection-changed
notifications to the ConversationListView, whose signals in turn
caused I/O in the GearyController.  This stops that process in its
tracks.
2015-01-21 16:30:25 -08:00
Jim Nelson
5f0c028ee4 Move Empty Spam/Trash button to Mark/Copy/Move buttons
Primarily for aesthetics, although there's a sense that this button
better belongs with these buttons than Archive/Trash.
2015-01-20 13:54:21 -08:00
Robert Schroll
09487f0a10 Check if composer is already closing before asking about closing
The composer can hide itself while the draft manager is in the process
of closing up.  If we try to close that composer again, it should
automatically return PENDING_CLOSE instead of asking the user what to
do.
2015-01-16 16:42:16 -08:00
Robert Schroll
09582736b8 Properly restore state of drafts
We do this heuristically, by noting which messages it is in reply to and
seeing if it matches the unmodified reply or reply all states.  This
isn't perfect; notably forwarded messages are picked up.

We hide the existing draft in the conversation viewer as soon as we open
the composer.  We also ensure that future versions of this draft will
also be hidden.  The list of emails to be hidden is cleared when the
conversation viewer is, so we query all open composers at this point to
see which email ids should be hidden.

https://bugzilla.gnome.org/show_bug.cgi?id=743067
2015-01-16 16:39:19 -08:00
Robert Schroll
526f6e7889 Paned composer for handling multi-replies
When the user replies with a quote to a second message, the composer
moves into a paned below the conversation viewer.  This makes it easy to
scroll through the conversation and select text for replies.

The Gtk.Paned acutally holds a Box, which in turn can hold many
ComposerBoxes.  Only one is shown at a time, but the model used
elsewhere is that each ComposerWidget has a ComposerContainer until it
is destroyed.  When a composer is closed, it hides while finishing up
asynchronous work.  This allows us to hold hidden paned composers as
they finish up their work.

The logic for focus handling at detachment is moved into the
ComposerWidget from ComposerEmbed, since it may also be detached from
the paned state.  ComposerContainers gain a remove_composer() method
that does the container's clean up, as well as returning the focused
widget.  The ComposerWindow's remove_composer() method should never be
called.

https://bugzilla.gnome.org/show_bug.cgi?id=738188
2015-01-14 15:16:08 -08:00
Robert Schroll
2d1d2ed31c Allow quotes from multiple messages in a single reply
When replying to a message, we use the existing inline composer if it
already references the message we're replying to, or if we're replying
with a quote.  Replies without quotes get made into new composers.

When adding a new message as a reply in a composer, we add the relevant
addresses to the to and cc lines, based on the current reply type.  We
remove duplicates, and don't include any to addresses as cc.  We also
keep track of a total to and total cc list, which gets swapped in if a
reply action is to change the reply type.

We keep track of all the replied-to message ids and include all of them
in the In-Reply-To header.  However, the References header only includes
message ids from the first message replied to.  This is because RFC 2822
requires this header to represent a single lineage, which we cannot
guarantee if we're replying to different branches of the conversation.
2015-01-14 13:18:21 -08:00
Robert Schroll
6b4d841520 Deal with MailboxAddresses, not strings, in composer 2015-01-14 13:18:21 -08:00
Robert Schroll
a3aa8f770f Prioritize adding quote over changing reply type
If the quoted text has changed, add a new quote regardless of reply
type.  Only switch the reply type if the quote has not changed.
2015-01-14 13:18:21 -08:00
Robert Schroll
4b644cc4bd Allow only a single inline composer at a time
Also, set the detached state after creating the window to get the
toolbar in the correct state.
2015-01-14 13:18:21 -08:00
Robert Schroll
b0de5365a1 Guard against length-0 blockquotes in html_to_flowed_text
We can end up with these from odd user selections.
2015-01-14 13:16:39 -08:00
Jim Nelson
09a15914da Update Archive/Trash/Delete/Empty buttons on toolbar: Bug #742686
With the Empty button now attached to Archive/Trash/Delete, it's now
less lopsided for only Archive to have a label.  This removes the
label from Trash/Delete (which also makes it more innocuous when the
user presses Shift a lot, i.e. while editing in the inline composer),
which in turns simplifies building the main toolbar.
2015-01-13 14:42:34 -08:00
Jim Nelson
4c5621e561 Typo, minor bug fix to AlertDialog 2015-01-13 13:55:06 -08:00
Jim Nelson
c0e10d71dd Move AccountSynchronizer delay back to 10s
At two seconds, the background AccountSynchronizer kicks in too
quickly and can interfere with foreground operations, especially when
the Inbox is being normalized at startup.
2015-01-13 13:53:38 -08:00
Jim Nelson
ee7efd3a93 Avoid database error when adding attachments
do_save_attachments() is called by schema update 22, which is prior
to when DeleteAttachmentFileTable was introduced (in update 24).
Ignore error if cannot remove from that table, i.e. it doesn't exist
yet.
2015-01-13 13:51:28 -08:00
Jim Nelson
260436e92c Empty Trash and Empty Spam: Bug #714809, Bug #725260
Trash and Spam folders may now be emptied by Geary.  A user warning is
presented, as the operation cannot be undone and deletes mail on the
server, not just locally.
2015-01-13 13:48:16 -08:00
Jim Nelson
080becfc98 Don't hang on exit when forcing composer closed
Issue introduced with recent move to DraftManager.  When Geary is
closed with an open composer, the window would hide but the app
itself would hang.  This was due to telling the GearyController that
a close was pending when it was not.  Now, when PENDING is returned,
the draft is saved or discarded (based on user input) and the
DraftManager fully closed, ensuring the I/O operation is flushed and
completed.
2015-01-13 13:19:30 -08:00
Jim Nelson
a751f66fbb New DraftManager to save/delete drafts w/o orphans
Introduces a DraftManager class which handles saving and deleting
drafts for the composer and error situations.  Not perfect yet w/o
better support in the Engine for dealing with network disconnects
and offline mode, but much better than before for ensuring that drafts
are not orphaned in the Drafts folder.
2015-01-12 16:06:09 -08:00
Jim Nelson
a3fb0a364a Change Geary.Folder and Geary.Account to abstract classes
Since the dawn of time, Folder and Account were interfaces.  It's
become obvious over time nothing was gained by making them interfaces,
only a duplication of effort when changing their API to update the
interface and then the abstract base class all other classes derive
from.

This makes both abstract classes, cleaning up the code a bit and
reducing complexity.
2015-01-09 17:50:19 -08:00
Jim Nelson
0ef2113ef2 Support true delete from all Gmail folders: Bug #721790
Geary now offers "true" deletion of messages in Gmail.  It does this
by moving the offending email to the Trash folder and then expunging
them from the Trash.

Fortunately, this works with the composer without changes, meaning
discarded drafts won't sit in the Trash for 30 days.
2015-01-09 15:09:53 -08:00
Jim Nelson
6e09005f59 HTML escape email addresses in conversation viewer header: Bug #742429
Email address such as ["<S dude@example. com>" <s.dude@example.com>]
was not being escaped for HTML, so the S tag would strike-out the
remaining text in the address line.  This patch corrects that.

While working on this, I noticed as well that the mailto: link was not
being properly formed due to lack of quoting.  By using
MailboxAddress.to_rfc822_string(), problem solved.
2015-01-07 11:41:25 -08:00
Jim Nelson
2d0b53dbdf Add free page requirement to trigger VACUUM
A follow-up to recent garbage collection commit.  Prior trigger for
VACUUM required a large number of reaped messages, indicating disk
fragmentation but not necessarily an indication of free space that
could be returned to the operating system.  This patch adds trigger
looking for 500MB of free space in database, large enough to justify
a full rebuild.
2015-01-05 13:31:57 -08:00
Sergey Shnatsel Davidoff
c2380abff2 Heap access violation in random_string(): Bug #741842
Needed to allocate space for terminating NUL.
2014-12-22 12:28:13 -08:00
Jim Nelson
abe45d51b4 Fix code attribute to compile under Vala 0.28: Bug #741760 2014-12-19 12:54:43 -08:00
Jim Nelson
1f073831d5 Revert "Use hairlines for conversation list separators: Bug #741006"
This reverts commit ced85aaa8e.
2014-12-18 17:30:38 -08: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
Georges Basile Stavracas Neto
b7f989685b Use GtkHeaderBar for Accounts & Prefs dialogs: Bug #741240 2014-12-08 15:18:34 -08:00
Jim Nelson
b288eb54e5 Update POODLE SSLv3 fallback string: Bug #741132
As recommended by bug #738633 comment #21.
2014-12-04 13:54:30 -08:00
Jim Nelson
de59507b9d Vala 0.28 now warns about unused/unknown attributes: Bug #741077 2014-12-03 11:50:03 -08:00
Mark Pariente
b22682d2a2 Geary window does not open due to race condition: Bug #737811
Although prior fix for bug #737811 solved problem for some users,
apparently Geary still had an issue when upgrading a database with
new GLib Mutex implementation, which uses Linux's futexes whenever
available.  This solution gives the notifying thread a chance to
signal the waiter that its work is completed.
2014-12-02 14:14:52 -08:00
Georges Basile Stavracas Neto
ced85aaa8e Use hairlines for conversation list separators: Bug #741006 2014-12-02 13:28:30 -08:00
Jim Nelson
da2efeab03 Move UID/UIDVALIDITY/SeqNum from signed 32 -> unsigned 32: Bug #737642
Prior code inadvertantly limited UID and UIDVALIDITY to signed, not
unsigned, 32-bit integers.  I've also added stronger checking of
numbers received off the wire, both that they're truly numeric
according to RFC and that they're within boundaries, if specified.

This also enforces bit width of integers from IMAP string parameters
to avoid similar problems in the future.
2014-11-14 15:18:12 -08:00
Jim Nelson
cbb21b2f9e Dynamically detect when running under Unity: Bug #737258
This removes the --enable-unity ./configure flag in favor of detecting
the UI shell at runtime.
2014-11-14 13:55:05 -08:00
Jim Nelson
9cb7e6bd13 Don't assert Message-ID was decoded for non-empty string: Bug #740049
If Message-ID string is "<>", then no Message-ID will be decoded even
though the string itself is non-empty.
2014-11-13 19:35:04 -08:00
Michael Gratton
04671efaee Fix "BAD Invalid date in Search command" from Cyrus IMAPD.
Bug #740041.

* src/engine/imap/message/imap-internal-date.vala:
  Geary.Imap.InternalDate::to_search_parameter was returning the result
  of serialize(), rather than serialize_for_search().
2014-11-12 18:38:23 -08:00
Jim Nelson
2095ae955e Return to IDLE properly when connection lulls
Commit 96aaf3 fixed a bug with regard to IDLE status responses being
improperly reported to ClientSession.  As it turned out, that fix
introduced a bug by not properly decrementing outstanding_cmds, which
left the ClientConnection in a state where it would never enter IDLE
thereafter.

The problem is a change I pondered at the time but didn't commit due
to that fix being so close to release time: not reporting the original
IDLE command to ClientSession either.  That in itself is harmless, but
not doing that also avoids incrementing outstanding_cmds for that
command, meaning when the IDLE completes that value returns to zero
and the ClientConnection is in an appropriate state to return to IDLE
when ready.
2014-11-11 18:24:16 -08:00
Jim Nelson
6b3db836ce Allow disabling notifications via libmessagingmenu: Bug #739429 2014-11-11 16:49:45 -08:00
Georges Basile Stavracas Neto
01355adc3a Remove borders from interior frames in the UI: Bug #736165 2014-11-11 15:29:18 -08:00
Jim Nelson
b73c56c358 Reduce IMAP timeouts to reduce network load
We've received some criticism of being overly aggressive with our
IMAP timeouts, in particular keepalive traffic.
2014-11-11 13:17:23 -08:00
Jim Nelson
3690068999 Reduce save-draft timeout to 10 seconds
We've become more confident about saving drafts (although issues
remain ensure old ones are deleted as new ones take their place).
I'm dropping the timeout to 10 seconds to reduce network activity
and the number of discarded drafts generated while writing them, which
fills up the users' trash.
2014-11-11 13:14:20 -08:00
Jim Nelson
ab293d2d72 Remove minimum width for sidebar / folder list: Bug #713882
The text label needed to have an ellipsize mode set, otherwise it
enforced a minimum width of the label text itself.  Worse, even if
that label was removed, the minimum width remained.

This fix might be too generous, as it allows for the sidebar to be
collapsed pretty narrowly, causing all text to be ellipsized. It's a
start, however.
2014-11-11 13:04:48 -08:00
Jim Nelson
74a76eb064 Don't assert() if Imap.Folder created w/ mismatched name: Bug #739316
The assertion was a sanity check that's outlived its original purpose.
When it triggers now, it means an internationalization/encoding issue,
usually with non-Gmail servers that implement XLIST.  Rather than
assert and make Geary unusuable for a subset of our non-English
speaking users, log a message and continue.
2014-11-05 11:54:05 -08:00
mar-v-in
108d0abe4c Specify "Reply-To:" in composer fields: Bug #714588
This also closes bug #713808, as lesser-used fields (Reply-To, Bcc)
are hidden unless the user expands the composer to show them.  Right
now that is an option in the composer's toolbar menu; that may change
in the future if we can find the right place to put the widgetry.
2014-11-04 14:44:05 -08:00
Jim Nelson
2c0e29552a Stricter naming and controls on converting string data to ASCII
This is the result of the recent fix for Turkish locale users.  That
patch was sufficient to solve their issue, but this patch is more
thorough in naming to ensure in the future it's understood that the
IMAP StringParameter objects deal in ASCII, not UTF-8.  If a string
cannot be converted into a StringParameter (must be represented by a
LiteralParameter), that is now also enforced via an ImapError.
2014-11-04 14:18:48 -08:00
Jim Nelson
c7b3771c46 Drop NULs and process entire IMAP line
Discovered while working on Turkish UTF-8 bug, technically the IMAP
Deserializer was missing two things: (a) NUL is never allowed in an
IMAP line, even if the string is quoted, and so it should be dropped
rather than processed and cause potential issues, and (b)
DataInputStream will read to EOL, potentially leaving embedded NULs in
the line, meaning the old code would stop without processing the
entire IMAP response.

Although no server has been reported with these issues, I felt it
important to get this right as a defensive measure.
2014-10-31 17:28:46 -07:00
Jim Nelson
e96a8db41f Removed unused code, symbols 2014-10-31 17:19:40 -07:00