Mesibo Group Management - Managing Group Members and Admins

Estimated reading time: 6 minutes

Adding Group Members and Admins

You can add members, and admins to the group by calling addMembers API of the group profile. You need to pass the addresses of the users to be added as group members, permissions to be granted and admin permissions if you are adding them as group admins.

You call the same API for adding members or modifying their member and admin permissions.

When you add members or make them admin, they will be immediately notified by a listener function (explained later).

int addMembers(String[] addresses, MesiboMemberPermissions permissions)

int addMember(String address, MesiboMemberPermissions permissions)

addMembers takes the following parameters:

Parameter Description
addresses Array of User addresses to be added as group members
address A User address to be added as group members
permissions Member Permissions object describing permissions to grant to the member (refer below)

Member permissions class MesiboMemberPermissions has following members:

Member Description
flags Member Permissions (refer to the table below)
adminFlags Admin Permissions (refer to the table below) if you are adding members as admin, pass 0 otherwise. You need to have the necessary admin permissions to add other users as admin
callFlags Group Call Flags overriding the one set in the Group Settings, default 0
videoResolution Group Call video resolution overriding the one set in the Group Settings, default MESIBO_RESOLUTION_DEFAULT
callDuration Maximum call duration overriding the one set in the Group Settings

Permissions can be a logical OR combination of one or more permission values below:

Flag Description
MESIBO_MEMBERFLAG_SEND Member(s) can send messages to the group
MESIBO_MEMBERFLAG_RECV Member(s) can recv messages from the group
MESIBO_MEMBERFLAG_PUBL Member(s) can publish video/voice to the group conference
MESIBO_MEMBERFLAG_SUBS Member(s) can subscribe to video/voice from the group conference
MESIBO_MEMBERFLAG_LIST Member(s) can get list of publishers from the group conference
MESIBO_MEMBERFLAG_RECORD Member(s) can record the group conference
MESIBO_MEMBERFLAG_ALL All permissions

Admin Permissions can be a logical OR combination of one or more permission values below:

Flag Description
MESIBO_ADMINFLAG_MODIFY Member(s) can modify the group profile
MESIBO_ADMINFLAG_ADDUSER Member(s) can add other users to the group
MESIBO_ADMINFLAG_REMUSER Member(s) can remove other users from the group
MESIBO_ADMINFLAG_ADDADMIN Member(s) can add other users as admin to the group
MESIBO_ADMINFLAG_REMADMIN Member(s) can remove other admins from the group
MESIBO_ADMINFLAG_REMOWNER Member(s) can remove owner from the group
MESIBO_ADMINFLAG_REMGROUP Member(s) can remove the group
MESIBO_OWNERFLAG_ALL Member(s) have all the permissions
MESIBO_ADMINFLAG_ALL Member(s) have all the permissions except removing owner

For example, use the following code to add members to a group. The profile in the code below is the MesiboProfile object for a group obtained by calling getProfile or createGroup APIs. Refer to the Profile APIs for more information.

In Java,

MesiboGroupProfile gp = profile.getGroupProfile();

MesiboGroupProfile.MemberPermissions permissions = new MesiboGroupProfile.MemberPermissions();
permissions.flags = MesiboGroupProfile.MEMBERFLAG_ALL;
permissions.adminFlags = 0;
gp.addMember(address, permissions);

In Kotlin

val gp = profile.groupProfile

var permissions: MesiboGroupProfile.MemberPermissions = MesiboGroupProfile.MemberPermissions();
permissions.flags = MesiboGroupProfile.MEMBERFLAG_ALL.toLong()
permissions.adminFlags = 0;
gp.addMembers(members, permissions)

In Objective-C,

MesiboGroupProfile *gp = [profile getGroupProfile];

MesiboMemberPermissions *permissions = [MesiboMemberPermissions new];
permissions.flags = MESIBO_MEMBERFLAG_ALL;
permissions.adminFlags = 0;
[gp addMembers:members permissions:mp];

In Swift,

let gp = profile?.getGroupProfile()

let permissions:MesiboMemberPermissions = MesiboMemberPermissions();
permissions.flags = UInt32(MESIBO_MEMBERFLAG_ALL);
permissions.adminFlags = 0;
gp?.addMembers(members, permissions:mp)

In Javascript

var gp = profile.getGroupProfile();

var permissions = {};
permissions.flags = MESIBO_MEMBERFLAG_ALL;

gp.addMember(address, permissions);

Removing Group Members and Admins

You can remove members, and admins from the group by calling removeMembers API of the group profile. You need to have the necessary admin permissions as described above to remove other users and admins from the group.

When you remove members, they will be immediately notified by a listener function (explained later).

int removeMembers(String[] addresses)

int removeMember(String address)

removeMembers takes the following parameters:

Parameter Description
addresses Array of User addresses to be removed from the group
address Address of the User to be removed from the group

Get Group Members

You can get group members and admins by calling getMembers API of the group profile. When you call getMembers API, Mesibo_onGroupMembers callback function in the listener will be called with the array of Group Members.

int getMembers(int count, boolean restart, GroupListener listener);

getMembers takes the following parameters:

Parameter Description
count Number of members to get from the group
restart Get members from the beginning
listener Group listener instance which will be called when group members are retrived. Note that, if you are using Javascript, you can pass listener or a callback function. For all other platforms, it is the listener.
group messaging, api