Skip to content

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.

@marc0s
Copy link
Contributor Author

marc0s commented Sep 22, 2025

Any feedback on this one? Should I gather there's no interest in it? 🙂

@weiss
Copy link
Member

weiss commented Sep 22, 2025

Should I gather there's no interest in it? 🙂

No I think the hook makes sense, will have a look this week. Thanks for the ping.

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