Issue with IQ subscription="remove"

Could I please ask someone to check that Openfire has correctly implemented this code.

In IQRosterHandler.java removeItem (I have inserted a copy below).

The code first correctly removes the contact you have requested to remove.

Then the code immediately removes you from the other contacts roster? This seems to be in violation of the standard.

RFC-3921 - http://tools.ietf.org/html/rfc3921 Section 8.6

“When the user removes the contact from the user’s roster, the
end state of the contact’s roster is that the user is still in the
contact’s roster with a subscription state of “none”; in order to
completely remove the roster item for the user, the contact needs to
also send a roster removal request.”

I am not an expert so could have misinterpreted this, so I apologise if I am wrong.

We are experiencing a lot of issues due to this particular problem and the only work around is to try and re-add the user into the Roster.

Thanks in advance,

Daniel Haigh

private void removeItem(org.jivesoftware.openfire.roster.Roster roster, JID sender,
            org.xmpp.packet.Roster.Item item) throws SharedGroupException {
        JID recipient = item.getJID(); // Remove recipient from the sender's roster         roster.deleteRosterItem(item.getJID(), true); // Forward set packet to the subscriber if (localServer.isLocal(recipient)) { // Recipient is local so let's handle it here try {
                Roster recipientRoster = userManager.getUser(recipient.getNode()).getRoster();
                recipientRoster.deleteRosterItem(sender, true);
            } catch (UserNotFoundException e) { // Do nothing             }
        } else { // Recipient is remote so we just forward the packet to them             String serverDomain = localServer.getServerInfo().getXMPPDomain(); // Check if the recipient may be hosted by this server if (!recipient.getDomain().contains(serverDomain)) { // TODO Implete when s2s is implemented             } else {
                Packet removePacket = createRemoveForward(sender, recipient); router.route(removePacket);
            }
        }
    } ~

Just following on from this…

When a user sends a contact a subscription request Openfire creates a “dummy” roster entry in the contacts server side roster.

This roster entry is of type subscribe so that when the user logs in they receive the presence subcribe request sent from the server.

(It obviously doesn’t get sent to the client as part of the roster - which is correct)

However,

When the user deletes this contact from the Roster (Roster.java deleteRosterItem) it doesn’t remove the subscription request, which stays in the contacts roster. Is this by design as it doesn’t make sense? - I believe this should be deleted in this instance.

Because the remove code (IQRosterHandler.java removeItem) mentioned in my last post actually went ahead and fully deleted the user from the contacts roster this issue wasn’t obvious, but if that is corrected then I believe it is important to make sure these subscription requests are deleted.

Again, I apologise if I have misunderstood anything, but I believe this subscription remove section of code needs further attention.

Regards

Daniel

In…

Roster.java removeItem

I changed this line of code:

recipientRoster.deleteRosterItem(sender, true);

To read:

if (recipientRoster.getRosterItem(sender).getRecvStatus()==RosterItem.RECV_SUBSCRI BE)
recipientRoster.deleteRosterItem(sender, true);

This fixed all the issues I am referring to above.

Can I please ask someone at Ignite to check this out.

Thanks

Daniel

Anyone?

I do believe this is an issue that needs further investigation. Having the ability to delete youself from someone elses roster seems to be incorrect.

Thanks

Hi,

I have filed OF-24 to track the issue.

daryl

Looking into this further it seems that the existing behaviour is correct even though it seems to be in conflict with the XMPP specs that I have.

I have cross checked this with other server implementations and the remove logic seems to be the same so you may want to consider cancelling this issue.

Sorry for the run around - the XMPP standard is very complex (and at times frustrating) and I think you guys have done a fantastic job with Openfire.

Regards

Daniel

Any chance to reopen that issue?

I strongly believe Openfire is incorrect here.

From the spec http://xmpp.org/rfcs/rfc3921.html#int-remove :

Note: When the user removes the contact from the user’s roster, the end state of the contact’s roster is that the user is still in the contact’s roster with a subscription state of “none”; in order to completely remove the roster item for the user, the contact needs to also send a roster removal request.