有没有办法确定用户加入了哪些多用户会议 (MUC)?

发布于 2024-12-29 13:43:47 字数 156 浏览 4 评论 0原文

我想知道是否有办法查询 XMPP 服务器(传递用户 JID?)以找出该用户当前所在的聊天室?如果没有,我们可以查询 jabber 服务器来获取所有活动聊天室的列表吗?

顺便说一句,我们正在运行支持多用户聊天的 ejabber。使用 java 库(smack?)的解决方案将是理想的。

I wonder if there is a way to query the XMPP server (passing user JID?) to find out what chat room(s) this user is currently in? If not, can we query jabber server to get a list of all active chat rooms?

BTW we're running ejabber enabled for multiuser chat. A solution using a java library (smack?) would be ideal.

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

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

发布评论

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

评论(3

陪你到最终 2025-01-05 13:43:47

正如 Joe Hildebrand 所提到的,不存在这样的标准功能,因为通过 XMPP 允许这样做会侵犯隐私,因此您不能指望 Smack 能够做到这一点。也许拥有管理员权限,您可以拥有一个自定义协议扩展来执行此操作,但这似乎有风险。

但是,在服务器级别,您应该能够为 ejabberd 编写一个自定义模块,该模块将查询或索引用户所在的所有房间。这不是标准的,并且涉及插件开发。

As mentioned by Joe Hildebrand, there is no such a standard feature as it is a privacy violation to allow that over XMPP, so you cannot expect to do that from Smack. Maybe with admin privilege you could have a custom protocol extension that does that but that seems risky.

However, at the server level, you should be able to write a custom module for ejabberd that will query or index all rooms users are in. This is not standard and there is plugin development involved.

一个人练习一个人 2025-01-05 13:43:47

有两个(也许三个)XMPP 实体拥有该信息:

  • 提供 MUC 空间的 XMPP MUC 组件
  • 用户 XMPP 客户端(或者更好的是用户使用的 XMPP 库)
  • 也许 XMPP 服务器( s)(但让我们忽略这一点)

在撰写本文时,还没有标准化的方法(就 XMPP XEP 而言)来查询该信息。正如 Joe Hildebrand 指出的那样,这会导致信息泄露,这在大多数情况下不是我们想要的。

但是您可以扩展 MUC 组件来提供该信息(请记住,XMPP 很容易扩展)或 XMPP 客户端库。通常的方法是通过 iq get 查询。例如:

<iq type='get' from='[email protected]/balcony' to='capulet.lit' id='q1'>
  <query xmlns='http://jabber.org/protocol/muc#joinedrooms'/>
</iq>

支持该查询的实体随后将报告所请求实体的加入房间。此外,他们可能会在其服务发现信息中宣布 http://jabber.org/protocol/muc#joinedrooms 功能。

请注意,这是一个虚构的协议扩展,仅作为示例。我从未见过它在实际使用中

如果MUC组件提供了此功能,那么如果此信息被公开,客户端将无法控制。但如果客户端提供此功能,那么他当然可以控制谁可以检索此信息。您可以根据您的情况决定更好的方法。

There are two (maybe three) XMPP entities that have that information:

  • the XMPP MUC component which provides the MUC room
  • the users XMPP client (or better the XMPP library used by the user)
  • maybe the XMPP server(s) (but let's ignore that)

At the time of writing this, there is no standardized way (in terms of XMPP XEPs) to query that information. As Joe Hildebrand pointed out, this would result in a information leak which is not what we want in most cases.

But you can either extend the MUC component to provide that information (remember XMPP is easily extendable) or the XMPP client library. The usual approach would be via an iq get query. For example:

<iq type='get' from='[email protected]/balcony' to='capulet.lit' id='q1'>
  <query xmlns='http://jabber.org/protocol/muc#joinedrooms'/>
</iq>

The entities which support that query would then report back the joined rooms of the requested entity. Also they would may announce the http://jabber.org/protocol/muc#joinedrooms feature in their service discovery information.

Note that this is a fictional protocol extension meant as example. I have never seen it in real use

If the MUC component provides this feature then it's not controllable by the client if this information is exposed. But if the client provides this feature then of course he can control who can retrieve this information. You may decide what's the better approach in your case.

清君侧 2025-01-05 13:43:47

获取所有聊天室没有问题,只需使用此查询即可。

似乎已经有一个关于如何用 smack 检索房间的问题。 看这里

Getting all chat rooms is no problem, just use this query.

There seems to be already a question on how to retrieve rooms with smack. Look here.

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