Currently, a lot of our build variables that are defined at
configuration time, are spread out across the code base, often declared
as `extern` which can break when moving around sections of the code
across files.
This commit introduces a "Config" namespace which basically maps to the
definitions in `config.h`, but allows us to properly access them too
from the Vala source code.
By doing so, it helps us to more explicitly see where we rely on a
build variable from this file (which should be obvious from the `Config'
namespace).
To make it ourselves a bit easier in Meson too, we can declare an
internal dependency, which helps ensure that we pull in the dependency
where needed.
You can test that this should be the correct order by adding a line for
each on a file and then running
```
$ cat "$TEST_FILE" | LC_ALL=C sort -r
```
Fixes: 43c23270a6 ("migrate locale from en_US.UTF-8 to C.UTF-8")
The parser would think the flag was a response code if the flag started
with a '[' character. Flags like these are sometimes returned by Gmail
which broke fetching emails from Gmail.
This commit checks if the parser is already parsing flags and if so
treats any starting '[' characters as part of the flag string.
Remove "\n " sequences from RFC822 text before decoding so that any
long mailboxes/mailbox lists folded before the 80 char limit are
unfolded.
Fixes#1009
Ensure OR is actually used to separate disjuncts, don't prefix match
non-stemmed terms when a stemmed version exists or when EXACT is
specified. Ensure column is correctly specified per disjunct.
SQLite FTS5 doesn't allow all negated terms in matches, and since NOT
is a binary operator (rather than unary) negated terms should be listed
after any positive terms.
Move SQL generation for FTS search from ImapDb.Account to SearchQuery.
Convert to use Geary.SearchQuery.Term instances to generate SQL, rather
than parsing the expression. Simplify the generated SQL substantially
and generate MATCH values that work with SQLite FTS5.
Add SQL migration that drops the old FTS4 MessageSearchTable table,
re-create as a FTS5 table, clean up the column names a bit, and adds a
flags column so unread/starred queries can be made fast.
Define a SQLite FTS5 extension function `geary_matches()` to replace
the FTS3 `offsets()` function which no longer exists in FTS5, based on
Tracker's implementation.
Update code to FTS5 conventions (docid -> rowid, etc), use new column
names, populate and update the flags column as the email's flags
change, and use new match function for getting matching tokens.
Advanced searches are probably currently broken, these will be fixed
by subsequent commits.
Using `whitespace: pre-wrap` to format plain text email sometimes
causes additional width to be allocated by the plain text blocks that
then does not get used due to the constraints on the HTML element.
The allocated space remains however and hence an un-needed horizontal
scrollbar appears.
Using `break-spaces` instead seems to help since it allows breaks after
a space character, leading to the additional space not otherwise being
allocated.
Convert `get_protocol_state` to an automatic property, so that rather
than requiring explcit signals for lifecycle events, a GObject notify
signal can be used instead.
Convert disconnect signal to a property so it can be accessed if needed.
Convert code listening to the disconnect signal to listen to notify
signals for `protocol_state` instead, and hence also treat the session
as disconnected when a logout is in progress.
Fixes#986
Since both submitting a command no longer requires a cancellable, and it
is desirable to avoid sending a queued command that has already been
cancelled beforehand, add a new `Command.should_send` Cancellable
property to specify if a command should (still) be sent or not, and stop
passing a cancellable to ClientSession when submitting commands.
Allow call sites to pass in existing cancellable objects, and thus also
add it it as a ctor property to the Command class and all subclasses.
Lastly, throw a cancelled exception in `wait_until_complete` if send
was cancelled so that the caller knows what happened.
Remove redundant cancellable argument from
`Imap.Client.command_transaction_async` and rename it to
`submit_command` to make it more obvious about what it does.
Some servers (e.g. Dovecot) use placeholder strings instead of the empty
string (e.g. "MISSING_DOMAIN") in FETCH Envelope responses when a
required address part (e.g. local part, domain) are empty.
This adds a quirk that can be enabled for such servers to check for the
placeholders and if found, replace them with empty strings.
Add a quirks object as a property so code that parses the response has
access to it. Simplify constructing server responses slightly and pass
the IMAP connection's quirks when doing so.
Rename append method to concatenate_list since that's what it actually does. Add new method
for cat'ing a single mailbox, add methods for merging both a single mailbox and mailbox
list into a new list.
If an address does not have an `@`, or if the IMAP constructor is called
with empty mailbox or domain parts, then these properties will be empty.
This is not uncommon, especially on UNIX hosts where system accounts
send email.
Ensure this is handled correctly in the constructors and are
round-tripped correctly by `to_rfc822_address` and hence
`to_rfc822_string`.
Although when processing mailbox addresses lists are effectively sets,
the ordering can be important for people. As such, make `equal_to`
comparisons require identical ordering, and add new `contains_all` for
order-independent comparisons.
Engine mocks don't need to be in the `Geary` namespace, and including
them there makes it difficult to use them in client tests, so put them
all in their own name-space and corresponding directory.
Remove `Message.without_bcc` ctor since we can now get GMime to exclude
BCC headers when serialising, avoiding the overhead of taking a complete
copy of the message just to strip BCCs.
Rename `get_network_buffer` to `get_rfc822_buffer` to be a bit more
explicit in that's the way to get an actual RFC822 formatted message.
Replace book args with flags, and take a protocol-specific approach
rather than feature-specific, because in the end you're either going to
want all the SMTP formatting quirks or none of them.
Remove custom dot-stuffing support from Smtp.ClientConnection, since it
is redundant.
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.
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.