3 Commits

Author SHA1 Message Date
Robin Jarry
018e6f81f4 lib: consolidate SASL authentication code
SASL and OAuth2 authentication logic was duplicated across the IMAP
worker and the SMTP sender code. Both implementations handled XOAUTH2,
OAUTHBEARER, and token caching independently, making maintenance
difficult and bug fixes error-prone.

Move this shared logic into lib/auth where it can be reused by all
backends. The IMAP worker no longer needs its own OAuth structs and
configuration parsing since it can now rely on the common
implementation also used by the SMTP sender.

Signed-off-by: Robin Jarry <robin@jarry.cc>
Reviewed-by: Simon Martin <simon@nasilyan.com>
2026-02-09 14:46:27 +01:00
Karel Balej
e8a6e8316a lib: add function to obtain Message-ID hostname
Make the function already present in app/compose.go reusable while also
changing its signature for it not to require involvement of a Composer
instance.

Signed-off-by: Karel Balej <balejk@matfyz.cz>
Acked-by: Robin Jarry <robin@jarry.cc>
2024-02-12 23:01:55 +01:00
Karel Balej
3553e4f271 send: move code to lib for reuse
Move the code which handles the preparation of a sender into which the
message can be written into lib to allow for reuse. Also hide the
sending backend a bit more from the `:send` command code by introducing
a NewSender function which determines which backend should be used and
invokes the appropriate sender factory function.

Rename send() to sendHelper() to avoid collision.

Signed-off-by: Karel Balej <balejk@matfyz.cz>
Acked-by: Robin Jarry <robin@jarry.cc>
2024-02-12 22:58:40 +01:00