终止 ejabberd 模块中的钩子处理

发布于 2024-08-02 14:39:25 字数 225 浏览 4 评论 0原文

我正在写一个 ejabberd 模块。它的作用是将一些消息保存到队列中。它实际上工作得很好,只有一件事我在任何文档中都找不到。如果我发现来自特定用户的消息,我需要停止挂钩处理。

即一条消息从用户 A 发送到 ejabberd 到用户 B,我的模块(挂钩到 user_send_packet 钩子)处理该消息,如果发现用户 A 是指定用户,则不得传递该消息。据我了解,您可以通过停止钩子处理来实现这一点。如何停止钩子处理?

I'm writing an ejabberd module. What it does is saving some messages into a queue. It actually works very good, there is only one thing I can't find in any documentation. I need to stop hook processing if I find a message coming from a particular user.

I.e. a message is sent to ejabberd, from user A to user B, my module (hooked to user_send_packet hook) processes this message and, if it finds that user A is the specified user, must not deliver it. From what I understood you can achieve this by stopping hook processing. How do you stop hook processing?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

心凉怎暖 2024-08-09 14:39:25

如果您想要删除来自 A 的消息 -> B,您可以通过订阅 fiter_packet 钩子来实现,然后返回 drop 来丢弃您不想允许的数据包。

据我了解,您可以通过停止钩子处理来实现这一点

,停止钩子处理将阻止激活该钩子上注册的其他处理程序(如果有),但没有其他任何事情,数据包将照常继续。

If what you want is to drop messages from A -> B, you can do it by subscribing to the fiter_packet hook, and from that return drop to drop the packets you don't want to allow.

From what I understood you can achieve this by stopping hook processing

no, stopping hook processing will prevent other handlers registered on that hook (if any) to be activated, but nothing else, the packet will continue as usual.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文