How to get current user's list of groups


I’ve written an XMPP client using Smack and shared groups and it’s working fine.

But there is a feature I don’t really know how to implement :

My users are sorted by groups. I’d like everygroup to has its own group discussion.

So what I’d like to do is create one MUC by group and then everytime a user logs in, he’d automaticaly join every group’s MUC he belongs to.

For example, if member A belongs to the groups SALES and IT, I’d like him to automatically join SALE’s MUC & IT’s MUC every time he logs in.

This doesn’t sound too complicated but I don’t know how to get which group my user belongs to.

I’d like to do (inside member A’s client ) :


getListOfGroupsImIn(); <-- How to do this ?

for(every group i’m in ){

join this group’s MUC


If i know which groups I belong to then i could easily join their MUCs since they’re “groupName@conference.myserver”