Skip to content

feat: fire new push_send_notification hook #4383

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

marc0s
Copy link
Contributor

@marc0s marc0s commented May 9, 2025

Do not route XEP-357 IQ notification directly but run it through registered hooks that will ultimately decide whether or not send it and, if needed, customize the notification contents.

Hooks can return:

  • a modified IQ packet, as per their business logic
  • the atom drop, to effectively cancel the push notification

The idea behind this modification is to allow module developers to create modules that can customize the contents of the emitted push notifications. In our specific case, we use this hook to inspect the full message responsible of triggering the push notification and add some custom fields to the XEP-0357 IQ. Moreover, the return value of drop will skip sending the push notification at all if needed.

@marc0s
Copy link
Contributor Author

marc0s commented May 9, 2025

I'm open for suggestions on the Hook name, if any other fits better.

I'd also like to know if any other developer is using Emacs and elp. I've been having some trouble matching the indentation of the original file's revision (and it still doesn't fully match it, but elvis didn't complain). Any tip is welcome.

Do not route XEP-357 IQ notification directly but run it through
registered hooks that will ultimately decide whether or not send it
and, if needed, customize the notification contents.

Hooks can return:

  - a modified IQ packet, as per their business logic
	- the atom `drop`, to effectively cancel the push notification
@marc0s marc0s force-pushed the add-push-send-notification-hook branch from 6e5d6cb to cda1d4c Compare May 9, 2025 12:14
@coveralls
Copy link

Coverage Status

coverage: 33.588% (+0.001%) from 33.587%
when pulling cda1d4c on Quobis:add-push-send-notification-hook
into 128103b on processone:master.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants