OfflineIMAP / offlineimap

Read/sync your IMAP mailboxes (python2) [LEGACY: move to offlineimap3]
http://www.offlineimap.org
Other
1.78k stars 360 forks source link

The folderfilter option should work in an Account section #695

Closed acolomb closed 3 years ago

acolomb commented 3 years ago

General informations

Configuration file offlineimaprc

This question concerns the following quote from the example configuration file:

# This option stands in the [mbnames] section.
#
# You can also specify a folderfilter.  It will apply to the *translated* folder
# name here, and it takes TWO arguments: accountname and foldername.  In all
# other ways, it will behave identically to the folderfilter for accounts.
# Please see the folderfilter option for more information and examples.
#
# This filter can be used only to further restrict mbnames to a subset of
# folders that pass the account's folderfilter.
#
# E.g.: with mbnames_folderfilter defined like this in the python file:
#
# def mbnames_folderfilter(accountname, foldername):
#     allowed = {'myaccount': ['folderA', 'folderB']}
#     if accountname in allowed:
#         return foldername in allowed[accountname]
#     return False
#
# For correct folderfilter with Microsoft servers, please see
# http://www.offlineimap.org/doc/FAQ.html#exchange-and-office365
#
#folderfilter = mbnames_folderfilter

This comment wording suggests that a folderfilter for accounts exists. However, the folderfilter option currently only works within a [Repository XYZ] section, but not inside an [Account]. I think the latter would be very useful, so one can use the same repository definition for multiple accounts, which are limited to different subsets of folders each. Right now the repository section needs to be tweaked each time a different folder set should be synchronized, or several identical sections added, differing only in their folderfilter option.

The proposed semantics would be that adding a folderfilter option within an [Account] section will be treated as if the same folderfilter option had been specified under both involved [Repository] sections.

What do you think of such a feature? Would it be hard to implement in Offlineimap?

nicolas33 commented 3 years ago

folderfilter must be applied on the repository level. Each repository might have it's own (independent) filters. There's no reason to have this at the account level, IMHO.

BTW, due to the end of python2 we won't implement new features. You might like to apply on offlineimap3.