Closed Bug 1848787 Opened 2 years ago Closed 2 years ago

messenger.messages.onNewMailReceived event doesn't return messages from folders other than Inbox

Categories

(Thunderbird :: Add-Ons: Extensions API, defect)

Thunderbird 115
defect

Tracking

(thunderbird_esr115 wontfix)

RESOLVED FIXED
121 Branch
Tracking Status
thunderbird_esr115 --- wontfix

People

(Reporter: 52qtuqm9, Assigned: john)

References

Details

Attachments

(1 file)

I have something running on the mail server that deposits messages into my Sent folder (I don't have Thunderbird doing it). I have Thunderbird configured to check my Sent folder for new messages whenever getting new messages. I have an add-on (Remote Content By Folder) which installs a messenger.messages.onNewMailReceived listener. Thunderbird is indeed noticing when new messages are added to my Sent folder, and they show up in the UI, but the add-on is not receiving events about them.

Update: I think this issue doesn't affect all folders. I have another folder that is getting messages put into it outside of Thunderbird whose messages are generating onNewMailReceived events. Is it possible that the folder configured as the user's sent items folder is specifically excluded from onNewMailReceived events? If so, that's a problem.

This seems to be by design, see https://searchfox.org/comm-central/source/mail/components/extensions/parent/ext-mail.js#2550-2556. To mitigate you could try to set the Ci.nsMsgFolderFlags.Inbox flag for these folders.

This seems to be by design

:shrug: All I can tell you is that before I changed Remote Content By Folder to use the MailExtension APIs, it received notifications for messages in all folders, and now using the API it's not, and that's a regression as far as I'm concerned. "Tell me about new messages in all folders," is a reasonable request for add-ons to expect to be able to make.

If you want to add an option to allow the caller to decline to receive notifications in some folders, that would be fine, but it should be an option, not the only available mode.

With the proposed patch, a sensitivity can be specified when registering the event:

 browser.messages.onNewMailReceived.addListener(listener, ["inbox", "drafts"])

The default sensitivity is "inbox".

Assignee: nobody → john
Attachment #9360516 - Attachment description: WIP: Bug 1848787 - Allow to specify a sensitivity of the messages.onNewMailReceived event. → Bug 1848787 - Allow to specify a sensitivity of the messages.onNewMailReceived event. r=#thunderbird-reviewers
Status: UNCONFIRMED → ASSIGNED
Ever confirmed: true
Attachment #9360516 - Attachment description: Bug 1848787 - Allow to specify a sensitivity of the messages.onNewMailReceived event. r=#thunderbird-reviewers → Bug 1848787 - Allow to specify a sensitivity of the messages.onNewMailReceived event. r=mkmelin
Target Milestone: --- → 121 Branch
Depends on: 1861948

Pushed by geoff@darktrojan.net:
https://hg.mozilla.org/comm-central/rev/d9d52f582bf5
Allow to specify a sensitivity of the messages.onNewMailReceived event. r=mkmelin

Status: ASSIGNED → RESOLVED
Closed: 2 years ago
Resolution: --- → FIXED

search bugmail for "addons1234" to delete these messages

You need to log in before you can comment on or make changes to this bug.

Attachment

General

Creator:
Created:
Updated:
Size: