Commit graph

1817 commits

Author SHA1 Message Date
Michael Gratton
288c78a93a Geary.RFC822.Message: Rework constructors and stocking from GMimeMessage
Make constructors use the Message.from_gmime where possible. Merge that
and stock_from_gmime so it's clear the stocking only happens in the
ctor. Update stocking to use high-level GMime APIs where available to
avoid re-parsing header values.
2020-05-06 14:58:56 +10:00
Michael Gratton
6e7631b8d3 Geary.RFC822: Clean up message data interfaces and classes
Split Geary.RFC822.MessageData interface up into DecodedMessageData and
EncodedMessageData so the difference between the two is clear and they
can't be used interchangeably.

Add `DecodedMessageData::to_rfc822_string` to provide a common interface
for round-tripping decoded data.

Update all classes to implement one of these and follow the same general
API patterns.
2020-05-06 14:58:56 +10:00
Michael Gratton
5b253cbee6 Geary.RFC822.MessageIdList: Update API to match MailboxAddresses
Make immutable, provide similar properties and accessors as
MailboxAddresses.
2020-05-06 14:58:56 +10:00
Michael Gratton
6aa5c2bfbd Geary.Imap.RFC822Size: Decouple from RFC822.Size
Derive directly from Int64MessageData instead and remove RFC822.Size
since the latter is not actually used or specified in RFC 822 and its
obsoletors.
2020-05-06 14:58:56 +10:00
Michael Gratton
f25892d879 Geary.RFC822.MailboxAddresses: Update API and valadocs
Add some doc comments, fix some methods to ensure the class is actually
immutable, remove some unused methods, add ctor from the GMime
equivalent object.
2020-05-06 14:58:56 +10:00
Michael Gratton
2b5e084b61 Geary.Engine.MailboxAddress: Don't force ISO-8859-1 encoding 2020-05-06 14:58:56 +10:00
Michael Gratton
27e1b5433f Geary.RFC822.MailboxAddress: Fix sense of 8-bit workaround check 2020-05-06 14:58:56 +10:00
Michael Gratton
0bbf0bfd32 Geary.RFC822.Message: Rename message_to_memory_buffer args for clarity 2020-05-06 14:58:56 +10:00
Michael Gratton
6e50c2a4c0 Geary.Mime.ContentParameters: Minor ctor API update 2020-05-06 14:58:56 +10:00
Michael Gratton
e0c1fb8a80 Geary.RFC822: Ensure various data constructors throw errors
Rather than just silently ignoring error conditions, throw RFC822
errors instead.
2020-05-06 14:58:56 +10:00
Michael Gratton
97e0093e29 Geary.ComposedEmail: Remove to_rfc822_message, it's redundant
Callers can just call the same thing that method does instead.
2020-05-05 21:57:17 +10:00
Michael Gratton
6d5f63692b Geary.Mime.ContentType: Rename ::deserialise to ::parse
Add unit tests.
2020-05-05 21:57:17 +10:00
Michael Gratton
f77bb50b5c src/engine/rfc822/rfc822-utils.vala: Updated to better match code style 2020-05-05 21:57:17 +10:00
Michael Gratton
d7e128ae72 src/engine/rfc822/rfc822.vala: Fix indentation to match style 2020-05-05 21:56:06 +10:00
Michael Gratton
97d34b2d4b Geary.ClientService: Set as unreachable on connectivity check error
Mark the service as unreachable if a connectivity check error occurs
since if we can't determine it is reachable, we probably can't connect
to it either.
2020-04-24 15:30:04 +10:00
Michael Gratton
0e673ce5f8 Geary.ClientService: Update connectivity timeouts
Swap reachable and unreachable timeouts periods so that connections
are dropped sooner and not re-established too early.
2020-04-24 15:30:04 +10:00
Michael Gratton
530c205ce7 Geary.Util.ConnectivityManager: Fix a spurious connectivity error report
When a general error occurs checking connectivity of a remote server,
only treat it as an error if GNetworkMonitor indicates the network is
available (i.e. that a default route exists). If there is no network,
it's not surprising that the error occurred.

