[JDEV] Roster vs. Presence
jens at mac.com
jens at mac.com
Mon Aug 13 11:17:53 CDT 2001
On Sunday, August 12, 2001, at 08:58 PM, Paul Vet wrote:
> To do the same process in Jabber, what is necessary? I see a <presence>
> subscribe action, and there's seperate roster stuff. So to get the full
> functionality of a user, do I add them to the roster, then send a
> presence
> subsctiption request?
No, just send the <presence type="subscribe"> to request a subscription.
You'll get a different presence element back as confirmation or denial.
If the subscription succeeds you will _also_ get a roster set element.
This stuff confused me a lot too, at first. The jabber:iq:roster stuff
is for managing the roster (=buddy list) since it's shared between
multiple machines. You can have people on your roster whose presence
you're not subscribed to, so it's not isomorphic to your set of
subscriptions (although deleting someone from the roster will
unsubscribe you from their status.)
You can basically drive the management of your GUI buddy list from the
roster. At login request the entire roster and use it to fill in the GUI
list. When you receive notifications of changes to the roster, update
the list accordingly. That way multiple clients logged into the same
account will stay in sync.
The one thing to watch out for is to be careful when deleting someone
from the roster. If they have a subscription to _your_ status and you
simply remove them from your roster, they lose the subscription. You
shouldn't do this inadvertently or you'll look rude! Instead, if you're
removing them from your buddy list, you just change the subscription
type from "both" to "from".
--Jens
More information about the JDev
mailing list