Commit Graph

50 Commits

Author SHA1 Message Date
Leander Beernaert 9390cb64b4 GODT-1817: Restore move related feature tests
Gluon updated to latest dev commit, required for feature. Checks from
move_local_folder.feature are implemented in Gluon.
2023-01-06 10:58:07 +01:00
Leander Beernaert 757e8a02ec GODT-2233: Fix sub folder creation bug
Sub folders with more than 2 levels of depth (e.g.: Folders/first/second)
could not be created since we did not update the known label list we use
to validate the request.
2023-01-02 11:41:49 +01:00
Leander Beernaert 6d0a128111 Other: Update copyright year 2023-01-02 11:09:11 +01:00
James Houlahan 04881b9b78 GODT-2178: Bump go-proton-api to fix drafts 2022-12-05 15:14:30 +01:00
Jakub 8408a5fdc0 GODT-2170: Improving test server behaviour. 2022-12-02 13:27:19 +00:00
Jakub 828fe0e86e GODT-2170: Update draft event means delete old and create new message. 2022-12-02 13:27:19 +00:00
Jakub 5c3179df48 GODT-2170: User create draft rounte: first steps. 2022-12-02 13:27:19 +00:00
Leander Beernaert 618cb27ac1 Other: Disable perma-delete for expunge on Spam folder 2022-12-02 13:43:53 +01:00
James Houlahan e601245f01 Other(chore): Bump major version to v3 2022-11-23 16:08:27 +01:00
James Houlahan ad1fb47b0d Other: Switch from liteapi to go-proton-api 2022-11-23 15:17:56 +01:00
James Houlahan d1f140ebcb Other: More descriptive event poll name 2022-11-21 10:20:28 +00:00
James Houlahan 721cd9f319 GODT-2002: Wait for API events to be applied after send
When we send a message, the send recorder records the sent message.
When the client then appends an identical message to the sent folder,
the deduplication works and instead returns the message ID of the
existing proton message, rather than creating a new message. Gluon is
expected to notice that it already has this message ID and perform
some deduplication stuff internally.

However, it can happen that gluon doesn't yet have this message ID,
because we haven't yet received the "Message Created" event from the
API. To prevent this, we poll the events after send and wait for all
new events to be applied.

There's still a chance that the event wasn't generated yet on the API
side. Not sure what we can do about this.
2022-11-21 10:20:28 +00:00
James Houlahan 9e6cbcb35e GODT-2040: Bump UID validity when clearing sync status 2022-11-20 21:48:22 +01:00
James Houlahan 59278913ca GODT-2037: Handle and log API refresh event 2022-11-16 13:48:31 +01:00
Leander Beernaert 098685ec8b GODT-2030: Rework deletion check on expunge
Some messages were not being deleted properly because they were also
present in the All-Sent folder.

The code has now been changed to filter out AllMail, AllDraft and
AllSend. If there are no remaining labels, the message will be deleted
permanently.
2022-11-16 13:48:30 +01:00
James Houlahan 6c9293ec14 Other: Use current time if date is missing 2022-11-16 13:48:30 +01:00
Jakub 1e29a5210f GODT-1954: Draft message support
Add special case handling for draft messages so that if a Draft is
updated via an event it is correctly updated on the IMAP client via a
the new `imap.MessageUpdated event`.

This patch also updates Gluon to the latest version.
2022-11-16 13:48:30 +01:00
James Houlahan c548ba85fe Other: Add more extensive logging 2022-11-16 13:48:30 +01:00
James Houlahan 4ded8784fc Other: Allow non-received messages to be imported to INBOX 2022-11-16 13:48:30 +01:00
James Houlahan 75b788b793 GODT-1993: Use more efficient filtering for message deletion 2022-11-16 13:48:30 +01:00
James Houlahan 62d62474fb Other: Poll events after each IMAP operation
This matches bridge's behaviour (except for it being a non-blocking
wait).

It also cleans up some unused connector methods.
2022-11-16 13:48:30 +01:00
James Houlahan a213b48f93 GODT-2002: Poll after SMTP send
After sending, a client might append to the sent folder over IMAP.
In this case, we perform deduplication and return the message ID of the
sent message. However, if we haven't already processed this message in
gluon, it doesn't work as expected.

This change polls the event stream immediately after send. Note that it
doesn't wait for these events to be processed; that should be done in a
follow-up commit.
2022-11-16 13:48:30 +01:00
Leander Beernaert 8f420d728c GODT-1984: Handle permanent message deletion
Only delete messages when unlabeled from trash/spam if they only exists
in All Mail and (spam or trash).

