Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IMAP flags/keywords case sensitivity/aliases #209

Open
taam opened this issue Oct 12, 2024 · 1 comment
Open

IMAP flags/keywords case sensitivity/aliases #209

taam opened this issue Oct 12, 2024 · 1 comment

Comments

@taam
Copy link

taam commented Oct 12, 2024

General informations

  • system/distribution (with version): alpine:3.20 (docker)
  • offlineimap version (offlineimap -V): v8.0.0
  • Python version: v3.12.7

Configuration file offlineimaprc (requires code modifications, does not work with current versions)

[...]

[Repository local]
customflag_a = NonJunk
customflag_a_1 = nonjunk
customflag_b = Junk
customflag_b_1 = junk
customflag_b_2 = $Junk
[...]

Steps to reproduce the error

When using the customflag_x feature to sync IMAP flags/keywords, they are currently treated to be case-sensitive. It seems the IMAP specification is not very explicit about this, but I've found various discussions, where the conclusion seems to be, that they should be case-insensitive. And indeed I'm finding on my various accounts common keywords in different variants, in particular NonJunk and Junk. I seems the correct behavior would be to map them to the same flag, so case-independent.

In order to achieve this, I'm using a custom version with a very simple patch, allowing a configuration as shown above, effectively allowing additional keywords for the same char. This is o.c. a bad hack. I see two possible solutions here (none-mutual exclusive):

  • If it is indeed correct, that IMAP flags/keywords are case-insensitive, they should be handled accordingly. (E.g. by normalization on the IMAP side, or by case-insensitive comparison.)
  • One could allow arbitrary aliases as I did, which has the advantage, that it also covers Junk vs $Junk, but it does not really preserve the original keyword.

This is also related to #85, which unfortunately is not yet implemented it seems. (I personally use offlineimap to create backups of my IMAP accounts, so syncing the IMAP flags/keywords currently is somewhat futile, since I couldn't restore them anyway, at least not for now.) A fix for this should probably keep in mind, how the custom flag would later be restored on the IMAP side.

@taam
Copy link
Author

taam commented Oct 12, 2024

Somewhat related side notes:

  • Since customflag_x only allows lower case chars, it's not possible to translate the very common $Forwarded keyword to the official maildir P flag. (I'm aware of https://github.com/OfflineIMAP/offlineimap/wiki/Syncing-custom-tags.)
  • offlineimap already stores the combined maildir flags in the metadata sqlite database, can't we put the IMAP flags/keywords there? That way, one could preserve all of them, no case sensitivity issue, no customflags necessary, ... maybe too backup specific, probably not quite fitting the concept I guess?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant