powered by Jive Software

A few issues with RosterGroup, RosterEntry, and Roster

I was attempting to make a way to move a RosterEntry from one group to another. My first thought was to use RosterGroup… but this approach is somewhat flawed as if there is an error in the add it is not recognized by RosterGroup. A good case for this is in Jive Messenger how there is the option to have preset groups made, and the server will return an error when these groups are modified from the client. So, there is no way for me to determine immeditaly determine whether or not the move was successful except for processing the packets myself, which is currently an undesirable path to take because I am depending heavily on Rosters, RosterGroups, and RosterEntries.

My second thought was to just use createEntry, because it does have error checking, but since this sends subscription packets everytime it is called, irregardless of whether you are already subscribed to the remote user’'s presence, this is also undesirable. So my final conclusion has been to create the packet myself like in createEntry without the subscribe as well.

Does anyone else have any other suggestions or can this RosterGroup issue be fixed in the future?

Thanks for the help

Alex

Hey Alex,

Good point. We modified RosterGroup#addEntry and #removeEntry to confirm that the request was successfully processed by the server. If the request was denied because of some server policy/logic then an XMPPException will be thrown. So you can now use the next nightly build and just use those modified methods to move entries between the groups.

Regards,

– Gato

I’'ve checked out the fix in 1.5.1 and there seems to be an error in logic. The RosterEntry is being removed from the group irregardless of whether or not the error is returned. So, when an error does occur calls to Roster#contains(user) where user is the user that was not successfully removed, leaving them still in your contact list, return false where in fact it should be true.

Hey Alex,

While I was swimming in the pool during my vacations I realized of the same problem. I created the issue SMACK-73 for this error. You can download the next nightly build that includes a fix.

Thanks again for reporting this issue.

Regards,

– Gato