Commit graph

3425 commits

Author SHA1 Message Date
Michael James Gratton
f1fdfd9f2c Update some API docs for Nonblocking.Lock and subclasses. 2018-02-05 21:16:29 +11:00
Michael James Gratton
912582d957 Avoid warning user of host unreachable errors when checking reachable.
These occur if checking reachability when the required host's network is
unavaialble, i.e. when checking while being offline, hence there's not
much point warning about it.

 * src/engine/util/util-connectivity-manager.vala (ConnectivityManager):
   Treat IOError.HOST_UNREACHABLE errors as simply being unreachable,
   not an error state.
2018-02-05 21:14:41 +11:00
Piotr Drąg
0ea6d212b8 Update Polish translation 2018-02-04 17:05:47 +01:00
Anders Jonsson
dbc8982e2d Update Swedish translation 2018-02-01 22:27:09 +00:00
Michael James Gratton
f8ef491cca Don't flag a mailbox address without a distinct name as spoofed.
This fixes annoying, albeit legit addresses like "mike@vee.net
<mike@vee.net>" from being flagged.

Followup to commit b7eea857.

* src/engine/rfc822/rfc822-mailbox-address.vala (MailboxAddress): Don't
  test name for spoofyness if it's not distinct. Add unit test.
2018-02-02 01:05:24 +10:30
Michael James Gratton
7073206c8d Fix client use of MailboxAddress(es).to_rfc822_string().
Turns out the client was in inexplicably using
MailboxAddresses.to_rfc822_string() in a bunch of places to display
emails to users, mostly in the composer. This fixes that.

Followup to b7eea857.

* src/engine/rfc822/rfc822-mailbox-addresses.vala (MailboxAddresses):
  Make list param for default ctor nullable for your testing convenience,
  add a test. Add to_full_display() method that the client should nearly
  always be using to display a list to users, use that in all the places.
  Remove empty param for list_to_string since all but one callers just
  pass in the empty string, which also fixes some stupid regressions
  introduced in commit 178ce351 that causes it actually break
  to_rfc822_string, rather than fix it as claimed, update call sites.
2018-02-01 23:56:23 +10:30
Michael James Gratton
b7eea85725 Merge branch 'wip/791275-mailsploit-mitigation'. Fixes Bug 791275. 2018-01-31 16:41:53 +10:30
Michael James Gratton
de0618e606 Update monitoring for new mail when folder special type changes.
Followup to commit 9727d41 for Bug 713227.

* src/client/application/geary-controller.vala (Controller): Break out
  the check to determine if a folder is a child of the inbox, simplify
  and make more robust. Use that to check both available folders and
  folders whose special type has changed.

* src/engine/api/geary-folder-path.vala (FolderPath): Add new
  is_descendent method.
2018-01-31 16:40:37 +10:30
Michael James Gratton
02ea0199b7 Explicitly close the Serializer's buffer stream.
Since the Serializer is passed a buffered GLib stream that uses a
background thread to manage async IO, it's better to explicitly close the
stream so we know the thread will be shut down at that point, rather than
at some random point in the future.

This will hopefully fix Bug 792219, but it's hard to know since it is a
rarely seen race.

* src/engine/imap/transport/imap-client-connection.vala (Connection):
  Keep a reference to the BufferedOutputStream we pass the serialiser,
  and explicitly close and dispose after disposing of the serialiser
  instance.
2018-01-31 16:40:37 +10:30
Michael James Gratton
eb63505aa7 Indicate spoofed emails in both conversation viewer and list.
Part 3 of Mailsploit mitigation.

* src/client/conversation-list/formatted-conversation-data.vala
  (ParticipantDisplay): Rule a line through spoofed emails.

* src/client/conversation-viewer/conversation-message.vala
  (AddressFlowBoxChild): Display a warning icon and tooltip for spoofed
  addresses.
