Put eventListeners on messages

Hello,

I'm working on a project for which I need to collect high level semantic in=
formation on Thunderbird (the global aim is to do this with several apps to=
 try automatically generate scripts for repetitive tasks).

I'm having a hard time figuring out how eventListeners work on message obje=
cts (or any other type actually). I saw there is a way to do it with the ev=
ent's name :
example :
______________

buttonElement.addEventListener('click', function (event) {}
______________

But I can't find any complete list of events names in the documentation or =
any code I saw online. Only this partial list that covers folders : https:/=
/developer.mozilla.org/en-US/docs/Mozilla/Thunderbird/Events

Every different way I tried reaching message objects and attaching eventLis=
teners to them didn't work so far : no detection of anything in the console=
..

These are my main sources of info for TB api :
- https://thunderbird-webextensions.readthedocs.io/en/68/
- https://developer.mozilla.org/en-US/docs/Mozilla/Thunderbird/Thunderbird_=
API_documentation








This is what my script looks like at this point :
________________________________________________________
	browser.accounts.list()
		.then( (accounts) =3D> {
			console.log('browser.accounts.list() : ',accounts);
			for(j=3D0;j<accounts.length;j++){// ne pas faire for(account in accounts=
)
				for(f=3D0 ; f<accounts[j].folders.length; f++){
					folder =3D accounts[j].folders[f];
					//folder.addEventListener('compose-send-message', function (event) {co=
nsole.log("I'm trying")}); "addEventListener is not a function"
					console.log('folder name : ',folder.name);
					console.log('folder type: ',folder.type);
					let page =3D browser.messages.list(folder);
					//trying to display page.messages
					page.messages.then( (msg) =3D> {
						console.log("message : " + msg);
					});

					while (page.id) {
						page =3D browser.messages.continueList(page.id);
						//trying to display page.messages
						for(m=3D0 ; m<page.messages.length; m++){
							console.log("message n=C2=B0"+ m + " :" + page.messages[m]);
						}
					}
					console.log(" ");
				}
			}
		});
________________________________________________________
0
marinzmuz
3/9/2020 8:31:10 PM
mozilla.dev.apps.thunderbird 3450 articles. 0 followers. Post Follow

3 Replies
15 Views

Similar Articles

[PageSpeed] 33

It seems I can't modify the post, but here's a cleaner code where I can't m=
anage to even reach the messages through the messages list :
________________________________________________________
> 	browser.accounts.list()
> 		.then( (accounts) =3D> {
> 			for(j=3D0;j<accounts.length;j++){
> 				for(f=3D0 ; f<accounts[j].folders.length; f++){
> 					folder =3D accounts[j].folders[f];
> 					let page =3D browser.messages.list(folder);
> 					//trying to display page.messages
> 					page.messages.then( (msg) =3D> {
> 						console.log("message : " + msg);
> 					});
>=20
> 					while (page.id) {
> 						page =3D browser.messages.continueList(page.id);
> 					=09
> 						for(m=3D0 ; m<page.messages.length; m++){
> 							console.log("message n=C2=B0"+ m + " :" + page.messages[m]);
> 						}
> 					}
> 					console.log(" ");
> 				}
> 			}
> 		});
> ________________________________________________________

0
marinzmuz
3/9/2020 8:37:55 PM
On 3/9/20 4:31 PM, marinzmuz@gmail.com wrote:
> Hello,
> 
> I'm working on a project for which I need to collect high level semantic information on Thunderbird (the global aim is to do this with several apps to try automatically generate scripts for repetitive tasks).
> 
> I'm having a hard time figuring out how eventListeners work on message objects (or any other type actually). I saw there is a way to do it with the event's name :
> example :
> ______________
> 
> buttonElement.addEventListener('click', function (event) {}
> ______________
> 
> But I can't find any complete list of events names in the documentation or any code I saw online. Only this partial list that covers folders : https://developer.mozilla.org/en-US/docs/Mozilla/Thunderbird/Events
> 
> Every different way I tried reaching message objects and attaching eventListeners to them didn't work so far : no detection of anything in the console.
> 
> These are my main sources of info for TB api :
> - https://thunderbird-webextensions.readthedocs.io/en/68/
> - https://developer.mozilla.org/en-US/docs/Mozilla/Thunderbird/Thunderbird_API_documentation
> 

Tried looking at <https://developer.thunderbird.net/>?

-- 
OS: Ubuntu Linux 18.04LTS - Gnome Desktop
https://www.thunderbird.net/en-US/get-involved/
https://give.thunderbird.net/en-US/

0
WaltS48
3/9/2020 9:00:47 PM
Thanks,
I had already looked through the links given on that page before, but I found examples of addon that might be useful.
0
marinzmuz
3/11/2020 1:36:20 PM
Reply: