powered by Jive Software

RosterGroup.addEntry fails to add entries to the group

Hi,

I’'m using the following code to add existing users to new groups (assume no errors for this illustration):

roster.createGroup(groupName).addEntry(userEntry);

// send presence request

Problem is that addEntry is missing the following line in the “if (sendEntry)” block:

item.addGroupName(this.getName());

So the surrounding call would have to be modified to read:

Item item = RosterEntry.toRosterItem(entry);

item.addGroupName(this.getName());

packet.addRosterItem(item);

Funny thing is that this seems to have been broken for ever by looking at the SVN repository (at least for 2 years). However, now I see that Roster.createEntry (which I use to create new user entries) already does the same thing; so I might as well just change the logic a bit and just use that.

Is there a reason for having duplicated means to achieve the same result?

Also, the block below “Add the entry locally” should be changed to “addEntryLocal(entry);” or the entry will end up appearing twice in the RosterGroup in the case mentioned above.