View Single Post
  #1 (permalink)  
Old May 16th, 2014, 05:22 PM
drayarms drayarms is offline
Authorized User
Points: 182, Level: 3
Points: 182, Level: 3 Points: 182, Level: 3 Points: 182, Level: 3
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: May 2013
Posts: 40
Thanks: 0
Thanked 0 Times in 0 Posts
Default How to tell another user's online status?

What's the best way to find out the online status of another user whose jid is known? Well here is how I am attempting to go about it

1) Send initial presence
2) Send directed presence stanza to the desired user
MyNamespace.connection.send($pres({to: ""}).c("x",{xmlns:""}).up().c("show").t(chat));
3) Add a handler prior to the sending initial presence line.
MyNamespace.connection.addHandler(Mynamespace.on_send_my_presence, null, "presense",  null, null);
From this point on, I'm confused. How does the contact's client handle the incoming stanza from me, such that I know what his online status is? Or am I even going about this the right way? I don't want to use subscriptions and rosters.