[JDEV] jabber:iq:roster question
Keith Minkler
keith at digix.net
Wed Dec 29 08:22:09 CST 1999
Ryan,
>subscription is set by the server, unless the client sets it to "none",
you should only ever set subscription = 'remove' if you want to remove them,
none means that there is no subscription to presence.
>then the person is removed from the roster. Assumption: So subscription
>shows the status of the subscriptions between you and that person.
>"from" means that you get his presence, but how does not get yours.
>"to" means that he gets your presence, but you do not get his. "both"
>means that you get his presence, and he gets yours. "none" means that
>he does not get your presence and you do not get his.
Actually, you are correct, but i think you have it backwards... 'to' means
that you are subscribed 'to' his presence, and you will get his presence
info. 'from' means that your presence is subscribed to by the other user, or
that that other user will receive your presence info..
>ask is set by the server only, but can be read by the client to show
>that the other person has not authorized your subscribe/unsubscribe
>request.
correct.
>And if the above is correct then the <subscribe/>, <unsubscribe/> tags
>are requests to the JID, and <subscribed/>, <unsubscribed/> are the
>expected responses from the JID. That's important to know for a client.
I forgot to mention these... they were taken out of the <item/> tag as of (i
believe) 0.8.1, and are handled completely by presence. when you receive
your roster, you will get any queued presence packets for subscription, they
will no longer be in the <item/> tag. here is a more detailed example:
USER A and USER B just met, and want to add eachother to their roster. to
simplify things, USER A's jid will be 'A' and USER B's jid will be 'B':
USER A adds USER B to his roster by sending this:
<iq type='set'><query xmlns='jabber:iq:roster'><item name='some guy'
jid='B'/></query></iq>
and the server responds with:
<iq type='result'><query xmlns='jabber:iq:roster/></iq>
USER A also takes the opportunity to subscribe to USER B's presence, and
sends this:
<presence to='B' type='subscribe'/>
The server will send back a roster push, indicating that the ask field is
now changed:
<iq type='set'><query xmlns:iq:roster><item name="some guy" jid = 'B'
ask='subscribe'/></query></iq>
at this point, user B recieves this notification with the following from
his/her server:
<presence from='A' type='subscribe'/>
USER B realizes that he/she just met this person, and allows them to
subscribe:
<presence to='A' type='subscribed'/>
USER A will recieve this packet, and then BOTH users will get a roster push.
USER A will have ask= removed, and subscription='to' USER B will have
subscription='from'
NOTE: that the SERVER will create a new roster item for USER B at this
point, since user A isn't in his/her roster.
note that any time the server changes the roster, the user gets a roster
push with the NEW roster item in it.
More information about the JDev
mailing list