communication between modules

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

communication between modules

michel.renon
Hi,

I'm the developer of 'mrc compose' module and I receive some requests to make it "compatible" with other modules (mostly "cardbook" and "enigmail").

I searched a way to have modules to communicate but found nothing.

So I have some questions :

- is it possible for a module "A" to know if another module "B" is installed ?

- how to be sure that the init/loading order will always be the same ? Does it depend of the order of installation ?

- is it possible for a module "A" to publish some kind of API to be used/called by another module "B" ? How can "B" call some existing code in module "A" ?


Thanks for any information,

Cheers,
Michel
_______________________________________________
dev-apps-thunderbird mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-apps-thunderbird
Reply | Threaded
Open this post in threaded view
|

Re: communication between modules

Patrick Brunschwig-3
On 16.12.17 12:30, [hidden email] wrote:
> Hi,
>
> I'm the developer of 'mrc compose' module and I receive some requests to make it "compatible" with other modules (mostly "cardbook" and "enigmail").
>
> I searched a way to have modules to communicate but found nothing.
>
> So I have some questions :
>
> - is it possible for a module "A" to know if another module "B" is installed ?

Yes, you can either query the AddonManager using getAddonByID, or you
can check if an a function is defined that is specific to the addon.
>
> - how to be sure that the init/loading order will always be the same ? Does it depend of the order of installation ?

AFAIK, the sequence cannot be guaranteed.

> - is it possible for a module "A" to publish some kind of API to be used/called by another module "B" ? How can "B" call some existing code in module "A" ?

Yes, that's possible. For example, Jonathan Kamens and I did that to
make Enigmail and "Send Later" compatible to each other.

If you want to, we can work out APIs for Enigmail and MRC Compose to be
used for the other side. But I'd suggest we do that off the list.

-Patrick
_______________________________________________
dev-apps-thunderbird mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-apps-thunderbird
Reply | Threaded
Open this post in threaded view
|

Re: communication between modules

michel.renon
In reply to this post by michel.renon
Le samedi 16 décembre 2017 18:11:06 UTC+1, Patrick Brunschwig a écrit :

> > Hi,
> >
> > I'm the developer of 'mrc compose' module and I receive some requests to make it "compatible" with other modules (mostly "cardbook" and "enigmail").
> >
> > I searched a way to have modules to communicate but found nothing.
> >
> > So I have some questions :
> >
> > - is it possible for a module "A" to know if another module "B" is installed ?
>
> Yes, you can either query the AddonManager using getAddonByID, or you
> can check if an a function is defined that is specific to the addon.
ok

> >
> > - how to be sure that the init/loading order will always be the same ? Does it depend of the order of installation ?
>
> AFAIK, the sequence cannot be guaranteed.
>

ok

> > - is it possible for a module "A" to publish some kind of API to be used/called by another module "B" ? How can "B" call some existing code in module "A" ?
>
> Yes, that's possible. For example, Jonathan Kamens and I did that to
> make Enigmail and "Send Later" compatible to each other.
>

I'll check both codes to start to understand what you have done.

> If you want to, we can work out APIs for Enigmail and MRC Compose to be
> used for the other side. But I'd suggest we do that off the list.
>

Thanks a lot !
You can join me via the support email of mrc compose (https://addons.mozilla.org/fr/thunderbird/addon/mrc-compose/)
or in the corresponding issue in gh : https://github.com/michelRenon/mrc_compose/issues/29

Cheers,

Michel
_______________________________________________
dev-apps-thunderbird mailing list
[hidden email]
https://lists.mozilla.org/listinfo/dev-apps-thunderbird