This fixes a spurious error when the delayed check runs but the host
is offline.
2020-04-24 15:30:04 +10:00
Michael Gratton
991c9ef5d7 Geary.App.ConversationMonitor: Fix more races when starting/stopping
Ensure that if stopping the conversation monitor while it is waiting
for the folder to open that the folder isn't closed, and if an error
is thrown when opening the folder that it gets thrown by
::start_monitoring anyway.

Hopefully fixes #741
2020-04-24 15:30:04 +10:00
Michael Gratton
a385ce8fc2 Geary.App.ConversationMonitor: Throw error closing folder when possible 2020-04-24 15:30:04 +10:00
Michael Gratton
df2bce4eb8 Geary.ImapEngine.GenericAccount: Fix duplicate folders on first load
When loading an account for the first time, folders may not be processed
such that parents are handled first, leading to phantom folders created
for them.

This is particularly noticeable for GMail accounts, where the `[GMail]`
folder would typically show up, since it was created twice.
2020-04-23 11:17:01 +10:00
Michael Gratton
e94ce67605 Geary.Imap.MailboxAttributes: Fix missing SPECIAL-USE \All case
This was causing GMail's All Mail folder to not show up as a special-use
folder.
2020-04-23 10:41:09 +10:00
Michael Gratton
1b529d2195 Minor doc comment update 2020-04-23 09:35:19 +10:00
Michael Gratton
48ed8d9fe3 Geary.Account: Support creating folders in the personal name space
Add `create_personal_folder` method, implement it in
ImapEngine.GenericAccount. Use this when creating required special
folders to reduce code duplication.
2020-04-23 09:35:19 +10:00
Michael Gratton
e0dc785240 Geary.ImapEngine: Don't add local folders then update their special use
Set local folder special use when they are loaded rather than doing it
in two steps, so that when client code is notified of the folders
being available, they will already have the correct special type.
2020-04-23 09:35:19 +10:00
Michael Gratton
400850cc44 Geary.AccountInformation: Rework how special use folder paths are stored
Use a simple list of strings to store path steps, since we don't know
what the root will be in advance, and this leads to errors if callers
try to compare the info's paths to (say) an actual IMAP path.

Store path steps in a SpecialUse to path step map property, rather than
as individual properties for each special use, to reduce repetition.
2020-04-23 09:35:19 +10:00
Michael Gratton
085ed9a6a3 Geary.App.DraftManaager: Update API to something more RAII-like
Replace open method with an async ctor, so we can make a few properties
non-null by default, and callers need to call one less call. Make
destination folder configurable, and require email flags passed in
via the ctor, not every time when saving.
2020-04-21 23:36:24 +10:00
Michael Gratton
e22d74db4b Geary.Folder: Add SpecialUse.CUSTOM and set_used_as_custom method
Support applications setting custom special uses for folders.
2020-04-18 18:37:35 +10:00
Michael Gratton
5ce6517b3b Geary.Logging: Add/update API docs for the package and a few functions 2020-04-17 08:59:00 +10:00
Michael Gratton
834b6eb4bf Geary.Db: Disable SQL query logging by default again
Even just logging SQL queries is extremely verbose, and pushes a lot
of logging messages off the end of the buffer. So rework result logging
flag and code to apply to both again.

Re-merge Application.Client's SQL logging command line flags back into
one again.
2020-04-17 08:49:33 +10:00
Michael Gratton
2fada87a72 Geary.Logging: Let callers determine threading safety for log_listener
Rather than scheduling calling a registered log_listener on the default
main loop context, let the listener implementation handle that in
whatever way they want.
2020-04-16 17:11:53 +10:00
Michael Gratton
01c093e26e Geary.Logging: Update domain suppression APIs
Make `suppress_domain`/`unsuppress_domain` return whether they actually
added or removed the suppression. Add `is_suppresed_domain` to allow
determining this at other times.
2020-04-16 17:11:34 +10:00
Michael Gratton
d5e94a257d Geary.Logging: Update how log blacklisting and suppression works
Blacklisting now prevents records from being created, where as
suppression now simply prevents them from being printed.

