Updating a legacy thunderbird extension to web extension, which used a DLL to access an SQL database

I’m trying to update my company’s email filer extension from XUL to WebExtension and pretty much everything is broken. I’d like some advice on the best way forwards.

The purpose of the extension is to allow a user to save an email in Thunderbird onto the company file server as simply as possible. Select an email, check the filer’s guessed the right directory to save it in, click Save, Done. Easy. I get a text version of the email, and attachements are automatically saved in their own folder. In worked fine on Thunderbird version 60 or earlier, but now it doesn’t.

The old version of the filer used a XUL GUI that called javascript functions. These javascript interfaced to a MySQL database which contains data on various people and projects, not least data on where to file the emails. This database in common across all users. The javascript interfaces to the database via a C++ DLL, using ctypes.

So, in summary, the old filer architecture was:
Awkward, but the only way I could see to make it work.

So, moving to WebExtensions, XUL is no longer a possibility, but I can use html instead. It’s a re-write of 1/4 of the app, but it’s an annoyance (and time), but not a showstopper.
However, ctypes is no longer available in javascript, and there seems to be no other way of calling a dll from within javascript. Is this correct?

I’ve considered some alternatives:
Firslt, one possibility would be to use native messaging and re-write the c++ app so, instead of having 10 or so different function, all calls are made through stdio. However, implementing a DLL over stdio strikes me as being akin to implementing IP over avian carriers (RFC1149).

Another alternative I’ve considered is to use indexedDB, but that doesn’t appear to be sharable across all users, which my database must be. If I could store it on the server where everyone can access then it would be a solution, and it would also simplify my code. However, it seems that indexedDB lives in the profile and can’t be moved, so it’s a non-starter.

A third alternative I’ve considered is to create a standalone email filing programme. Thunderbird will save the emails to a temp directory and launch the programme via native messaging, and them I’m free of WebExtension restrictions. However, I’d then have to parse .eml messages. A job for PyQt perhaps.

The final alternative, of course, is to use Outlook. This would mean a complete rewrite, but I may be looking at one of those anyway.

My questions are:

  1. Is there an alternative way of calling my DLL from within the WebExtension?
  2. Is there an alternative method of interfacing between a WebExtension and MySQL database?
  3. Are there any alternative architectures that I should consider?

Best regards,

I recomnend you repost here:

Hi Samuel. I have a similar issue and wonder how you solved your problem?