Commit graph

1759 commits

Author SHA1 Message Date
Michael Gratton
b6ec51bc3a Don't consider substrings when checking distinct mailbox names
RFC822.MailboxAddress.has_distinct_name() really needs to not do
sub-string checks since it will cause addresses like
`"foo-bar@baz" <bar@baz>` to not have a distinct name. To keep the fix
for #491 in effect, also adds special case checking for sinlge quotes.

Add some more tests to cover these cases.

Partially reverts commit 6e137eb649

See discussion in GNOME/geary!252
2019-07-17 18:11:17 +10:00
Michael Gratton
9c8723ac2a Fix folders removed from the server never being removed
Third time lucky at using BidiIterator correctly :(
2019-07-17 15:06:41 +10:00
Michael Gratton
bed1bad3ea Fix "'test@example.com' <test@example.com>" marked as spoofed
Make RFC833.MailboxAddress.has_distinct_name() consider substrings
rather than straight-up string comparison.

See #491
2019-07-06 14:38:05 +10:00
Michael Gratton
4df0bb7880 Capture log records in Geary.ProblemReport
Allow getting both the earliest and latest log records from
Geary.Logging and record these when constructing new ProblemReport
instances. Update InspectorLogView.load to have starting and end log
record parameters, and specify these when displaying a problem report.

This ensures that only those log records up to the point of the problem
report being generated are included in the report, and not any later
records.
2019-07-05 13:00:11 +10:00
Michael Gratton
6e07d066aa Use a reasonable sized buffer when formatting log messages 2019-06-30 17:23:56 +10:00
Michael Gratton
e338d5d2df Stop printing elapsed time between logs, log absolute ms instead 2019-06-30 17:22:38 +10:00
Michael Gratton
a0d2e7347b Add Geary.Logging.clear method, call it on app shutdown 2019-06-30 16:43:15 +10:00
Michael Gratton
95e856b664 Ensure logging system is thread-safe
Use a mutex to log when outputting debug log lines, ensure the listener
(if any) is invoked on the main loop.
2019-06-30 16:27:48 +10:00
Michael Gratton
258537eb27 Pretty-print well known logging variables
Print account, folder and client session details abbrevated, pull a few
more details into Logging.Record.
2019-06-30 16:15:03 +10:00
Michael Gratton
337ea2ea05 Integrate Logging.Record into structured logging system
Record logged fields in the record and use them when formatting a
message.
2019-06-30 16:15:03 +10:00
Michael Gratton
ff3c4b0cd7 Fix incorrect log field key being used for Loggable objects 2019-06-30 16:15:03 +10:00
Michael Gratton
b0ca8c9e0a Switch to using GLib structured logging
This converts the logging infrastructure to using structured logging
calls, adds and sets a structured logging writer.
2019-06-30 16:15:03 +10:00
Michael Gratton
de8c3858e9 Convert key classes to implement Loggable
Make accounts, folders, client sessions and account ops implement
Loggable, remove manual context from log messages there and in
subclasses.
2019-06-30 16:14:50 +10:00
Michael Gratton
0bb530d24e Add Geary.Logging.Flags.ALL to specify a message should always be logged 2019-06-30 16:14:50 +10:00
Michael Gratton
f7c833242a Add Geary.Loggable interface for objects that can log and be logged
For now, just implement using existing non-structured logging calls.
2019-06-30 16:14:50 +10:00
Michael Gratton
6e137eb649 Make RFC822.MailboxAddress.has_distinct_name is case-insensitive
This prevents mailboxes being marked as spoofed when the name part and
address part are equal but with different case.
2019-06-27 10:35:26 +10:00
Michael Gratton
56e0fb7543 Make search update process optional when ImapDB.Account opened
This allows ImapDB unit tests to avoid running the process when it
really doesn't need to be run. Should fix anther criticial about
ImapDB being null (see previous commit).
2019-06-23 13:26:07 +10:00
Michael Gratton
0f4eda5f45 Make ImapDb.GC's ref to the database strong
This shoud fix Geary.ImapDb.DatabaseTest test failing with a critical:

```
geary-CRITICAL **: 05:02:51.688: geary_db_database_get_is_open:
assertion 'GEARY_DB_IS_DATABASE (self)' failed
```

Doing so constitutes a circular ref, but since it is broken once GC is
complete anyway, it shouldn't be a problem.
2019-06-23 12:49:39 +10:00
Michael Gratton
3ffa7dcd25 Trivial code cleanup 2019-06-22 16:50:10 +10:00
Michael Gratton
4e1aa32514 Ensure Geary.ContactStoreImpl handles non english searches
Fix DB impl actually do UTF-8 case-insensitive search matching. Add
some unit tests.
2019-06-22 14:11:10 +10:00
Michael Gratton
dd9d066405 Ensure Geary.ContactStoreImpl validates UTF-8 strings 2019-06-15 16:53:17 +10:00
Michael Gratton
3007ac51da Do prefix-only searching in ContactStoreImpl to impove results 2019-06-13 16:56:03 +10:00
Michael Gratton
71cb7fcdfe Add Geary.ContactStore.search method, impementation and tests 2019-06-13 16:56:03 +10:00
Michael Gratton
66a664f98d Clean up ImapDB.Account ctor/open API a bit
Move args from open_async to ctor and use these to determine and store
DB file and attachment paths as properties. This allows constructing
the DB instance up front and markig it as non-nullable, simplifies
calling patterns and hence allows removing one use of the deprecated
Engine singleton, and by moving in the local data deletion
implementation from ImapEngine.GenericAccount, also allows removing a
static helper method.
2019-06-13 16:55:23 +10:00
Michael Gratton
5e13dd0abd Replace Db.PrepareDelegate with a subclass virtual function hook
While slightly less flexible, it fits the Engine's needs and simplifies
the DB API.
2019-06-13 16:35:17 +10:00
Michael Gratton
03b5fcee8a Pass email to a contact harvester instance when persisting it
Add a ContactHarvester arg to ImapDB.Folder.create_or_merge_email and
call it on the resulting email. Add and update a new harvester
property to MinimalFolder and pass that in as needed.
2019-06-13 16:33:44 +10:00
Michael Gratton
65ab37938f Implement new contact harvester for the engine
Replaces harvesting code in ImapDB code so as to be stand-alone and
reusable. Implement harvesting policy to only harvest from a set of
whitelisted special folder types (so junk and trash is not harvested)
and only harvest valid, non-spoofed, addresses.
2019-06-13 16:32:47 +10:00
Michael Gratton
96cbb83f83 Ensure Geary.Contact real names are distinct from their address
This avoids presenting contacts as "name@example.com" <name@example.com>
2019-06-13 16:32:08 +10:00
Michael Gratton
5ab35da47b Clean up contact importance API
Move Importance enum into Contact since it's only used there, simplify
members and clean up call sites.
2019-06-13 16:29:49 +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 Gratton
809f664319 ContactStoreImpl unit tests 2019-06-13 16:28:55 +10:00
Michael Gratton
2ff2d2421f Clean up ContactFlag API
Move ContactFlag class into Contact class, rename Contact.flags property
to avoid redundancy and make it non-nullable to be able to simplify its
use.
2019-06-13 16:28:51 +10:00
Michael Gratton
0b734f7ba2 Don't load all engine contacts on startup
Prepare for doing composer autocomplete via queries by not loading all
contacts at startup in the engine. Update Geary.ContactStore API to that
end, and convert Geary.Account.get_contact_store accessor method to a
property.
2019-06-13 16:28:35 +10:00
Michael Gratton
3fb74e6e56 Fix valac warning 2019-05-24 12:30:12 +02:00
Michael Gratton
d56aa10ff6 Fix valadoc issues 2019-05-24 12:30:12 +02:00
Rafael Fontenelle
2509c5c4f0 Fix misspellings 2019-05-22 20:47:08 +00:00
Michael Gratton
534692a02c Update workaround for mail.ru and others to work again
The changes to Imap.Command broke the originial workaround added in
commit 3940bf7d for mail.ru's non-compliant interpretation of IMAP
FETCH BODY header fields.

This cleans up the implementation a bit and re-enables it.

See issue #410
2019-05-04 13:20:10 +10:00
Michael Gratton
ec7fd5268b Update IMAP error handling a bit for consistency
Update ImapError API docs for SERVER_ERROR and UNAVAILBALE, make sure
IMAP classes are using those as appripriate.
2019-05-04 13:18:47 +10:00
Michael Gratton
37da52e14f Enforce correct formatting for SMTP MailRequest and RcptRequest 2019-04-24 20:46:45 +10:00
Michael Gratton
534b4e27d9 Don't MIME-encode RFC822 mailbox local parts
This is explicilty disallowed by RFC 2074 §5 and not accepted by mail
servers.

See #336
2019-04-24 20:43:39 +10:00
Michael Gratton
c306c2c5fa Correctly handle escaping UTF-8 characters in RFC822 mailboxes
Use string.get_next_char() to handle iterating over an
RFC822.MailboxAddress mailbox local part, and explicitly allow UTF-8
2, 3, and 4 byte chars without quoting, per RFC 5322.

This lets us fix the test cases that use UTF-8 chars in the local part.
2019-04-24 20:38:11 +10:00
Michael Gratton
f7488453d0 Make it easier to obtain folders from path objects from Geary.Account
Replace async folder accessors with sync versions, add a means of
obtaining a folder path from its serialised form.
2019-04-17 09:06:24 +10:00
Michael Gratton
01a154bc5f Make it possible to distinguish between different folder roots
Add a label to Geary.FolderRoot so it different instances can be
differenciated.
2019-04-17 09:06:24 +10:00
Michael James Gratton
dd3a7a1bc8 Add API for (de)serialising FolderPath and EmailIdentifier
Supports (de)serialising via GLib.Variant for use as GLib.Action targets
transmission via DBus, etc.
2019-04-17 09:06:24 +10:00
Michael Gratton
4497b1275a Merge branch 'tnef-support' into 'mainline'
TNEF (winmail.dat) parsing support via libytnef

See merge request GNOME/geary!10
2019-04-16 12:38:25 +00:00
Greg V
6acddfd02c engine: add missing libm dependency
floor() is now used at rfc822-message-data.vala:213 via GLib.Math.floor
2019-04-11 19:36:19 +03:00
Oliver Giles
18fcf0e18f TNEF (winmail.dat) parsing support via libytnef 2019-04-11 12:24:52 +03:00
Michael Gratton
e428d7b2cb Minor code tidy up 2019-04-08 18:05:03 +10:00
Michael Gratton
194ca0e273 Blacklist displaying certain annoying messages in the Inspector 2019-04-08 18:05:03 +10:00
Michael Gratton
6dc8b278f0 Append new log records to the inspector and scroll to them 2019-04-08 18:05:03 +10:00