Conversation
| 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, "/", ".") |
There was a problem hiding this comment.
. might be used elsewhere in the name. Instead of replacing / with ., could we define the IMAP separator to be /?
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
I don't think anything special should be required, apart from using the right separator.
There was a problem hiding this comment.
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.
Protonmail provides a label metadata field
pathwhich includes the full path of the folder. This commit adds support for path and uses path if it exists, thus preventing the situation where folderx/zappears to be the same as foldery/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.