0

We are integrating MUC in our app for group chat. where we can create group(conference) and adding members. Questions are-

  1. Removed member still getting group messages. What is proper way of remove a member from group?
  2. How to get total members of group (online/offline)?

We are using following methods to remove a members-

 public void kickOutRoomMember(String groupJid, String memberNickName) {
    MultiUserChat muc;
    try {
        if (manager == null) {
            manager = MultiUserChatManager.getInstanceFor(connection);
        }
        muc = manager.getMultiUserChat(groupJid);
        muc.kickParticipant(memberNickName, "");
    } catch (Exception e) {
        e.printStackTrace();
    }
}

public void removeOutRoomMember(String groupJid, String memberNickName) {
    MultiUserChat muc;
    try {
        if (manager == null) {
            manager = MultiUserChatManager.getInstanceFor(connection);
        }
        muc = manager.getMultiUserChat(groupJid);
        muc.banUser(memberNickName, "");
    } catch (Exception e) {
        e.printStackTrace();
    }
}
Kalu Khan Luhar
  • 1,044
  • 1
  • 22
  • 35

2 Answers2

0

Theorically you are right. Just check

  1. If user who invokes banUser has grants to do it
  2. to pass bare jid and not memberNickName as first parameter in method.

javadoc

muc.banUser("Mickey Mouse", ""); //does not works
muc.banUser("mickeymouse@server","") // will works
MrPk
  • 2,862
  • 2
  • 20
  • 26
0

Install "Rest API" plugin.

Rest API plugin provides all the API related group. Create Or delete a group, Add or remove a member from a group, get all members of group etc..

Bhavesh Jabuvani
  • 329
  • 1
  • 14