使用xmpppy时完整的JID值在哪里?

发布于 2024-08-23 16:01:42 字数 695 浏览 4 评论 0原文

使用 xmpppy 库连接 Jabber 服务器并进行身份验证后,在哪里可以找到完整的 JID 值?

我需要完整的 JID 才能对服务器进行后续的 Iq 调用。指定裸 JID ([email protected]) 会导致以下错误:

如果设置,“from”属性必须设置为用户的完整 JID

我已通过在线 API 并查看了一些源代码,但仍然找不到它。

完整的 JID 如下所示:[email protected]/resource

Where do I find the full JID value after connecting and authenticating against a Jabber server when using the xmpppy library?

I need the full JID for a subsequent Iq call to the server. Specifying the bare JID ([email protected]) results in the following error:

If set, the 'from' attribute must be set to the user's full JID

I have read through the online API and looked at some of the source code but still cannot find it.

The full JID looks like this: [email protected]/resource

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

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

发布评论

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

评论(2

淡水深流 2024-08-30 16:01:42

使用非下划线版本:

c = xmpp.client.Client(...)
# connect
jid = xmpp.JID(node=c.User, domain=c.Server, resource=c.Resource)

但是,无需设置发件人地址。服务器将为您发送的所有节执行此操作。

Use the non-underbar versions:

c = xmpp.client.Client(...)
# connect
jid = xmpp.JID(node=c.User, domain=c.Server, resource=c.Resource)

However, there is no need to set a from address. The server will do this for you for all of the stanzas you send.

一张白纸 2024-08-30 16:01:42

我也没有看到 JID 被这样存储,但是在 auth's sources,第 213 行,我看到

self._User,self._Password,self._Resource=user,password,resource

其中 self 是我们正在验证的 Client 实例;所以也许你可以恢复这些信息并为自己构建一个 JID 从那个?

I don't see the JID being stored as such either, but in auth's sources, line 213, I see

self._User,self._Password,self._Resource=user,password,resource

where self is the instance of Client we're authenticating; so maybe you could just recover this info and build yourself a JID from that?

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