mbsync: channel compatibility with previous iteration of mbsync

The previous version of mbsync used a single channel for an entire
account. This leads to issues when trying to change the mailbox
hierarchy on the local machine. The problem with this is that some
email providers (Gmail, among others) use a slightly different maildir
hierarchy, where the standard mailboxes (Inbox, Drafts, Trash, etc.)
are stored inside another directory (`[Gmail]/` in the case of Gmail).

This new version allows the user to specify any number of groups with
any number of channels within to reorder their mail however they wish.

However, to maintain backwards compatibility, I moved the original
channel-generating code to a function that will run ONLY when
there are no groups specified for THIS account.
This commit is contained in:
Karl Hallsby 2020-06-27 22:19:40 +02:00
parent 4b136696a2
commit b1a241ff9f

View file

@ -73,6 +73,21 @@ let
+ genGroupChannelConfig name mbsync.groups + genGroupChannelConfig name mbsync.groups
+ genAccountGroups mbsync.groups; + genAccountGroups mbsync.groups;
genAccountWideChannel = account:
with account;
if mbsync != {} then
genSection "Channel ${name}" ({
Master = ":${name}-remote:";
Slave = ":${name}-local:";
Patterns = mbsync.patterns;
Create = masterSlaveMapping.${mbsync.create};
Remove = masterSlaveMapping.${mbsync.remove};
Expunge = masterSlaveMapping.${mbsync.expunge};
SyncState = "*";
} // mbsync.extraConfig.channel) + "\n"
else
"";
# Given the attr set of groups, return a string of channels that will direct # Given the attr set of groups, return a string of channels that will direct
# mail to the proper directories, according to the pattern used in channel's # mail to the proper directories, according to the pattern used in channel's
# master pattern definition. # master pattern definition.