powered by Jive Software

Persistant groups in Rosters

Hi,

I am developping a chat application relying on Jive Messenger and, while coding the client interface, I cannot sort out a roster problem.

Indeed, I want my users to have a persistant default group in their Roster. This group could be empty but must exist to enable users to add/remove entries in this default group with very short commands (they can also create new groups and add/remove users in these groups with advanced commands).

But with Smack, I realised that, if I create a group and add entries to it, the group always disappear when all the entries are removed from it. Is there any way to make this default group survive when it becomes empty? I did not find cool way to code that…

Thanks,

Seb

Hey Seb,

According to the XMPP spec a roster item may belong to 0, 1 or many groups. However, the XMPP spec does not mention that groups may exist alone per se. This means that groups only exist if a roster item belongs to group.

However, some clients (e.g. Trillian) overcome this “limitation” by not following the XMPP spec. Since Smack tries to follow the spec 100%, this feature is not permitted. Anyway, you may add this enhancement but you will need to keep the list of groups locally or in another server since the XMPP servers won’'t help you in this.

Regards,

– Gato

Thanks for your help.

After all, what seems to me tricky was the fact that I can create an empty group, but I do not have simply ways to keep it alive. So, I am going to go back to my application specifications to find a more “XMPP compliant” way to complete this use case

I was thinking about a possible solution to my problem. Is it mandatory to create a group using Roster#createGroup(groupName) before adding item to it, or is it possible to call directly, without restrictions, Roster#createEntry(jid,nick,) when groupName has not be defined before?