2018-01-31 16:24:00 +10:30
Michael James Gratton
40b460dca3 Tidy up MailboxAddress{es} source and API a bit. 2018-01-31 16:15:29 +10:30
Michael James Gratton
178ce35113 Fix MailboxAddresses.to_rfc822_string formatting, add unit tests. 2018-01-31 16:15:29 +10:30
Michael James Gratton
8a1906fa96 Ensure encoded mailbox addresses are decoded correctly.
Both RFC mailbox address names and mailboxes/local-names may by RFC 2047
be Quoted-Printable or Base64 encoded. This patch ensures these parts are
correctly decoded when parsing a RFC 822 message, so that they are
displayed to the user in human-readable form.

Part 2 of Mailsploit mitigation.

* src/engine/rfc822/rfc822-message.vala (Message): Since GMime.Message's
  convenience properties for accessing header values such as senders,
  recipients, etc. in string form are presented as human-readable, not
  RFC822 compliant strings, we can't re-parse them for use by this class
  when it is being constructed from a GMime-based source. Instead,
  iterate over all headers to get the raw values and parse those we are
  interested in instead. Add unit tests.

* src/engine/rfc822/rfc822-mailbox-address.vala (BaseObject): Add gmime
  constructor so we can handle construction and decoding from a GMime
  InternetAddressMailbox object in a consistent way. Ensure both names
  are decoded correctly, and mailboxes are decoded at all, from both
  GMime and IMAP sources. If a GMime source's address has no @-symbol,
  try to decode the whole thing first it in case the whole address is
  encoded. Add unit tests.

* src/engine/rfc822/rfc822-mailbox-addresses.vala (MailboxAddresses):
  Add append method and handle group addresses here instead of in Message
  to simplify updated Message implementation.

* src/engine/rfc822/rfc822-message-data.vala (MessageData): Add append
  method to simplify updated Message implementation.
2018-01-31 16:15:29 +10:30
Michael James Gratton
8810e95753 Ensure mailbox addresses escaped correctly when formatted as RFC 822.
* src/engine/rfc822/rfc822-mailbox-address.vala (MailboxAddress): Escape
  and encode name and mailbox (local-part) when serialising as a RFC 822
  string. Provide a means to get a RFC 822 version of the address only
  for SMTP. Add unit tests.

* src/engine/smtp/smtp-request.vala (MailRequest): Use proper RFC 822
  formatted version of mailbox addresses.
2018-01-31 16:15:29 +10:30
Michael James Gratton
71e0e6835e Check for spoofed sender addresses, only display the address if so.
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.
2018-01-31 16:15:29 +10:30
Federico Bruni
5025a7894f Update Italian translation
(cherry picked from commit 13d920dc391171b8f1b11d7eefbd04df2f81b006)
2018-01-28 12:38:46 +00:00
Jiri Grönroos
8a88d17ead Update Finnish translation 2018-01-27 19:15:25 +00:00
Michael James Gratton
f6b4b5c9e8 Update monitoring for new mail when folder special type changes.
Followup to commit 9727d41 for Bug 713227.

* src/client/application/geary-controller.vala (Controller): Break out
  the check to determine if a folder is a child of the inbox, simplify
  and make more robust. Use that to check both available folders and
  folders whose special type has changed.

* src/engine/api/geary-folder-path.vala (FolderPath): Add new
  is_descendent method.
2018-01-27 16:22:45 +10:30
Michael James Gratton
294bf14148 Explicitly close the Serializer's buffer stream.
Since the Serializer is passed a buffered GLib stream that uses a
background thread to manage async IO, it's better to explicitly close the
stream so we know the thread will be shut down at that point, rather than
at some random point in the future.

This will hopefully fix Bug 792219, but it's hard to know since it is a
rarely seen race.

* src/engine/imap/transport/imap-client-connection.vala (Connection):
  Keep a reference to the BufferedOutputStream we pass the serialiser,
  and explicitly close and dispose after disposing of the serialiser
  instance.
