views:

89

answers:

2

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

+1  A: 

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?

Alex Martelli
@Alex that might work, let me try that. Thanks for the trouble you took to answer this question.
Philip Fourie
@Philip, you're welcome, let us know how it works out for you!
Alex Martelli
+1  A: 

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.

Joe Hildebrand
Thanks your are right on both accounts. This helped me.
Philip Fourie