thunderbird / developer-docs

Developer documentation for Thunderbird contributors.
https://developer.thunderbird.net
79 stars 77 forks source link

AddOn example calling a batch program #151

Closed xmasmc closed 1 month ago

xmasmc commented 1 year ago

Hello, I hope this example AddOn will help other developer.

https://github.com/xmasmc/Thunderbird-102-AddOn-Example

Regards Helmut

jobisoft commented 1 year ago

Because of the very poor documentation for development of Thunderbird AddOns, I put this example here

I am trying to constantly improve our documentation, which lives here: https://developer.thunderbird.net/add-ons/mailextensions

We also have a couple of example extensions: https://github.com/thundernest/sample-extensions (linked here: https://developer.thunderbird.net/add-ons/resources)

Could you point out where our documentation was insufficient, where you struggled to find the information you need?

Thanks, John

jobisoft commented 1 year ago

Instead of using an experiment to call an external batch file, the suggested solution is to use native messaging (which does not require the "full access permission", which users are very much afraid of): https://developer.mozilla.org/en-US/docs/Mozilla/Add-ons/WebExtensions/Native_messaging

I could indeed add an example to our example repo.

xmasmc commented 1 year ago

I made an AddOn only for private use, for my company, so the permission is not the problem. We use the plugin for incoming mail orders, to call our own database application. which opens automatically the customer data for writing an invoice. Additional I analyse the mail body and extract all our part numbers to add them automatically to the invoice. I made this AddOn 2018/19 for TB68 and I needed the same for TB 102. Was searching all online documentations, but it takes more than 20 hours of work, to find the correct informations. Your Hello world example is nice, but the using of experiment in combination with the new interface is very poor.

For helping other developer I put the very simple example on Github.

jobisoft commented 1 year ago

Native Messaging is nice but to much work, I need an client, installed on every PC and change registry on every PC and ...

You can use enterprise policies to distribute the configuration to all your clients (including the app, I think)

The most examples on https://github.com/thundernest/sample-extensions are not ready for TB102

Which one? I checked most of them. If they are broken, this would indicate a serious issue with our APIs in 102.

The API documentation messages.getFull() is nice, but where could I find good documentation about MessagePart.contentType

This is whatever content type the current mime part has and it is independent of Thunderbird. I will update the doc to be more verbose.

how to get the text

That should be the body member (doc says "content of the part"). What should I use instead as the description?

For helping other developer I put the very simple example on Github.

Since you are using an experiment for something we have an API for, I cannot add it to our repo. Such add-ons will not be approved for ATN. Experiments are only allowed to do things which we currently have no APIs for.

I also suggest that you reconsider using native messaging, as it will remove the need to keep updating your add-on for future versions of TB.

jobisoft commented 1 year ago

You mime part analysis code however looks like it could be very helpful. Can I use that to build an example add-on for our repo?

xmasmc commented 1 year ago

For shure you can use everything you want, the original source code was from the AddOn read_aloud_a_text_to_speech_voice_reader-1.59.1-tb /js/document.js I modified for my example

jobisoft commented 1 month ago

We implemented https://webextension-api.thunderbird.net/en/stable/messages.html#listinlinetextparts-messageid, which is very close to your mime analysis code. Closing this issue as completed.