2018-01-27 10:05:35 +10:30
Michael James Gratton
0c837d3101 Remove redundant and unimplemented Folder.OpenFlags.FAST_OPEN option.
* src/engine/api/geary-folder.vala (OpenFlags): Remove FAST_OPEN, since
  it is unimplemented and redundant with NO_DELAY. Update uses to simply
  use its equivalent, NONE.

* src/client/application/geary-controller.vala (do_empty_folder_async),
  src/engine/imap-db/outbox/smtp-outbox-folder.vala (save_sent_mail_async),
  src/engine/imap-db/search/imap-db-search-folder.vala
  (remove_email_async): Ensure folders opened are always correctly closed
  after being opened.
2018-01-26 17:12:28 +10:30
Michael Catanzaro
dec4416b52 Never enter inline compact mode when account has multiple emails
If the current account has multiple emails, we must never enter inline
compact mode, otherwise the user has no chance to pick the right email.
Geary currently tries to guess which email to send the mail from, but
it can't always be right.

https://bugzilla.gnome.org/show_bug.cgi?id=791230
2018-01-26 15:16:17 +10:30
Michael Catanzaro
77d8516e77 Always allow changing from address if account has multiple addresses
https://bugzilla.gnome.org/show_bug.cgi?id=791230
2018-01-26 15:16:09 +10:30
Michael James Gratton
eebe498a3e Add missing build aux file for obtaining the git version.
This is needed to make commit e8e7139 work for people that are not me.
2018-01-26 14:41:46 +10:30
Piotr Drąg
9f703466aa Update POTFILES.in 2018-01-26 01:33:58 +01:00
Michael James Gratton
e744c284ab Set the minimum IMAP pool size to something a bit more realistic. 2018-01-26 09:57:01 +10:30
Michael James Gratton
938033f3a4 Rework how the client session manager manages the IMAP session pool.
* src/engine/imap/transport/imap-client-session-manager.vala
  (ClientSessionManager): Use a non-blocking queue for free sessions
  rather than a set of reserved sessions, so we can instantly pick a free
  one when needed and available. Manage establishing new connections from
  one place in check_pool (was adjust_session_pool) rather than in a few
  different places in the class. Greatly simply lock management and
  connection establishment code. Add some doc comments, clean up code
  organisation.
2018-01-26 09:57:01 +10:30
Michael James Gratton
8536ad276f Tidy up how IMAP client sessions are closed by the manager.
* src/engine/imap/transport/imap-client-session-manager.vala
  (ClientSessionManager): Rework close_async() and force_disconnect_all()
  to use the same code for closing all sessions. When a session is closed
  by some other means then simply remove it, rather than going through
  force_disconnect() again. Remove force_disconnect()'s do_disconnect
  param, since all call sites now set it to true, and just always attempt
  to disconnect the session, without waiting for it.
2018-01-26 09:57:01 +10:30
Michael James Gratton
07bc441085 Don't add IMAP connections back to the pool when the account is closing.
This updates the client session manager to close IMAP connections without
waiting when they are released and the account is closing, rather than
adding them back to the pool again. Sessions that are in the Selected
state due to being used by a folder are also simply closed, rather than
attempting to return them to Authenticated (i.e. not selected) state
first.

This means when a folder is closed and releases its session that it does
not block if its session has hung, making application shutdown less
likely to hang as well, helping Bug 745561 along a bit further.
2018-01-26 09:57:01 +10:30
Michael James Gratton
c0501bda19 Tidy up and document lock classes in Geary.Nonblocking.
* src/engine/nonblocking/nonblocking-abstract-semaphore.vala: Renamed to
  nonblocking-lock.vala, rename class from AbstractSemaphore to Lock and
  update subclasses, since it is used as a basis for a number of
  different lock implementations. Make two getter methods into read-only
  properties. Fill out doc comments to be much more comprehensive.

