From: Yann L. <as...@la...> - 2009-12-03 15:03:22
|
Le 03/12/2009 14:11, Frank Laszlo a écrit : > Hello Adrian, > > Thanks for your reply. I followed the documentation and created the code > required to use the "getStatus()" method. However, it seems that it > returns "None" for most people who are online. I guess my goal here is > to find a way to determine if someone is online before actually sending > the message. Here is a sample of the code I created (This was just a > test of the method to make sure I was using it correctly) > > jid = xmpp.protocol.JID('jab...@do...') > cl = xmpp.Client(jid.getDomain(), debug=[]) > con = cl.connect() > auth = cl.auth(jid.getNode(), 'password', resource=jid.getResource()) > cl.sendInitPresence() > roster = cl.getRoster() > jids = roster.getItems() > for i in jids: > print i > print "Ask = %s" % roster.getAsk(i) > print "Name = %s" % roster.getName(i) > print "Group = %s" % roster.getGroups(i) > print "Priority = %s" % roster.getPriority(i) > print "Show = %s" % roster.getShow(i) > print "Status = %s" % roster.getStatus(i) > print "Sub = %s" % roster.getSubscription(i) > print "Resources = %s" % roster.getResources(i) > > Everything appears to be outputting correctly, but the status is almost > always "None" unless someone has specifically set it in their client. > There is no indication that a user is online or offline. > > Thanks in advance! Status is the status *message* a user provided. What you want is getShow(). -- Yann |