当用户订阅机器人时,应该如何处理发送 xmpp 欢迎消息(一般情况)

发布于 2024-08-06 02:02:51 字数 193 浏览 2 评论 0原文

正如标题所示,我想在用户订阅机器人时发送一条欢迎消息。

然而,据我了解,存在订阅节不应包含包含资源的 from-JID(我对 Adium 的测试表明情况也是如此)。也就是说,欢迎消息可以轻松发送到裸 JID,但这真的是正确的方法吗?感觉应该将其发送到订阅发起的实际实例。

也许我看到了一个根本不存在的问题?如果没有,有什么解决办法的想法吗?

As the title says, I would like to send a welcome message when a user subscribes to a bot.

However, as I understand it, presence subscribe stanzas should not contain a from-JID that includes resource (and my testing with Adium indicates that is also the case). That is, welcome message could easily be sent to the bare JID but is that really the right way to do it? It feels like it should be sent to the actual instance where the subscription originated.

Perhaps I'm seeing a problem where there is none? If not, any ideas on how to solve it?

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

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

发布评论

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

评论(2

手长情犹 2024-08-13 02:02:52

不要害怕向裸 JID 发送消息。几乎所有时候这都是你想要的。用户可能已经拥有一个出色的系统,使用优先级在正确的设备上获取答案,例如黑莓、他们的家庭 jabber 客户端、工作中的客户端等。哎呀,他们可能已经从优先级为 0 的黑莓发送了请求,并且他们希望在办公桌上得到答案。

只需发送带有标题类型的消息节,因为您不希望他们回复通知。

Do not fear sending a message to a bare JID. Almost all the time this is what you want. The user may already have a fantastic system in place using priority to get the answer at the right device, like a blackberry, their home jabber client, the one at work, and so on. Heck, they may have sent the request from their blackberry that has a 0 priority, and they want to get the answer back at their desk.

Just send a message stanza with a type of headline, since you don't want them to reply to the notice.

开始看清了 2024-08-13 02:02:52

关于消息的事情说得都对。
如果你关心向谁发送存在订阅节,我想知道你当时是否真的了解资源。 IIRC,在转发存在订阅之前资源被剥夺,我假设您正在响应它们。此外,机器人希望了解所有存在,因此订阅 bare jid 是正确的做法。

The things said about messages are all right.
If you care about whom to send presence subscribe stanzas to, I wonder whether you really know resources at that time. IIRC, resources are stripped off before forwarding presence subscribes and I assume that you are responding to them. Furthermore, the bot wants to be informed about all presences, so subscribing to the bare jid is the right thing to do.

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