ejabberd icon indicating copy to clipboard operation
ejabberd copied to clipboard

feat: fire new `push_send_notification` hook

Open marc0s opened this issue 7 months ago • 2 comments

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 avatar May 09 '25 12:05 marc0s

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.

marc0s avatar May 09 '25 12:05 marc0s

Coverage Status

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

coveralls avatar May 09 '25 12:05 coveralls

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

marc0s avatar Sep 22 '25 07:09 marc0s

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.

weiss avatar Sep 22 '25 08:09 weiss

Thanks, and sorry for the delay.

weiss avatar Oct 17 '25 22:10 weiss