终止 ejabberd 模块中的钩子处理
我正在写一个 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果您想要删除来自 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.
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.