Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[wip] new-mail notification observer #4077

Draft
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

roccoblues
Copy link
Member

@roccoblues roccoblues commented Oct 19, 2023

[This is just a proof-of-concept to see if the general connection works]

Trigger the new-mail logic in a notification observer.

  • add a hash to IndexPrivateData to keep track of the notification status per mailbox
  • add a new mailbox notification type NT_MAILBOX_NEW_MAIL
  • index_mailbox_newmail_observer() listens to NT_MAILBOX events and updates the hash
  • handle_new_mail() is called in the index loop and triggers the new-mail logic

We need the new notification because mx_mbox_check() doesn't update Mailbox->has_new like mx_mbox_check_stats(). I still think we should only have one method that does the full check. It would make a lot of things simpler.

I intentionally made this minimally invasive, to just show the concept. I think this can be a first step to simplifying things. For example mutt_mailbox_list() and mutt_mailbox_notify() could be removed.

I didn't polish the message yet. So for multiple mailboxes where one is the current one you get something like New mail =INBOX, =neomutt-devel. But this can easily be changed to New mail in this mailbox and =neomutt-devel.

Also, is a hash the correct data structure? Is the mailbox path guaranteed to be unique?

@roccoblues roccoblues requested a review from a team as a code owner October 19, 2023 10:45
@roccoblues roccoblues marked this pull request as draft October 19, 2023 10:45
@roccoblues roccoblues changed the title [wip [wip] new-mail notification observer Oct 19, 2023
@roccoblues roccoblues self-assigned this Oct 19, 2023
@flatcap flatcap force-pushed the roccoblues/new-mail-notifications branch 2 times, most recently from 8339a8c to 9223077 Compare October 29, 2023 16:28
@flatcap flatcap force-pushed the roccoblues/new-mail-notifications branch 2 times, most recently from bed0ede to 55ad274 Compare November 16, 2023 19:45
@flatcap flatcap force-pushed the roccoblues/new-mail-notifications branch from 55ad274 to 85427b0 Compare January 27, 2024 01:31
@flatcap flatcap force-pushed the roccoblues/new-mail-notifications branch 3 times, most recently from b18cb0d to 49b3d1a Compare March 29, 2024 01:44
@flatcap flatcap force-pushed the roccoblues/new-mail-notifications branch from 49b3d1a to e829ddc Compare April 16, 2024 21:30
@flatcap flatcap force-pushed the roccoblues/new-mail-notifications branch from e829ddc to 2c4b76b Compare May 8, 2024 20:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant