开发者

Where is the full JID value when using xmpppy?

开发者 https://www.devze.com 2022-12-22 15:31 出处:网络
Where do I find the full JID value after connecting and authenticating against a Jabber server when using the xmpppy library?

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 开发者_JAVA技巧Iq call to the server. Specifying the bare JID (user@domain.com) 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: user@domain.com/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.


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?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号