Skip to content

Conversation

@ajkessel
Copy link

@ajkessel ajkessel commented Dec 5, 2024

Protonmail provides a label metadata field path which includes the full path of the folder. This commit adds support for path and uses path if it exists, thus preventing the situation where folder x/z appears to be the same as folder y/z. It then converts the slashes in the paths to dots when presented to the IMAP client. A better implementation would use the IMAP RFC to show parent and child folders and shouldn't be too hard to do, but this at least allows the user to see their fully qualified folders in their IMAP client for the time being, rather than having an erroneous presentation.

@ajkessel ajkessel mentioned this pull request Dec 5, 2024
u.mailboxes[label.ID], err = newMailbox(label.Name, label.ID, nil, u)
var displayName string
if len(label.Path) > 0 {
displayName = strings.ReplaceAll(label.Path, "/", ".")
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

. might be used elsewhere in the name. Instead of replacing / with ., could we define the IMAP separator to be /?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah there is definitely a better way to do it so the folder hierarchy is properly exposed via IMAP. I didn't look into what would be required in the IMAP code to properly parse and expose the folder names.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think anything special should be required, apart from using the right separator.

Copy link
Author

@ajkessel ajkessel Dec 25, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok I'll do some testing and try to come up with a better PR.

Although we really need SUBSCRIBE/UNSUBSCRIBE for this to be fully usable. Otherwise every message in any folder will be duplicated in the client since it will be in the "all mail" folder as well as the filed-folder.

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

Successfully merging this pull request may close these issues.

2 participants