“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);
}
}
} ~
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.
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.
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.