From: Will S. <wil...@gm...> - 2009-06-19 15:50:28
|
Hey Norman, Thanks for the tip, but I did manage to work, albeit not as elegantly as what Collin did. So, I gave it a try and actually found that it doesn't work for me. The SendAndCallForResponse function doesn't wait long enough. Instead, I took his idea and changed to only return the Given name of the user and produced the following: import sys,xmpp def request_vcard(client, JID): d=cl.Dispatcher n = xmpp.Node('vCard', attrs={'xmlns': xmpp.NS_VCARD}) iq = xmpp.Protocol('iq', JID, 'get', payload=[n]) return proc_vcard(d.WaitForResponse(d.send(iq))) def proc_vcard(stanza): return stanza.getTag('vCard').getTag('FN').getData() if len(sys.argv) < 2: print "Syntax: %s JID"%sys.argv[0] sys.exit(0) tojid=sys.argv[1] server=<servername> port=5222 jidparams={'jid':<username>,'password':<password>} jid=xmpp.protocol.JID(jidparams['jid']) cl=xmpp.Client(jid.getDomain(), debug=[]) con=cl.connect() if not con: print 'could not connect!' sys.exit() auth=cl.auth(jid.getNode(),jidparams['password'],resource=jid.getResource()) if not auth: print 'could not authenticate!' sys.exit() print request_vcard(cl, tojid) just calling `vcard.py us...@ja...` will return the user's full name. Thanks for the help! Will On Fri, Jun 19, 2009 at 12:03 PM, Norman Rasmussen<no...@ra...> wrote: > On Fri, Jun 19, 2009 at 4:24 PM, Will Siddall <wil...@gm...> > wrote: >> >> That's what I've been looking for... now the next question is how do I >> do a search for a vcard for a jid that's not in my roster? > > I was going to write a long example here, but then found a pre-made > one: http://collincode.wordpress.com/2009/01/31/xmpp-jabber-photo-module-2/ > -- > - Norman Rasmussen > - Email: no...@ra... > - Home page: http://norman.rasmussen.co.za/ > > ------------------------------------------------------------------------------ > Crystal Reports - New Free Runtime and 30 Day Trial > Check out the new simplified licensing option that enables unlimited > royalty-free distribution of the report engine for externally facing > server and web deployment. > http://p.sf.net/sfu/businessobjects > _______________________________________________ > Xmpppy-devel mailing list > Xmp...@li... > https://lists.sourceforge.net/lists/listinfo/xmpppy-devel > > |