You are here

Unsubscribed

While polishing The Coccinella I noted one extra dialog when another user removed me from its roster by sending a 'remove'. This extra dialog was identical to the one when another user rejects a subscription from me. A bit of tracking pointed to a presence with type 'unsubscribed' which is sent by the server in both cases. So I went to the protocol definition, RFC 3921 where it says in section 2.2.1: "unsubscribed -- The subscription request has been denied or a previously-granted subscription has been cancelled."

This describes precisely the two situations which I'm trying to separate. In general, it is bad practice to have one protocol feature describe two different things. Then you have to use some kind of state information to separate the two situations, which introduces a dependency which is a bad habit and is error prone. I think I just skip that dialog for the moment.

Comments

Ug, I know exactly what you mean... from a transport writer perspective, I ran into the same issue. I kept getting confused between the two scenarios thinking that unsubscribed couldn't possibly be the proper response for both situations. Sure enough... =/ I don't believe unsubscribed makes sense in the context of the rejection of a subscription. To me, subscribed means the person subscribed to your presense, unsubscribed means they removed a subscription to your presense. If you reject someone's subscription, there's not necessarily any subscription in place yet so how can you unsubscribe from something that's not done yet? Bah.

You can't even really look at the roster to tell the difference. If the contact in my roster is set to "both" or "from", and I get an unsubscribed, then ... then nothing. It could be a response still to some subscription attempt I made.

To be frank, I find the whole XMPP subscription/roster handling to be confusing. Often I have to retrace all of the meanings of various stanzas in my head. Someone on from AIM adds me.. do I send subscribe or subscribed? I want to cause a "XYZ added you" to show on the client. .. that sort of thing. It always takes me a while of thinking through it before I finally settle on something.