This patch also ports delete_from_trash.feature and use status rather
than fetch to count messages in a mailboxes.
2022-11-16 13:48:30 +01:00
James Houlahan df818bc2b8 Other: Update UID validity in vault when necessary 2022-11-16 13:48:30 +01:00
James Houlahan d4da325e57 Other(refactor): Sort safe.Mutex types before locking to prevent deadlocks
This change implements safe.Mutex and safe.RWMutex, which wrap the
sync.Mutex and sync.RWMutex types and are assigned a globally unique
integer ID. The safe.Lock and safe.RLock methods sort the mutexes
by this integer ID before locking to ensure that locks for a given
set of mutexes are always performed in the same order, avoiding
deadlocks.
2022-11-16 13:48:30 +01:00
James Houlahan fd80848fcd Other(refactor): Use normal value + mutex for user.updateCh 2022-11-16 13:48:30 +01:00
James Houlahan cab5ee6752 Other(refactor): Use normal value + mutex for user.apiLabels 2022-11-16 13:48:30 +01:00
James Houlahan 0bc99dbd4f Other(refactor): Use normal value + mutex for user.apiAddrs 2022-11-16 13:48:30 +01:00
James Houlahan 85c0d6f837 Other: Hold user labels in memory
Labels can be held locally and updated in memory. This greatly improves
the responsiveness of IMAP mailbox operations as we don't need to fetch
all a user's labels to find the parent whenever a mailbox is moved.
2022-11-16 13:48:30 +01:00
James Houlahan fd0c262645 Other: Implement subfolder support 2022-11-16 13:48:30 +01:00
James Houlahan 83c7396f2d Other: Separate getMessageHash from sendRecorder 2022-11-16 13:48:30 +01:00
James Houlahan 036a416a25 GODT-1777: Message de-duplication in IMAP (+ cleanup) 2022-11-16 13:48:30 +01:00
James Houlahan 828385b049 Other: Fix user sync leaks/race conditions
This fixes various race conditions and leaks related to the user's sync
and API event stream. It was possible for a sync/stream to begin after a
user was already closed; this change prevents that by managing the
goroutines related to sync/stream within cancellable groups.
2022-11-16 13:48:30 +01:00
James Houlahan 0f125196a6 Other: Bump go-smtp version to fix race condition
There was a race condition internal to the go-smtp library.
In order to fix it, a version bump was necessary.
However, this significantly changed the library interface.
2022-11-16 13:48:30 +01:00
James Houlahan 81f4ef609b Other: Mitigate double-unlock of user keyring
We need to unlock the user keyring anyway to unlock the address keyring,
so we should just return it instead of re-unlocking the user keyring
when sending a message.
2022-11-16 13:48:30 +01:00
James Houlahan 80d3f7d179 Other: Set \Draft flag on messages in drafts mailbox 2022-11-16 13:48:30 +01:00
James Houlahan c4343e0124 Other: Bump liteapi and clean up tests a bit 2022-11-16 13:48:30 +01:00
James Houlahan 04b6571cb8 Other: Handle Seen/Flagged IMAP flags when APPENDing a message
When an IMAP client appends a message to a mailbox, it can specify
which flags it wants the appended message to have. We need to handle
these in a proton-specific way; not-seen messages need to be imported
with the Unread bool set to true, and flagged messages need to
additionally be imported with the Starred label.
2022-11-16 13:48:30 +01:00
Leander Beernaert a7a7d9a3d4 GODT-1742: Implement hide All Mail 2022-11-16 12:26:09 +01:00
Leander Beernaert ca132881f9 Other: Update Gluon to v0.13.0 2022-11-16 12:26:09 +01:00
Leander Beernaert 7c62312220 Other: Fix all linter errors 2022-11-16 12:26:09 +01:00
Leander Beernaert b36972ce71 GODT-1650: Implement Connector.CreateMessage 2022-11-16 12:26:09 +01:00
Leander Beernaert e10cd2a3ed GODT-1901: Allow to set IMAP SSL from UI 2022-11-16 12:26:09 +01:00
James Houlahan fd63611b41 Other: Safer user types 2022-11-16 12:26:09 +01:00
James Houlahan 14a578f319 Other: Linter fixes after bumping linter version 2022-11-16 12:26:09 +01:00
James Houlahan ba9368426c GODT-1650: Send extras 2022-11-16 12:26:09 +01:00
Romain LE JEUNE b536b8707e GODT-1609: use byte array for password 2022-11-16 12:26:09 +01:00
James Houlahan e9672e6bba GODT-1815: Combined/Split mode 2022-11-16 12:26:08 +01:00
James Houlahan 1da1188351 GODT-1815: Upgrade to liteapi v0.31.0 2022-11-16 12:26:08 +01:00
James Houlahan 39433fe707 GODT-1779: Remove go-imap 2022-11-16 12:26:08 +01:00