Mesibo Group Management - Managing Group Members and Admins

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:

ParameterDescription
addressesArray of User addresses to be added as group members
addressA User address to be added as group members
permissionsMember Permissions object describing permissions to grant to the member (refer below)

Member permissions class MesiboMemberPermissions has following members:

MemberDescription
flagsMember Permissions (refer to the table below)
adminFlagsAdmin 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
callFlagsGroup Call Flags overriding the one set in the Group Settings, default 0
videoResolutionGroup Call video resolution overriding the one set in the Group Settings, default MESIBO_RESOLUTION_DEFAULT
callDurationMaximum call duration overriding the one set in the Group Settings

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

FlagDescription
MESIBO_MEMBERFLAG_SENDMember(s) can send messages to the group
MESIBO_MEMBERFLAG_RECVMember(s) can recv messages from the group
MESIBO_MEMBERFLAG_PUBLMember(s) can publish video/voice to the group conference
MESIBO_MEMBERFLAG_SUBSMember(s) can subscribe to video/voice from the group conference
MESIBO_MEMBERFLAG_LISTMember(s) can get list of publishers from the group conference
MESIBO_MEMBERFLAG_RECORDMember(s) can record the group conference
MESIBO_MEMBERFLAG_ALLAll permissions

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

FlagDescription
MESIBO_ADMINFLAG_MODIFYMember(s) can modify the group profile
MESIBO_ADMINFLAG_ADDUSERMember(s) can add other users to the group
MESIBO_ADMINFLAG_REMUSERMember(s) can remove other users from the group
MESIBO_ADMINFLAG_ADDADMINMember(s) can add other users as admin to the group
MESIBO_ADMINFLAG_REMADMINMember(s) can remove other admins from the group
MESIBO_ADMINFLAG_REMOWNERMember(s) can remove owner from the group
MESIBO_ADMINFLAG_REMGROUPMember(s) can remove the group
MESIBO_OWNERFLAG_ALLMember(s) have all the permissions
MESIBO_ADMINFLAG_ALLMember(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:

ParameterDescription
addressesArray of User addresses to be removed from the group
addressAddress 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:

ParameterDescription
countNumber of members to get from the group
restartGet members from the beginning
listenerGroup 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.