What's the proper XMPP client response to a <presence type=unsubscribed…> stanza?

StackOverflow https://stackoverflow.com/questions/605177

  •  03-07-2019
  •  | 
  •  

Question

Here's what the server is sending me (openfire) when I manually delete a contact from the roster on the server:

'<iq type="set" id="183-87" to="foo@edmund.local/hydra"><query xmlns="jabber:iq:roster"><item jid="bar@yahoo.edmund.local" name="baz" ask="unsubscribe" subscription="none"><group>Buddies</group></item></query></iq>'
'<iq type="set" id="187-88" to="foo@edmund.local/hydra"><query xmlns="jabber:iq:roster"><item jid="bar@yahoo.edmund.local" name="baz" subscription="none"><group>Buddies</group></item></query></iq>'
'<presence type="unsubscribed" to="foo@edmund.local" from="bar@yahoo.edmund.local"/>'

If I respond with a 'unsubscribe' presence stanza (which I think is correct according to RFC 3921), the server keeps spamming me with more 'unsubscribed' presences.

Either way, the next time my client logs in, nothing has changed in the roster. Am I doing something wrong?

Was it helpful?

Solution

It depends which client you're talking about - whether it's the subscriber or the subscribee.

.

If the client is the subscriber, then nothing:

According to section 9.4, if the subscriber sends an unsubscribe request, or something else causes the client to be unsubscribed, the server must acknowledge the request/report the state change with an unsubscribed response. That's the end of the interaction.

If the subscriber sends another unsubscribe request each time it's informed that it receives a unsubscribed status from the server telling it that a previous subscription has been removed, then it will never end.

.

If the client is the subscribed node, then it may be sent an unsubscribe to confirm that removing the subscription is allowed, but whether that still stands when you're changing the roster outside of the normal mechanism I'm not sure.

My reading of the table in 9.4 is for the messages between subscribee and server during unsubscription is:

subscriber            server             subscribee
    | -- unsubscribe --> |                    |
    |                    | -- unsubscribe --> |
    |                    | <- unsubscribed -- | (optional)
    |                    | -- unsubscribed -> |
    | <- unsubscribed -- |                    |

My reading of section 8.6, roster removal is this:

subscriber            server             subscribee
    | ----- remove ----> |                    |
    |                    | -- unsubscribe --> |
    |                    | -- unsubscribed -> |
    |                    | -- unavailable --> |
    | <- unsubscribed -- |                    |
    | <-- unavailable -- |                    |

With no acknowledgement required by either client.

OTHER TIPS

I'm too rusty to be able to give you a direct answer, but since it's been a few hours with no answers let me just make a suggestion...

Load up pidgin or some other client that can log the xmlstream, send the unsubscribe from that client, and then copy the code you see in the log.

That will either help you get the correct stanzas or it will identify an incompatibility in openfire (unlikely, but who knows).

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top