From 07c322a7cff03267fd881adae1afe63367c5d608 Mon Sep 17 00:00:00 2001 From: lgehr <35228720+lgehr@users.noreply.github.com> Date: Fri, 22 Dec 2023 18:14:39 +0100 Subject: [PATCH] aerc-accounts: support for maildirpp (#4653) * aerc-accounts: support for maildirpp aerc-accounts now is aware of the mbsync.subFolders setting * aerc: Adds test for maildirpp format --------- Co-authored-by: lgehr --- modules/programs/aerc-accounts.nix | 10 +++++++++- tests/modules/programs/aerc/extraAccounts.expected | 12 ++++++++++-- tests/modules/programs/aerc/settings.nix | 11 ++++++++++- 3 files changed, 29 insertions(+), 4 deletions(-) diff --git a/modules/programs/aerc-accounts.nix b/modules/programs/aerc-accounts.nix index 22f4db082..6a6153e5e 100644 --- a/modules/programs/aerc-accounts.nix +++ b/modules/programs/aerc-accounts.nix @@ -145,6 +145,11 @@ in { "maildir://${config.accounts.email.maildirBasePath}/${cfg.maildir.path}"; }; + maildirpp = cfg: { + source = + "maildirpp://${config.accounts.email.maildirBasePath}/${cfg.maildir.path}/Inbox"; + }; + imap = { userName, imap, passwordCommand, aerc, ... }@cfg: let loginMethod' = @@ -207,7 +212,10 @@ in { // (optAttr "aliases" account.aliases); sourceCfg = account: - if account.mbsync.enable || account.offlineimap.enable then + if account.mbsync.enable && account.mbsync.flatten == null + && account.mbsync.subFolders == "Maildir++" then + mkConfig.maildirpp account + else if account.mbsync.enable || account.offlineimap.enable then mkConfig.maildir account else if account.imap != null then mkConfig.imap account diff --git a/tests/modules/programs/aerc/extraAccounts.expected b/tests/modules/programs/aerc/extraAccounts.expected index 172e3452f..0697d9611 100644 --- a/tests/modules/programs/aerc/extraAccounts.expected +++ b/tests/modules/programs/aerc/extraAccounts.expected @@ -54,9 +54,17 @@ from = Foo Bar outgoing = smtp+insecure+plain://foobar@smtp.host.invalid:42 outgoing-cred-cmd = echo PaSsWorD! -[i_maildir-mbsync] +[i1_maildir-mbsync] from = Foo Bar -source = maildir:///home/hm-user/Maildir/i_maildir-mbsync +source = maildir:///home/hm-user/Maildir/i1_maildir-mbsync + +[i2_maildirpp-mbsync] +from = Foo Bar +source = maildirpp:///home/hm-user/Maildir/i2_maildirpp-mbsync/Inbox + +[i3_maildir_flatten-mbsync] +from = Foo Bar +source = maildir:///home/hm-user/Maildir/i3_maildir_flatten-mbsync [j_maildir-offlineimap] from = Foo Bar diff --git a/tests/modules/programs/aerc/settings.nix b/tests/modules/programs/aerc/settings.nix index 523b25646..af4d16f70 100644 --- a/tests/modules/programs/aerc/settings.nix +++ b/tests/modules/programs/aerc/settings.nix @@ -202,7 +202,16 @@ with lib; tls.useStartTls = true; }; }; - i_maildir-mbsync = basics // { mbsync.enable = true; }; + i1_maildir-mbsync = basics // { mbsync.enable = true; }; + i2_maildirpp-mbsync = basics // { + mbsync.enable = true; + mbsync.subFolders = "Maildir++"; + }; + i3_maildir_flatten-mbsync = basics // { + mbsync.enable = true; + mbsync.subFolders = "Maildir++"; + mbsync.flatten = "."; + }; j_maildir-offlineimap = basics // { offlineimap.enable = true; }; k_notEnabled = basics // { aerc.enable = false; }; l_smtp-auth-none = basics // {