* src/engine/nonblocking/nonblocking-mutex.vala (Mutex): Provide a
  high-level API and update documentation comments.

* src/engine/nonblocking/nonblocking-queue.vala (Queue): Add to doc
  comments.

* src/engine/nonblocking/nonblocking-variants.vala: Actually document
  how each of the variants behave.
2018-01-26 09:57:01 +10:30
Emin Tufan Çetin
7393d7f2b1 Update Turkish translation 2018-01-20 10:19:00 +00:00
Michael James Gratton
cc29024501 Remove obsolete build files. 2018-01-15 16:18:24 +11:00
Michael James Gratton
a0ff57c158 Remove --enabled-deprecated vala warnings, fix a bunch of them. 2018-01-15 16:17:11 +11:00
Michael James Gratton
cbfb7d571d Update dev Makefile to use meson and ninja. 2018-01-15 15:16:57 +11:00
Michael James Gratton
37c218d646 Chase Meson build to use XDG Help spec locations.
* src/client/application/geary-application.vala (Application): Use "help"
  and yelp for showing help, rather than old "ghelp" URI and gnome-help.

* help/CMakeLists.txt: Update CMake build to match Meson
2018-01-15 14:11:24 +11:00
Michael James Gratton
178e18e83a Ensure help figures are installed under Meson build. 2018-01-15 14:03:58 +11:00
Michael James Gratton
f3e2dac20f Ensure translated manual pages are installed under Meson. 2018-01-15 11:57:26 +11:00
Michael James Gratton
e8e7139629 Re-enable reporting git version in Meson dev builds. 2018-01-15 11:57:26 +11:00
Piotr Drąg
c30b7a0ff9 Update Polish translation 2018-01-14 19:09:19 +01:00
Emin Tufan Çetin
5e07e8c5d2 Update Turkish translation 2018-01-13 19:29:18 +00:00
Rafael Fontenelle
6ccc0c7fbd Update Brazilian Portuguese translation 2018-01-13 14:09:35 +00:00
Federico Bruni
173dea94fc help: Ctrl-M shortcut has been removed
See commit 54ba285a
2018-01-13 18:59:15 +11:00
Michael James Gratton
3606bade04 Update flatpak-builder manifest to use meson build. 2018-01-12 18:21:34 +11:00
Michael James Gratton
fad8c46e02 Fix app icons not being installed to the correct directory under Meson. 2018-01-12 18:21:34 +11:00
Michael James Gratton
5456dab49c Tidy up inclusion of libunwind in the Meson build.
* meson.build: Use libunwind and libunwind-generic to avoid having to
  search for the platform-specific lib.

* src/meson.build: Set UNW_LOCAL_ONLY define to get the most optimal
  unwind impl.
2018-01-12 18:21:26 +11:00
Michael James Gratton
d7ed670fe4 Fix valadoc errors after merging wip/778276-better-flag-updates. 2018-01-12 12:49:07 +11:00
Michael James Gratton
3aefeb0783 Update meson build after merging wip/778276-better-flag-updates. 2018-01-12 12:25:33 +11:00
Michael James Gratton
5acf0e7ace Update sources in POFILES.in. 2018-01-12 12:06:17 +11:00
Michael James Gratton
6c5a7d5868 Merge branch 'wip/778276-better-flag-updates'. Fixes Bug 778276. 2018-01-12 11:56:57 +11:00
Michael James Gratton
4cb9f2fbba Retry an account operation after a network error. 2018-01-12 11:39:44 +11:00
Michael James Gratton
7d1de0d9c0 Fix some issues opening mailboxes from Bug 789924 / commit fddf609.
* src/engine/imap-engine/imap-engine-minimal-folder.vala
  (MinimalFolder.start_open_remote): Don't check to see if the timer is
  running before opening the remote, just do it since this method is only
  called when the remote should be opened.
  (MinimalFolder.on_remote_ready): Only start opening the remote if
  actually needed.
2018-01-11 15:36:32 +11:00