powered by Jive Software

[MUC] How can I grant membership to a rostergroup?

I want to grant membership to a rostergroup from the client code like I can do it from the openfire admin console. I tried with this code:

MultiUserChatManager multiUserChatManager = MultiUserChatManager.getInstanceFor(connection);

MultiUserChat chatRoom = multiUserChatManager.getMultiUserChat(testGroup@conference.muc.test.org);

chatRoom.grantMembership(JidCreate.from("testGroup@muc.test.org"));

but the result in openfire is that the membership was granted to the (inexistent) user testGroup@muc.test.org, not to the group.

Is it possible to do what i’m trying to do?

Thanks

I’m not quite sure what you are trying to do. If you want to grant a user membership in the group, than you’d probably have to call

chatRoom.grantMembership(JidCreate.from("user@example.com"));

but I’m not sure.

No,I want to grant a rostergroup membership in the conference. Thanks.

I am pretty sure, this is not possible with standard XMPP.

XEP-0045 only specifies the case for single users:

XEP-0045: Multi-User Chat

I am not sure, if you can specify multiple users in one query though. The spec is blurry here. If yes, you could add all contacts from your roster group to the query. If not, you have to do multiple queries for each contact.