When re-implementing, please make sure to not follow the old interaction design of the C++ IMAP component, which was forced by limitations in XPCOM at this time 24 years ago.
- C++ IMAP uses native OS threads to avoid blocking the UI. In today's JS, we can use
await, which is far far easier to use. Threads caused all kinds of headaches, esp. when passing information, and when waiting for results.
- C++ IMAP was driven by internal URLs. These are not the URLs you see in the web browser, but they used URLs as a kind of "async function callback", because XPCOM didn't have callback functions at the time when this IMAP component was designed. This URL-driven mechanism caused very very wierd and difficult call stacks that are very hard to follow and debug. Again,
await solves the problem very nicely.
- C++ IMAP returned the email message as URL, and the message is the URL response. In a new design, you would probably simply make an
async function which returns the message as function result.