This means records are created for all log messages, regardless of
whether they are displayed.

Update API docs for a bunch of methods to make this clear, and to make
the requirements for getting log records in the first place is also
clear.
2020-04-16 11:44:56 +10:00
Michael Gratton
f4a4d699be Geary.Db: Add special flag for logging SQL results
Update the db's logging to log SQL statements normally, but add a
special case flag to enable logging query results as well, since these
are particularly verbose.
2020-04-16 11:44:19 +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
3b0815a1dc Geary.Logging: Remove Flag enum
Now that we have classes logging on sub-domains, and the ability to
suppress specific domains, remove flags and switch over to doing
domain suppression for manipulating debug settings in the client.
2020-04-15 17:05:09 +10:00
Michael Gratton
718f02bd8a Geary.Logging: Enable API clients to suppress DEBUG logging per-domain 2020-04-15 16:51:07 +10:00
Michael Gratton
972744c5dc Geary: Update IMAP and SMTP classes so logging domains are public
The client will need to access them so that it can (un)suppress them
as needed.
2020-04-15 16:49:19 +10:00
Michael Gratton
2f24974e7b Geary.Db.Context: Convert to implement Logging.Source
Use a custom logging sub-domain, update Connection to use debug
method from Source.
2020-04-15 15:36:07 +10:00
Michael Gratton
123812a97b Geary.ImapEngine.ReplayQueue: Implement Logging.Source
Convert to a source, log via a sub-domain.
2020-04-15 15:26:33 +10:00
Michael Gratton
a3c7bda146 Geary.App: Update conversation classes to use new logging framework
Ensure ConversationMonitor and ConversationSet both implement
Logging.Source and use a custom sub-domain.
2020-04-15 15:18:25 +10:00
Michael Gratton
3f661ff89b Geary.Imap: Update main classes to use new logging framework
Ensure ClientService, ClientSession, and ClientConnection uses a
logging sub-domain, update Deserialiser to implement Logging.Source.
2020-04-15 14:57:58 +10:00
Michael Gratton
46c38edb8b Geary.Smtp: Update main classes to use new logging framework
Ensure ClientService uses a logging sub-domain, update ClientSession
and ClientConnection to implement Logging.Source.
2020-04-15 14:57:58 +10:00
Michael Gratton
36327e5328 Geary.Logging.Source: Clean and fix up property modifiers 2020-04-15 14:57:58 +10:00
Michael Gratton
b16d021625 Geary.Logging: Allow Source implementations to specify logging domains 2020-04-15 14:53:16 +10:00
Michael Gratton
50fab17db2 src/engine: Fix valadoc warnings 2020-04-08 12:11:36 +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
ec78ee50b4 Geary.Imap.MailboxAttribute: Rename XLIST-specific attrs as such 2020-03-31 15:41:51 +11:00
Michael Gratton
ec382470fd Rename other uses of spam in the codebase to junk 2020-03-31 15:41:51 +11:00
Michael Gratton
32acff51b8 Geary.SpecialFolderType: Rename SPAM to JUNK
The latter is more general as it can also be used for malware, etc,
and less evocative of processed pig products.
2020-03-31 15:37:38 +11:00
Michael Gratton
19d29b9e9d Geary.Folder, Geary.SpecialFolderType: Move folder name i18n to client
Remove `Geary.Folder::get_display_name` method, and
`display-name-changed` signal, and
`Geary.SpecialFolderType::get_display_name`. Add new equivalent methods
for client in `Util.I18n` and use those instead.
2020-03-31 15:33:17 +11:00